diff --git a/chpl/chpl-api/src/main/java/gov/healthit/chpl/web/controller/SearchController.java b/chpl/chpl-api/src/main/java/gov/healthit/chpl/web/controller/SearchController.java index 13814dca95..04f41a1b08 100644 --- a/chpl/chpl-api/src/main/java/gov/healthit/chpl/web/controller/SearchController.java +++ b/chpl/chpl-api/src/main/java/gov/healthit/chpl/web/controller/SearchController.java @@ -41,124 +41,133 @@ public SearchController(ListingSearchService searchService) { "checkstyle:methodlength", "checkstyle:parameternumber" }) @Operation(summary = "Search the CHPL", - description = "This endpoint will always use the oldest, valid version of the " - + "/search/vX endpoint. The current version being used is v3. For the " - + "current documentation, see /search/v3.", + description = "This endpoint will always use the oldest, valid version of the " + + "/search/vX endpoint. The current version being used is v3. For the " + + "current documentation, see /search/v3.", security = {@SecurityRequirement(name = SwaggerSecurityRequirement.API_KEY)}) @RequestMapping(method = RequestMethod.GET, produces = "application/json; charset=utf-8") public @ResponseBody ListingSearchResponse search( - @Parameter(description = "CHPL ID, Developer (or previous developer) Name, Product Name, ONC-ACB Certification ID", + @Parameter(description = "CHPL ID, Developer (or previous developer) Name, Product Name, ONC-ACB Certification ID", allowEmptyValue = true, in = ParameterIn.QUERY, name = "searchTerm") - @RequestParam(value = "searchTerm", required = false, defaultValue = "") String searchTerm, - @Parameter(description = "A comma-separated list of listing IDs to be queried together (ex: \"1,2\" finds the listing with ID 1 and the listing with ID 2.", + @RequestParam(value = "searchTerm", required = false, defaultValue = "") String searchTerm, + @Parameter(description = "A comma-separated list of listing IDs to be queried together (ex: \"1,2\" finds the listing with ID 1 and the listing with ID 2.", allowEmptyValue = true, in = ParameterIn.QUERY, name = "listingIds") - @RequestParam(value = "listingIds", required = false, defaultValue = "") String listingIdsDelimited, - @Parameter(description = "A comma-separated list of certification statuses (ex: \"Active,Retired,Withdrawn by Developer\"). Results may match any of the provided statuses.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationStatuses") - @RequestParam(value = "certificationStatuses", required = false, defaultValue = "") String certificationStatusesDelimited, - @Parameter(description = "A comma-separated list of derived certification editions (ex: \"2015,2015 Cures Update\" finds listings that are either 2015 or 2015 Cures Update). Allowable values are 2011, 2014, 2015, and \"2015 Cures Update\". Results may match any of the provided derived editions.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "derivedCertificationEditions") - @RequestParam(value = "derivedCertificationEditions", required = false, defaultValue = "") String derivedCertificationEditionsDelimited, - @Parameter(description = "A comma-separated list of certification criteria IDs to be queried together (ex: \"1,2\" finds listings attesting to 170.315 (a)(1) or 170.315 (a)(2)).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationCriteriaIds") - @RequestParam(value = "certificationCriteriaIds", required = false, defaultValue = "") String certificationCriteriaIdsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR. " - + "Indicates whether a listing must have all certificationCriteriaIds or " - + "may have any one or more of the certificationCriteriaIds.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationCriteriaOperator") - @RequestParam(value = "certificationCriteriaOperator", required = false, defaultValue = "OR") String certificationCriteriaOperatorStr, - @Parameter(description = "A comma-separated list of cqms to be queried together (ex: \"CMS2,CMS9\" " - + "finds listings with either CMS2 or CMS9).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "cqms") - @RequestParam(value = "cqms", required = false, defaultValue = "") String cqmsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR. " - + "Indicates whether a listing must have all cqms or may have any one or more of the cqms.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "cqmsOperator") - @RequestParam(value = "cqmsOperator", required = false, defaultValue = "OR") String cqmsOperatorStr, - @Parameter(description = "A comma-separated list of certification body names to be 'or'ed together " - + "(ex: \"Drummond,ICSA\" finds listings belonging to either Drummond or ICSA).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationBodies") - @RequestParam(value = "certificationBodies", required = false, defaultValue = "") String certificationBodiesDelimited, - @Parameter(description = "True or False if a listing has ever had surveillance or direct reviews.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasHadComplianceActivity") - @RequestParam(value = "hasHadComplianceActivity", required = false, defaultValue = "") Boolean hasHadComplianceActivity, - @Parameter(description = "A comma-separated list of non-conformity search options applied across surveillance and direct review activity. " - + "Valid options are OPEN_NONCONFORMITY, CLOSED_NONCONFORMITY, NEVER_NONCONFORMITY," - + "NOT_OPEN_NONCONFORMITY, NOT_CLOSED_NONCONFORMITY, and NOT_NEVER_NONCONFORMITY.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "nonConformityOptions") - @RequestParam(value = "nonConformityOptions", required = false, defaultValue = "") String nonConformityOptionsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR." - + "Indicates whether a listing must have met all nonConformityOptions " - + "specified or may have met any one or more of the nonConformityOptions", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "nonConformityOptionsOperator") - @RequestParam(value = "nonConformityOptionsOperator", required = false, defaultValue = "OR") String nonConformityOptionsOperator, - @Parameter(description = "A comma-separated list of Real World Testing search options. " - + "Valid options are HAS_PLANS_URL, HAS_RESULTS_URL, NO_PLANS_URL, NO_RESULTS_URL", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "rwtOptions") - @RequestParam(value = "rwtOptions", required = false, defaultValue = "") String rwtOptionsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR." - + "Indicates whether a listing must have met all rwtOptions specified or may have met any one or more of the rwtOptions", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "rwtOperator") - @RequestParam(value = "rwtOperator", required = false, defaultValue = "OR") String rwtOperator, - @Parameter(description = "A comma-separated list of SVAP IDs to be queried together (ex: \"1,2\" finds listings associated with those SVAPs).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "svapIds") - @RequestParam(value = "svapIds", required = false, defaultValue = "") String svapIdsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR. " - + "Indicates whether a listing must have all svapIds or may have any one or more of the svapIds.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "svapOperator") - @RequestParam(value = "svapOperator", required = false, defaultValue = "OR") String svapOperatorStr, - @Parameter(description = "Specifies whether to match listings with an empty or non-empty SVAP Notice Url.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasSvapNoticeUrl") - @RequestParam(value = "hasSvapNoticeUrl", required = false, defaultValue = "") Boolean hasSvapNoticeUrl, - @Parameter(description = "Specifies whether to match listings with SVAP data associated to any criteria or " - + "a non-empty SVAP Notice URL.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasAnySvap") - @RequestParam(value = "hasAnySvap", required = false, defaultValue = "") Boolean hasAnySvap, - @Parameter(description = "The full name of a developer.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "developer") - @RequestParam(value = "developer", required = false, defaultValue = "") String developer, - @Parameter(description = "The full name of a product.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "product") - @RequestParam(value = "product", required = false, defaultValue = "") String product, - @Parameter(description = "The full name of a version.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "version") - @RequestParam(value = "version", required = false, defaultValue = "") String version, - @Parameter(description = "A practice type (either Ambulatory or Inpatient). Valid only for 2014 listings.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "practiceType") - @RequestParam(value = "practiceType", required = false, defaultValue = "") String practiceType, - @Parameter(description = "To return only listings certified on or after this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationDateStart") - @RequestParam(value = "certificationDateStart", required = false, defaultValue = "") String certificationDateStart, - @Parameter(description = "To return only listings certified on or before this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationDateEnd") - @RequestParam(value = "certificationDateEnd", required = false, defaultValue = "") String certificationDateEnd, - @Parameter(description = "To return only listings decertified on or after this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, - allowEmptyValue = true, in = ParameterIn.QUERY, name = "decertificationDateStart") - @RequestParam(value = "decertificationDateStart", required = false, defaultValue = "") String decertificationDateStart, - @Parameter(description = "To return only listings decertified on or before this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, - allowEmptyValue = true, in = ParameterIn.QUERY, name = "decertificationDateEnd") - @RequestParam(value = "decertificationDateEnd", required = false, defaultValue = "") String decertificationDateEnd, - @Parameter(description = "Zero-based page number used in concert with pageSize. Defaults to 0.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "pageNumber") - @RequestParam(value = "pageNumber", required = false, defaultValue = "0") Integer pageNumber, - @Parameter(description = "Number of results to return used in concert with pageNumber. " - + "Defaults to 20. Maximum allowed page size is 100.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "pageSize") - @RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize, - @Parameter(description = "What to order by. Options are one of the following: CERTIFICATION_DATE, CHPL_ID, " - + "DEVELOPER, PRODUCT, VERSION, EDITION, STATUS, OPEN_SURVEILLANCE_NC_COUNT, CLOSED_SURVEILLANCE_NC_COUNT, " - + "OPEN_DIRECT_REVIEW_NC_COUNT, or CLOSED_DIRECT_REVIEW_NC_COUNT. Defaults to PRODUCT.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "orderBy") - @RequestParam(value = "orderBy", required = false, defaultValue = "product") String orderBy, - @Parameter(description = "Use to specify the direction of the sort. Defaults to false (ascending sort).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "sortDescending") - @RequestParam(value = "sortDescending", required = false, defaultValue = "false") Boolean sortDescending) - throws InvalidArgumentsException, ValidationException { + @RequestParam(value = "listingIds", required = false, defaultValue = "") String listingIdsDelimited, + @Parameter(description = "A comma-separated list of certification statuses (ex: \"Active,Retired,Withdrawn by Developer\"). Results may match any of the provided statuses.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationStatuses") + @RequestParam(value = "certificationStatuses", required = false, defaultValue = "") String certificationStatusesDelimited, + @Parameter(description = "A comma-separated list of derived certification editions (ex: \"2015,2015 Cures Update\" finds listings that are either 2015 or 2015 Cures Update). Allowable values are 2011, 2014, 2015, and \"2015 Cures Update\". Results may match any of the provided derived editions.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "derivedCertificationEditions") + @RequestParam(value = "derivedCertificationEditions", required = false, defaultValue = "") String derivedCertificationEditionsDelimited, + @Parameter(description = "A comma-separated list of certification criteria IDs to be queried together (ex: \"1,2\" finds listings attesting to 170.315 (a)(1) or 170.315 (a)(2)).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationCriteriaIds") + @RequestParam(value = "certificationCriteriaIds", required = false, defaultValue = "") String certificationCriteriaIdsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR. " + + "Indicates whether a listing must have all certificationCriteriaIds or " + + "may have any one or more of the certificationCriteriaIds.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationCriteriaOperator") + @RequestParam(value = "certificationCriteriaOperator", required = false, defaultValue = "OR") String certificationCriteriaOperatorStr, + @Parameter(description = "A comma-separated list of cqms to be queried together (ex: \"CMS2,CMS9\" " + + "finds listings with either CMS2 or CMS9).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "cqms") + @RequestParam(value = "cqms", required = false, defaultValue = "") String cqmsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR. " + + "Indicates whether a listing must have all cqms or may have any one or more of the cqms.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "cqmsOperator") + @RequestParam(value = "cqmsOperator", required = false, defaultValue = "OR") String cqmsOperatorStr, + @Parameter(description = "A comma-separated list of certification body names to be 'or'ed together " + + "(ex: \"Drummond,ICSA\" finds listings belonging to either Drummond or ICSA).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationBodies") + @RequestParam(value = "certificationBodies", required = false, defaultValue = "") String certificationBodiesDelimited, + @Parameter(description = "True or False if a listing has ever had surveillance or direct reviews.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasHadComplianceActivity") + @RequestParam(value = "hasHadComplianceActivity", required = false, defaultValue = "") Boolean hasHadComplianceActivity, + @Parameter(description = "A comma-separated list of non-conformity search options applied across surveillance and direct review activity. " + + "Valid options are OPEN_NONCONFORMITY, CLOSED_NONCONFORMITY, NEVER_NONCONFORMITY," + + "NOT_OPEN_NONCONFORMITY, NOT_CLOSED_NONCONFORMITY, and NOT_NEVER_NONCONFORMITY.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "nonConformityOptions") + @RequestParam(value = "nonConformityOptions", required = false, defaultValue = "") String nonConformityOptionsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR." + + "Indicates whether a listing must have met all nonConformityOptions " + + "specified or may have met any one or more of the nonConformityOptions", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "nonConformityOptionsOperator") + @RequestParam(value = "nonConformityOptionsOperator", required = false, defaultValue = "OR") String nonConformityOptionsOperator, + @Parameter(description = "A comma-separated list of Real World Testing search options. " + + "Valid options are HAS_PLANS_URL, HAS_RESULTS_URL, NO_PLANS_URL, NO_RESULTS_URL", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "rwtOptions") + @RequestParam(value = "rwtOptions", required = false, defaultValue = "") String rwtOptionsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR." + + "Indicates whether a listing must have met all rwtOptions specified or may have met any one or more of the rwtOptions", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "rwtOperator") + @RequestParam(value = "rwtOperator", required = false, defaultValue = "OR") String rwtOperator, + @Parameter(description = "A comma-separated list of SVAP IDs to be queried together (ex: \"1,2\" finds listings associated with those SVAPs).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "svapIds") + @RequestParam(value = "svapIds", required = false, defaultValue = "") String svapIdsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR. " + + "Indicates whether a listing must have all svapIds or may have any one or more of the svapIds.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "svapOperator") + @RequestParam(value = "svapOperator", required = false, defaultValue = "OR") String svapOperatorStr, + @Parameter(description = "Specifies whether to match listings with an empty or non-empty SVAP Notice Url.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasSvapNoticeUrl") + @RequestParam(value = "hasSvapNoticeUrl", required = false, defaultValue = "") Boolean hasSvapNoticeUrl, + @Parameter(description = "Specifies whether to match listings with SVAP data associated to any criteria or " + + "a non-empty SVAP Notice URL.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasAnySvap") + @RequestParam(value = "hasAnySvap", required = false, defaultValue = "") Boolean hasAnySvap, + @Parameter(description = "A comma-separated list of Risk Management Summary Information search options. " + + "Valid options are HAS_RISK_MANAGEMENT_SUMMARY_INFORMATION, NO_RISK_MANAGEMENT_SUMMARY_INFOMRATION", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "riskManagementSummaryInformationOptions") + @RequestParam(value = "riskManagementSummaryInformationOptions", required = false, defaultValue = "") String riskManagementSummaryInformationOptionsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR." + + "Indicates whether a listing must have met all riskManagementSummaryInformationOptions specified or may have met any one or more of the riskManagementSummaryInformationOptions", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "riskManagementSummaryInformationOperator") + @RequestParam(value = "riskManagementSummaryInformationOperator", required = false, defaultValue = "OR") String riskManagementSummaryInformationOperator, + @Parameter(description = "The full name of a developer.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "developer") + @RequestParam(value = "developer", required = false, defaultValue = "") String developer, + @Parameter(description = "The full name of a product.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "product") + @RequestParam(value = "product", required = false, defaultValue = "") String product, + @Parameter(description = "The full name of a version.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "version") + @RequestParam(value = "version", required = false, defaultValue = "") String version, + @Parameter(description = "A practice type (either Ambulatory or Inpatient). Valid only for 2014 listings.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "practiceType") + @RequestParam(value = "practiceType", required = false, defaultValue = "") String practiceType, + @Parameter(description = "To return only listings certified on or after this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationDateStart") + @RequestParam(value = "certificationDateStart", required = false, defaultValue = "") String certificationDateStart, + @Parameter(description = "To return only listings certified on or before this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationDateEnd") + @RequestParam(value = "certificationDateEnd", required = false, defaultValue = "") String certificationDateEnd, + @Parameter(description = "To return only listings decertified on or after this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, + allowEmptyValue = true, in = ParameterIn.QUERY, name = "decertificationDateStart") + @RequestParam(value = "decertificationDateStart", required = false, defaultValue = "") String decertificationDateStart, + @Parameter(description = "To return only listings decertified on or before this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, + allowEmptyValue = true, in = ParameterIn.QUERY, name = "decertificationDateEnd") + @RequestParam(value = "decertificationDateEnd", required = false, defaultValue = "") String decertificationDateEnd, + @Parameter(description = "Zero-based page number used in concert with pageSize. Defaults to 0.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "pageNumber") + @RequestParam(value = "pageNumber", required = false, defaultValue = "0") Integer pageNumber, + @Parameter(description = "Number of results to return used in concert with pageNumber. " + + "Defaults to 20. Maximum allowed page size is 100.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "pageSize") + @RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize, + @Parameter(description = "What to order by. Options are one of the following: CERTIFICATION_DATE, CHPL_ID, " + + "DEVELOPER, PRODUCT, VERSION, EDITION, STATUS, OPEN_SURVEILLANCE_NC_COUNT, CLOSED_SURVEILLANCE_NC_COUNT, " + + "OPEN_DIRECT_REVIEW_NC_COUNT, or CLOSED_DIRECT_REVIEW_NC_COUNT. Defaults to PRODUCT.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "orderBy") + @RequestParam(value = "orderBy", required = false, defaultValue = "product") String orderBy, + @Parameter(description = "Use to specify the direction of the sort. Defaults to false (ascending sort).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "sortDescending") + @RequestParam(value = "sortDescending", required = false, defaultValue = "false") Boolean sortDescending) + throws InvalidArgumentsException, ValidationException { return searchV3(searchTerm, listingIdsDelimited, certificationStatusesDelimited, derivedCertificationEditionsDelimited, certificationCriteriaIdsDelimited, certificationCriteriaOperatorStr, cqmsDelimited, cqmsOperatorStr, certificationBodiesDelimited, hasHadComplianceActivity, nonConformityOptionsDelimited, nonConformityOptionsOperator, rwtOptionsDelimited, rwtOperator, - svapIdsDelimited, svapOperatorStr, hasSvapNoticeUrl, hasAnySvap, developer, + svapIdsDelimited, svapOperatorStr, hasSvapNoticeUrl, hasAnySvap, riskManagementSummaryInformationOptionsDelimited, + riskManagementSummaryInformationOperator, developer, product, version, practiceType, certificationDateStart, certificationDateEnd, decertificationDateStart, decertificationDateEnd, pageNumber, pageSize, orderBy, sortDescending); } @@ -167,122 +176,130 @@ public SearchController(ListingSearchService searchService) { "checkstyle:methodlength", "checkstyle:parameternumber" }) @Operation(summary = "Search the CHPL", - description = "If paging parameters are not specified, the first 20 records are returned by default. " - + "All parameters are optional. " - + "Any parameter that can accept multiple things (i.e. certificationStatuses) expects " - + "a comma-delimited list of those things (i.e. certificationStatuses = Active,Suspended). " - + "Date parameters are required to be in the format " - + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT + ". ", + description = "If paging parameters are not specified, the first 20 records are returned by default. " + + "All parameters are optional. " + + "Any parameter that can accept multiple things (i.e. certificationStatuses) expects " + + "a comma-delimited list of those things (i.e. certificationStatuses = Active,Suspended). " + + "Date parameters are required to be in the format " + + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT + ". ", security = {@SecurityRequirement(name = SwaggerSecurityRequirement.API_KEY)}) @RequestMapping(value = "/v3", method = RequestMethod.GET, produces = "application/json; charset=utf-8") public @ResponseBody ListingSearchResponse searchV3( - @Parameter(description = "CHPL ID, Developer (or previous developer) Name, Product Name, ONC-ACB Certification ID", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "searchTerm") - @RequestParam(value = "searchTerm", required = false, defaultValue = "") String searchTerm, - @Parameter(description = "A comma-separated list of listing IDs to be queried together (ex: \"1,2\" finds the listing with ID 1 and the listing with ID 2.", + @Parameter(description = "CHPL ID, Developer (or previous developer) Name, Product Name, ONC-ACB Certification ID", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "searchTerm") + @RequestParam(value = "searchTerm", required = false, defaultValue = "") String searchTerm, + @Parameter(description = "A comma-separated list of listing IDs to be queried together (ex: \"1,2\" finds the listing with ID 1 and the listing with ID 2.", allowEmptyValue = true, in = ParameterIn.QUERY, name = "listingIds") - @RequestParam(value = "listingIds", required = false, defaultValue = "") String listingIdsDelimited, - @Parameter(description = "A comma-separated list of certification statuses (ex: \"Active,Retired,Withdrawn by Developer\"). Results may match any of the provided statuses.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationStatuses") - @RequestParam(value = "certificationStatuses", required = false, defaultValue = "") String certificationStatusesDelimited, - @Parameter(description = "A comma-separated list of derived certification editions (ex: \"2015,2015 Cures Update\" finds listings that are either 2015 or 2015 Cures Update). Allowable values are 2011, 2014, 2015, and \"2015 Cures Update\". Results may match any of the provided derived editions.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "derivedCertificationEditions") - @RequestParam(value = "derivedCertificationEditions", required = false, defaultValue = "") String derivedCertificationEditionsDelimited, - @Parameter(description = "A comma-separated list of certification criteria IDs to be queried together (ex: \"1,2\" finds listings attesting to 170.315 (a)(1) or 170.315 (a)(2)).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationCriteriaIds") - @RequestParam(value = "certificationCriteriaIds", required = false, defaultValue = "") String certificationCriteriaIdsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR. " - + "Indicates whether a listing must have all certificationCriteriaIds or " - + "may have any one or more of the certificationCriteriaIds.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationCriteriaOperator") - @RequestParam(value = "certificationCriteriaOperator", required = false, defaultValue = "OR") String certificationCriteriaOperatorStr, - @Parameter(description = "A comma-separated list of cqms to be queried together (ex: \"CMS2,CMS9\" " - + "finds listings with either CMS2 or CMS9).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "cqms") - @RequestParam(value = "cqms", required = false, defaultValue = "") String cqmsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR. " - + "Indicates whether a listing must have all cqms or may have any one or more of the cqms.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "cqmsOperator") - @RequestParam(value = "cqmsOperator", required = false, defaultValue = "OR") String cqmsOperatorStr, - @Parameter(description = "A comma-separated list of certification body names to be 'or'ed together " - + "(ex: \"Drummond,ICSA\" finds listings belonging to either Drummond or ICSA).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationBodies") - @RequestParam(value = "certificationBodies", required = false, defaultValue = "") String certificationBodiesDelimited, - @Parameter(description = "True or False if a listing has ever had surveillance or direct reviews.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasHadComplianceActivity") - @RequestParam(value = "hasHadComplianceActivity", required = false, defaultValue = "") Boolean hasHadComplianceActivity, - @Parameter(description = "A comma-separated list of non-conformity search options applied across surveillance and direct review activity. " - + "Valid options are OPEN_NONCONFORMITY, CLOSED_NONCONFORMITY, NEVER_NONCONFORMITY," - + "NOT_OPEN_NONCONFORMITY, NOT_CLOSED_NONCONFORMITY, and NOT_NEVER_NONCONFORMITY.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "nonConformityOptions") - @RequestParam(value = "nonConformityOptions", required = false, defaultValue = "") String nonConformityOptionsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR." - + "Indicates whether a listing must have met all nonConformityOptions " - + "specified or may have met any one or more of the nonConformityOptions", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "nonConformityOptionsOperator") - @RequestParam(value = "nonConformityOptionsOperator", required = false, defaultValue = "OR") String nonConformityOptionsOperator, - @Parameter(description = "A comma-separated list of Real World Testing search options. " - + "Valid options are HAS_PLANS_URL, HAS_RESULTS_URL, NO_PLANS_URL, NO_RESULTS_URL", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "rwtOptions") - @RequestParam(value = "rwtOptions", required = false, defaultValue = "") String rwtOptionsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR." - + "Indicates whether a listing must have met all rwtOptions specified or may have met any one or more of the rwtOptions", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "rwtOperator") - @RequestParam(value = "rwtOperator", required = false, defaultValue = "OR") String rwtOperator, - @Parameter(description = "A comma-separated list of SVAP IDs to be queried together (ex: \"1,2\" finds listings associated with those SVAPs).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "svapIds") - @RequestParam(value = "svapIds", required = false, defaultValue = "") String svapIdsDelimited, - @Parameter(description = "Either AND or OR. Defaults to OR. " - + "Indicates whether a listing must have all svapIds or may have any one or more of the svapIds.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "svapOperator") - @RequestParam(value = "svapOperator", required = false, defaultValue = "OR") String svapOperatorStr, - @Parameter(description = "Specifies whether to match listings with an empty or non-empty SVAP Notice Url.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasSvapNoticeUrl") - @RequestParam(value = "hasSvapNoticeUrl", required = false, defaultValue = "") Boolean hasSvapNoticeUrl, - @Parameter(description = "Specifies whether to match listings with SVAP data associated to any criteria or " - + "a non-empty SVAP Notice URL.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasAnySvap") - @RequestParam(value = "hasAnySvap", required = false, defaultValue = "") Boolean hasAnySvap, - @Parameter(description = "The full name of a developer.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "developer") - @RequestParam(value = "developer", required = false, defaultValue = "") String developer, - @Parameter(description = "The full name of a product.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "product") - @RequestParam(value = "product", required = false, defaultValue = "") String product, - @Parameter(description = "The full name of a version.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "version") - @RequestParam(value = "version", required = false, defaultValue = "") String version, - @Parameter(description = "A practice type (either Ambulatory or Inpatient). Valid only for 2014 listings.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "practiceType") - @RequestParam(value = "practiceType", required = false, defaultValue = "") String practiceType, - @Parameter(description = "To return only listings certified on or after this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationDateStart") - @RequestParam(value = "certificationDateStart", required = false, defaultValue = "") String certificationDateStart, - @Parameter(description = "To return only listings certified on or before this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, - allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationDateEnd") - @RequestParam(value = "certificationDateEnd", required = false, defaultValue = "") String certificationDateEnd, - @Parameter(description = "To return only listings decertified on or after this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, - allowEmptyValue = true, in = ParameterIn.QUERY, name = "decertificationDateStart") - @RequestParam(value = "decertificationDateStart", required = false, defaultValue = "") String decertificationDateStart, - @Parameter(description = "To return only listings decertified on or before this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, - allowEmptyValue = true, in = ParameterIn.QUERY, name = "decertificationDateEnd") - @RequestParam(value = "decertificationDateEnd", required = false, defaultValue = "") String decertificationDateEnd, - @Parameter(description = "Zero-based page number used in concert with pageSize. Defaults to 0.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "pageNumber") - @RequestParam(value = "pageNumber", required = false, defaultValue = "0") Integer pageNumber, - @Parameter(description = "Number of results to return used in concert with pageNumber. " - + "Defaults to 20. Maximum allowed page size is 100.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "pageSize") - @RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize, - @Parameter(description = "What to order by. Options are one of the following: CERTIFICATION_DATE, CHPL_ID, " - + "DEVELOPER, PRODUCT, VERSION, EDITION, STATUS, OPEN_SURVEILLANCE_NC_COUNT, CLOSED_SURVEILLANCE_NC_COUNT, " - + "OPEN_DIRECT_REVIEW_NC_COUNT, or CLOSED_DIRECT_REVIEW_NC_COUNT. Defaults to PRODUCT.", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "orderBy") - @RequestParam(value = "orderBy", required = false, defaultValue = "product") String orderBy, - @Parameter(description = "Use to specify the direction of the sort. Defaults to false (ascending sort).", - allowEmptyValue = true, in = ParameterIn.QUERY, name = "sortDescending") - @RequestParam(value = "sortDescending", required = false, defaultValue = "false") Boolean sortDescending) - throws InvalidArgumentsException, ValidationException { + @RequestParam(value = "listingIds", required = false, defaultValue = "") String listingIdsDelimited, + @Parameter(description = "A comma-separated list of certification statuses (ex: \"Active,Retired,Withdrawn by Developer\"). Results may match any of the provided statuses.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationStatuses") + @RequestParam(value = "certificationStatuses", required = false, defaultValue = "") String certificationStatusesDelimited, + @Parameter(description = "A comma-separated list of derived certification editions (ex: \"2015,2015 Cures Update\" finds listings that are either 2015 or 2015 Cures Update). Allowable values are 2011, 2014, 2015, and \"2015 Cures Update\". Results may match any of the provided derived editions.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "derivedCertificationEditions") + @RequestParam(value = "derivedCertificationEditions", required = false, defaultValue = "") String derivedCertificationEditionsDelimited, + @Parameter(description = "A comma-separated list of certification criteria IDs to be queried together (ex: \"1,2\" finds listings attesting to 170.315 (a)(1) or 170.315 (a)(2)).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationCriteriaIds") + @RequestParam(value = "certificationCriteriaIds", required = false, defaultValue = "") String certificationCriteriaIdsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR. " + + "Indicates whether a listing must have all certificationCriteriaIds or " + + "may have any one or more of the certificationCriteriaIds.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationCriteriaOperator") + @RequestParam(value = "certificationCriteriaOperator", required = false, defaultValue = "OR") String certificationCriteriaOperatorStr, + @Parameter(description = "A comma-separated list of cqms to be queried together (ex: \"CMS2,CMS9\" " + + "finds listings with either CMS2 or CMS9).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "cqms") + @RequestParam(value = "cqms", required = false, defaultValue = "") String cqmsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR. " + + "Indicates whether a listing must have all cqms or may have any one or more of the cqms.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "cqmsOperator") + @RequestParam(value = "cqmsOperator", required = false, defaultValue = "OR") String cqmsOperatorStr, + @Parameter(description = "A comma-separated list of certification body names to be 'or'ed together " + + "(ex: \"Drummond,ICSA\" finds listings belonging to either Drummond or ICSA).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationBodies") + @RequestParam(value = "certificationBodies", required = false, defaultValue = "") String certificationBodiesDelimited, + @Parameter(description = "True or False if a listing has ever had surveillance or direct reviews.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasHadComplianceActivity") + @RequestParam(value = "hasHadComplianceActivity", required = false, defaultValue = "") Boolean hasHadComplianceActivity, + @Parameter(description = "A comma-separated list of non-conformity search options applied across surveillance and direct review activity. " + + "Valid options are OPEN_NONCONFORMITY, CLOSED_NONCONFORMITY, NEVER_NONCONFORMITY," + + "NOT_OPEN_NONCONFORMITY, NOT_CLOSED_NONCONFORMITY, and NOT_NEVER_NONCONFORMITY.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "nonConformityOptions") + @RequestParam(value = "nonConformityOptions", required = false, defaultValue = "") String nonConformityOptionsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR." + + "Indicates whether a listing must have met all nonConformityOptions " + + "specified or may have met any one or more of the nonConformityOptions", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "nonConformityOptionsOperator") + @RequestParam(value = "nonConformityOptionsOperator", required = false, defaultValue = "OR") String nonConformityOptionsOperator, + @Parameter(description = "A comma-separated list of Real World Testing search options. " + + "Valid options are HAS_PLANS_URL, HAS_RESULTS_URL, NO_PLANS_URL, NO_RESULTS_URL", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "rwtOptions") + @RequestParam(value = "rwtOptions", required = false, defaultValue = "") String rwtOptionsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR." + + "Indicates whether a listing must have met all rwtOptions specified or may have met any one or more of the rwtOptions", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "rwtOperator") + @RequestParam(value = "rwtOperator", required = false, defaultValue = "OR") String rwtOperator, + @Parameter(description = "A comma-separated list of SVAP IDs to be queried together (ex: \"1,2\" finds listings associated with those SVAPs).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "svapIds") + @RequestParam(value = "svapIds", required = false, defaultValue = "") String svapIdsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR. " + + "Indicates whether a listing must have all svapIds or may have any one or more of the svapIds.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "svapOperator") + @RequestParam(value = "svapOperator", required = false, defaultValue = "OR") String svapOperatorStr, + @Parameter(description = "Specifies whether to match listings with an empty or non-empty SVAP Notice Url.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasSvapNoticeUrl") + @RequestParam(value = "hasSvapNoticeUrl", required = false, defaultValue = "") Boolean hasSvapNoticeUrl, + @Parameter(description = "Specifies whether to match listings with SVAP data associated to any criteria or " + + "a non-empty SVAP Notice URL.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "hasAnySvap") + @RequestParam(value = "hasAnySvap", required = false, defaultValue = "") Boolean hasAnySvap, + @Parameter(description = "A comma-separated list of Risk Management Summary Information search options. " + + "Valid options are HAS_RISK_MANAGEMENT_SUMMARY_INFORMATION, NO_RISK_MANAGEMENT_SUMMARY_INFOMRATION", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "riskManagementSummaryInformationOptions") + @RequestParam(value = "riskManagementSummaryInformationOptions", required = false, defaultValue = "") String riskManagementSummaryInformationOptionsDelimited, + @Parameter(description = "Either AND or OR. Defaults to OR." + + "Indicates whether a listing must have met all riskManagementSummaryInformationOptions specified or may have met any one or more of the riskManagementSummaryInformationOptions", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "riskManagementSummaryInformationOperator") + @RequestParam(value = "riskManagementSummaryInformationOperator", required = false, defaultValue = "OR") String riskManagementSummaryInformationOperator, + @Parameter(description = "The full name of a developer.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "developer") + @RequestParam(value = "developer", required = false, defaultValue = "") String developer, + @Parameter(description = "The full name of a product.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "product") + @RequestParam(value = "product", required = false, defaultValue = "") String product, + @Parameter(description = "The full name of a version.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "version") + @RequestParam(value = "version", required = false, defaultValue = "") String version, + @Parameter(description = "A practice type (either Ambulatory or Inpatient). Valid only for 2014 listings.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "practiceType") + @RequestParam(value = "practiceType", required = false, defaultValue = "") String practiceType, + @Parameter(description = "To return only listings certified on or after this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationDateStart") + @RequestParam(value = "certificationDateStart", required = false, defaultValue = "") String certificationDateStart, + @Parameter(description = "To return only listings certified on or before this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, + allowEmptyValue = true, in = ParameterIn.QUERY, name = "certificationDateEnd") + @RequestParam(value = "certificationDateEnd", required = false, defaultValue = "") String certificationDateEnd, + @Parameter(description = "To return only listings decertified on or after this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, + allowEmptyValue = true, in = ParameterIn.QUERY, name = "decertificationDateStart") + @RequestParam(value = "decertificationDateStart", required = false, defaultValue = "") String decertificationDateStart, + @Parameter(description = "To return only listings decertified on or before this date. Required format is " + SearchRequest.CERTIFICATION_DATE_SEARCH_FORMAT, + allowEmptyValue = true, in = ParameterIn.QUERY, name = "decertificationDateEnd") + @RequestParam(value = "decertificationDateEnd", required = false, defaultValue = "") String decertificationDateEnd, + @Parameter(description = "Zero-based page number used in concert with pageSize. Defaults to 0.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "pageNumber") + @RequestParam(value = "pageNumber", required = false, defaultValue = "0") Integer pageNumber, + @Parameter(description = "Number of results to return used in concert with pageNumber. " + + "Defaults to 20. Maximum allowed page size is 100.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "pageSize") + @RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize, + @Parameter(description = "What to order by. Options are one of the following: CERTIFICATION_DATE, CHPL_ID, " + + "DEVELOPER, PRODUCT, VERSION, EDITION, STATUS, OPEN_SURVEILLANCE_NC_COUNT, CLOSED_SURVEILLANCE_NC_COUNT, " + + "OPEN_DIRECT_REVIEW_NC_COUNT, or CLOSED_DIRECT_REVIEW_NC_COUNT. Defaults to PRODUCT.", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "orderBy") + @RequestParam(value = "orderBy", required = false, defaultValue = "product") String orderBy, + @Parameter(description = "Use to specify the direction of the sort. Defaults to false (ascending sort).", + allowEmptyValue = true, in = ParameterIn.QUERY, name = "sortDescending") + @RequestParam(value = "sortDescending", required = false, defaultValue = "false") Boolean sortDescending) + throws InvalidArgumentsException, ValidationException { SearchRequest searchRequest = SearchRequest.builder() .searchTerm(searchTerm.trim()) @@ -305,6 +322,8 @@ public SearchController(ListingSearchService searchService) { .svapOperatorString(svapOperatorStr) .hasSvapNoticeUrl(hasSvapNoticeUrl) .hasAnySvap(hasAnySvap) + .riskManagementSummaryInformationOptionsStrings(convertToSetWithDelimeter(riskManagementSummaryInformationOptionsDelimited, ",")) + .riskManagementSummaryInformationOperatorString(riskManagementSummaryInformationOperator) .developer(developer) .product(product) .version(version) diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/ListingSearchService.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/ListingSearchService.java index 7bbd9c62d2..f041a2efec 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/ListingSearchService.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/ListingSearchService.java @@ -125,7 +125,8 @@ public ListingSearchResponse findListings(SearchRequest searchRequest) throws Va .filter(listing -> matchesHasAnySvapFilter(listing, searchRequest.getHasAnySvap())) .filter(listing -> matchesSvapNoticeUrlFilter(listing, searchRequest.getHasSvapNoticeUrl())) .filter(listing -> matchesSvaps(listing, searchRequest.getSvapIds(), searchRequest.getSvapOperator())) - .filter(listing -> matchesRiskManagementSummaryInformationFilter(listing, searchRequest.getRiskManagementSummaryInformationOptions(), searchRequest.getRiskManagementUrlOperator())) + .filter(listing -> matchesRiskManagementSummaryInformationFilter(listing, searchRequest.getRiskManagementSummaryInformationOptions(), + searchRequest.getRiskManagementSummaryInformationOperator())) .collect(Collectors.toList()); LOGGER.debug("Total matched listings: " + matchedListings.size()); @@ -492,24 +493,26 @@ private boolean matchesRwtFilter(ListingSearchResult listing, Set riskManagementSummaryInformationOptions, - SearchSetOperator risskManagementSummaryInformationOperator) { + SearchSetOperator riskManagementSummaryInformationOperator) { if (CollectionUtils.isEmpty(riskManagementSummaryInformationOptions)) { return true; } - Boolean matchesHasPlansFilter = null; + String riskManagementSummaryInformation = listing.getRiskManagementSummaryInformation() != null ? listing.getRiskManagementSummaryInformation().getValue() : ""; + + Boolean riskManagementSummaryInformationFilter = null; if (riskManagementSummaryInformationOptions.contains(RiskManagementSummaryInformationlSearchOptions.HAS_RISK_MANAGEMENT_SUMMARY_INFORMATION)) { - matchesHasPlansFilter = StringUtils.isNotBlank(listing.getRiskManagementSummaryInformation().getValue()); + riskManagementSummaryInformationFilter = StringUtils.isNotBlank(riskManagementSummaryInformation); } - Boolean matchesNoPlansFilter = null; - if (riskManagementSummaryInformationOptions.contains(RiskManagementSummaryInformationlSearchOptions.NO_RISK_MANAGEMENT_SUMMARY_INFOMRATION)) { - matchesNoPlansFilter = StringUtils.isBlank(listing.getRiskManagementSummaryInformation().getValue()); + Boolean noRiskManagementSummaryInformationFilter = null; + if (riskManagementSummaryInformationOptions.contains(RiskManagementSummaryInformationlSearchOptions.NO_RISK_MANAGEMENT_SUMMARY_INFORMATION)) { + noRiskManagementSummaryInformationFilter = StringUtils.isBlank(riskManagementSummaryInformation); } - boolean matchesRwtFilter = applyOperation(risskManagementSummaryInformationOperator, - matchesHasPlansFilter, matchesNoPlansFilter); - return matchesRwtFilter; + boolean matchesRiskManagementSummaryInformationFilter = applyOperation(riskManagementSummaryInformationOperator, + riskManagementSummaryInformationFilter, noRiskManagementSummaryInformationFilter); + return matchesRiskManagementSummaryInformationFilter; } private boolean matchesHasAnySvapFilter(ListingSearchResult listing, Boolean hasAnySvapFilter) { diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/SearchRequestNormalizer.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/SearchRequestNormalizer.java index 7bf0ae5b4e..58bf855a56 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/SearchRequestNormalizer.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/SearchRequestNormalizer.java @@ -8,6 +8,7 @@ import gov.healthit.chpl.search.domain.ComplianceSearchFilter; import gov.healthit.chpl.search.domain.NonConformitySearchOptions; import gov.healthit.chpl.search.domain.OrderByOption; +import gov.healthit.chpl.search.domain.RiskManagementSummaryInformationlSearchOptions; import gov.healthit.chpl.search.domain.RwtSearchOptions; import gov.healthit.chpl.search.domain.SearchRequest; import gov.healthit.chpl.search.domain.SearchSetOperator; @@ -31,6 +32,8 @@ public void normalize(SearchRequest request) { normalizeRwtOptionsOperator(request); normalizeSvapIds(request); normalizeSvapOperator(request); + normalizeRiskManagementSummaryInformationOptions(request); + normalizeRiskManagementSummaryInformationOptionsOperator(request); normalizeOrderBy(request); } @@ -259,6 +262,44 @@ private void normalizeSvapOperator(SearchRequest request) { } } + private void normalizeRiskManagementSummaryInformationOptions(SearchRequest request) { + if (!CollectionUtils.isEmpty(request.getRiskManagementSummaryInformationOptionsStrings()) + && CollectionUtils.isEmpty(request.getRiskManagementSummaryInformationOptions())) { + try { + request.setRiskManagementSummaryInformationOptions( + request.getRiskManagementSummaryInformationOptionsStrings().stream() + .filter(option -> !StringUtils.isBlank(option)) + .map(option -> convertToRiskManagementSummaryInformationSearchOption(option)) + .filter(option -> option != null) + .collect(Collectors.toSet())); + } catch (Exception ignore) { + } + } + } + + private RiskManagementSummaryInformationlSearchOptions convertToRiskManagementSummaryInformationSearchOption(String option) { + if (StringUtils.isBlank(option)) { + return null; + } + RiskManagementSummaryInformationlSearchOptions convertedOption = null; + try { + convertedOption = RiskManagementSummaryInformationlSearchOptions.valueOf(option.toUpperCase().trim()); + } catch (Exception ex) { + } + return convertedOption; + } + + private void normalizeRiskManagementSummaryInformationOptionsOperator(SearchRequest request) { + if (!StringUtils.isBlank(request.getRiskManagementSummaryInformationOperatorString()) + && request.getRiskManagementSummaryInformationOperator() == null) { + try { + request.setRiskManagementSummaryInformationOperator( + SearchSetOperator.valueOf(request.getRiskManagementSummaryInformationOperatorString().toUpperCase().trim())); + } catch (Exception ignore) { + } + } + } + private void normalizeOrderBy(SearchRequest request) { if (!StringUtils.isBlank(request.getOrderByString()) && request.getOrderBy() == null) { diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/RiskManagementSummaryInformationlSearchOptions.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/RiskManagementSummaryInformationlSearchOptions.java index c7d61210af..dcef6229d9 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/RiskManagementSummaryInformationlSearchOptions.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/RiskManagementSummaryInformationlSearchOptions.java @@ -2,5 +2,5 @@ public enum RiskManagementSummaryInformationlSearchOptions { HAS_RISK_MANAGEMENT_SUMMARY_INFORMATION, - NO_RISK_MANAGEMENT_SUMMARY_INFOMRATION; + NO_RISK_MANAGEMENT_SUMMARY_INFORMATION; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/SearchRequest.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/SearchRequest.java index 6b20bbe570..ba4ef507f3 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/SearchRequest.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/SearchRequest.java @@ -91,8 +91,8 @@ public class SearchRequest implements Serializable { @Builder.Default private Set riskManagementSummaryInformationOptions = new HashSet(); @JsonIgnore - private String riskManagementUrlOperatorString; - private SearchSetOperator riskManagementUrlOperator; + private String riskManagementSummaryInformationOperatorString; + private SearchSetOperator riskManagementSummaryInformationOperator; @JsonIgnore