From 46a18278a4e7751e5e1204cd1ba9dc7aa3b9c476 Mon Sep 17 00:00:00 2001 From: adongare Date: Fri, 5 Apr 2024 09:57:57 -0400 Subject: [PATCH] MAT-6746 cms id cleanup --- pom.xml | 2 +- .../resources/MeasureBundleController.java | 3 ++- .../services/MeasureBundleService.java | 3 ++- .../services/MeasureTranslatorService.java | 5 +++-- .../services/MeasureTranslatorServiceTest.java | 10 ++++++---- .../SimpleFhirMeasureLib/madie_cv_measure.json | 3 +-- .../measures/SimpleFhirMeasureLib/madie_measure.json | 3 +++ .../SimpleFhirMeasureLib/madie_ratio_measure.json | 6 +++++- 8 files changed, 23 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 2fe96e81..f8fa7f6f 100644 --- a/pom.xml +++ b/pom.xml @@ -141,7 +141,7 @@ gov.cms.madie madie-java-models - 0.6.8 + 0.6.30-SNAPSHOT com.jayway.jsonpath diff --git a/src/main/java/gov/cms/madie/madiefhirservice/resources/MeasureBundleController.java b/src/main/java/gov/cms/madie/madiefhirservice/resources/MeasureBundleController.java index 305b246f..81551233 100644 --- a/src/main/java/gov/cms/madie/madiefhirservice/resources/MeasureBundleController.java +++ b/src/main/java/gov/cms/madie/madiefhirservice/resources/MeasureBundleController.java @@ -60,7 +60,8 @@ public ResponseEntity getMeasureBundle( .contentType(MediaType.APPLICATION_JSON) .body(fhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(bundle)); } catch (Exception ex) { - log.error("An error occurred while creating measure bundle for measure [{}]", measure.getId(), ex); + log.error( + "An error occurred while creating measure bundle for measure [{}]", measure.getId(), ex); throw ex; } } diff --git a/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureBundleService.java b/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureBundleService.java index d38a07ef..c4463a0f 100644 --- a/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureBundleService.java +++ b/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureBundleService.java @@ -53,7 +53,8 @@ public Bundle createMeasureBundle( measureTranslatorService.createFhirMeasureForMadieMeasure(madieMeasure); Set expressions = getExpressions(measure); - log.info("Mapping of MADiE measure to FHIR measure completed successfully {}", madieMeasure.getId()); + log.info( + "Mapping of MADiE measure to FHIR measure completed successfully {}", madieMeasure.getId()); // Bundle entry for Measure resource Bundle.BundleEntryComponent measureEntryComponent = FhirResourceHelpers.getBundleEntryComponent(measure, "Transaction"); diff --git a/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java b/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java index 086423aa..a989eb3e 100644 --- a/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java +++ b/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java @@ -159,12 +159,13 @@ public List buildMeasureIdentifiers(Measure madieMeasure) { buildDisplayReference( madieMeasure.getMeasureMetaData().getEndorsements().get(0).getEndorser()))); } - if (StringUtils.isNotBlank(madieMeasure.getCmsId())) { + MeasureSet measureSet = madieMeasure.getMeasureSet(); + if (measureSet != null && measureSet.getCmsId() != null) { identifiers.add( buildIdentifier( IdentifierUse.OFFICIAL, UriConstants.MadieMeasure.CMS_ID, - madieMeasure.getCmsId(), + madieMeasure.getMeasureSet().getCmsId() + "FHIR", ValueConstants.CODE_PUBLISHER) .setAssigner(buildDisplayReference("CMS"))); } diff --git a/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java b/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java index b20f4e9d..ddb82197 100644 --- a/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java +++ b/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java @@ -28,6 +28,7 @@ import gov.cms.madie.models.measure.Measure; import gov.cms.madie.models.measure.MeasureMetaData; import gov.cms.madie.models.measure.MeasureScoring; +import gov.cms.madie.models.measure.MeasureSet; import gov.cms.madie.models.measure.Population; import gov.cms.madie.models.measure.PopulationType; import gov.cms.madie.models.measure.Stratification; @@ -733,7 +734,7 @@ public void testBuildMeasureIdentifiersReturnsIdentifiersForMeasure() { .versionId("UUID_1") .measureSetId("MEASURE_SET_ID_99") .ecqmTitle("ECQM_TITLE") - .cmsId("REAL_CMS_ID") + .measureSet(MeasureSet.builder().measureSetId("MEASURE_SET_ID_99").cmsId(986).build()) .measureMetaData( MeasureMetaData.builder() .endorsements( @@ -793,7 +794,7 @@ public void testBuildMeasureIdentifiersReturnsIdentifiersForMeasure() { assertThat(output.get(4), is(notNullValue())); assertThat(output.get(4).getUse(), is(equalTo(Identifier.IdentifierUse.OFFICIAL))); assertThat(output.get(4).getSystem(), is(equalTo(UriConstants.MadieMeasure.CMS_ID))); - assertThat(output.get(4).getValue(), is(equalTo("REAL_CMS_ID"))); + assertThat(output.get(4).getValue(), is(equalTo("986FHIR"))); assertThat(output.get(4).getType(), is(notNullValue())); assertThat( output.get(4).getType().getCodingFirstRep().getSystem(), @@ -811,7 +812,7 @@ public void testBuildMeasureIdentifiersReturnsIdentifiersWithCmsIdWithoutCbeForM .versionId("UUID_1") .measureSetId("MEASURE_SET_ID_99") .ecqmTitle("ECQM_TITLE") - .cmsId("REAL_CMS_ID") + .measureSet(MeasureSet.builder().cmsId(22).measureSetId("MEASURE_SET_ID_99").build()) .build(); List output = measureTranslatorService.buildMeasureIdentifiers(madieMeasure); assertThat(output, is(notNullValue())); @@ -827,7 +828,7 @@ public void testBuildMeasureIdentifiersReturnsIdentifiersWithCmsIdWithoutCbeForM assertThat(output.get(2).getValue(), is(equalTo(URN_UUID_PREFIX + "UUID_1"))); // CMS ID assertThat(output.get(3), is(notNullValue())); - assertThat(output.get(3).getValue(), is(equalTo("REAL_CMS_ID"))); + assertThat(output.get(3).getValue(), is(equalTo("22FHIR"))); } @Test @@ -844,6 +845,7 @@ public void testBuildMeasureIdentifiersReturnsIdentifiersWithoutCmsIdWithCbeForM List.of( Endorsement.builder().endorsementId("CBE1234").endorser("CBE").build())) .build()) + .measureSet(MeasureSet.builder().measureSetId("MEASURE_SET_ID_99").build()) .build(); List output = measureTranslatorService.buildMeasureIdentifiers(madieMeasure); assertThat(output, is(notNullValue())); diff --git a/src/test/resources/measures/SimpleFhirMeasureLib/madie_cv_measure.json b/src/test/resources/measures/SimpleFhirMeasureLib/madie_cv_measure.json index 6affeeb3..e2c39f7f 100644 --- a/src/test/resources/measures/SimpleFhirMeasureLib/madie_cv_measure.json +++ b/src/test/resources/measures/SimpleFhirMeasureLib/madie_cv_measure.json @@ -73,6 +73,5 @@ "guidance":"test guidance", "clinicalRecommendation": "testClinical" }, - "versionId": "492e7385-7d16-4e33-878b-17d97101a12f", - "cmsId": null + "versionId": "492e7385-7d16-4e33-878b-17d97101a12f" } diff --git a/src/test/resources/measures/SimpleFhirMeasureLib/madie_measure.json b/src/test/resources/measures/SimpleFhirMeasureLib/madie_measure.json index b81a91a8..33646196 100644 --- a/src/test/resources/measures/SimpleFhirMeasureLib/madie_measure.json +++ b/src/test/resources/measures/SimpleFhirMeasureLib/madie_measure.json @@ -283,5 +283,8 @@ "reviewMetaData" : { "approvalDate" : "2023-01-13T16:21:27.014+0000", "lastReviewDate" : "2023-02-13T16:21:27.014+0000" + }, + "measureSet": { + "measureSetId": "testMeasureSetId" } } diff --git a/src/test/resources/measures/SimpleFhirMeasureLib/madie_ratio_measure.json b/src/test/resources/measures/SimpleFhirMeasureLib/madie_ratio_measure.json index 8df95472..1e78fc54 100644 --- a/src/test/resources/measures/SimpleFhirMeasureLib/madie_ratio_measure.json +++ b/src/test/resources/measures/SimpleFhirMeasureLib/madie_ratio_measure.json @@ -3,6 +3,7 @@ "version":{"major":1, "minor":2, "revisionNumber":3}, "cqlLibraryName": "SimpleFhirMeasureLib", "measureName": "SimpleFhirMeasure", + "measureSetId": "1-1-1-1", "cql": "library SimpleFhirMeasureLib version '0.0.004'\n\nusing FHIR version '4.0.1'\n\ninclude FHIRHelpers version '4.0.001' called FHIRHelpers\n\nparameter \"Measurement Period\" Interval\n\ncontext Patient\n\ndefine \"ipp\":\n exists [\"Encounter\"] E where E.period.start during \"Measurement Period\"\n\ndefine \"denom\":\n \"ipp\"\n\ndefine \"num\":\n exists [\"Encounter\"] E where E.status ~ 'finished'", "elmJson": "{\"library\":{\"identifier\":{\"id\":\"SimpleFhirMeasureLib\",\"version\":\"0.0.004\"},\"schemaIdentifier\":{\"id\":\"urn:hl7-org:elm\",\"version\":\"r1\"},\"usings\":{\"def\":[{\"localIdentifier\":\"System\",\"uri\":\"urn:hl7-org:elm-types:r1\"},{\"localId\":\"1\",\"locator\":\"3:1-3:26\",\"localIdentifier\":\"FHIR\",\"uri\":\"http://hl7.org/fhir\",\"version\":\"4.0.1\",\"annotation\":[{\"type\":\"Annotation\",\"s\":{\"r\":\"1\",\"s\":[{\"value\":[\"\",\"using \"]},{\"s\":[{\"value\":[\"FHIR\"]}]},{\"value\":[\" version \",\"'4.0.1'\"]}]}}]}]},\"includes\":{\"def\":[{\"localId\":\"2\",\"locator\":\"5:1-5:56\",\"localIdentifier\":\"FHIRHelpers\",\"path\":\"FHIRHelpers\",\"version\":\"4.0.001\",\"annotation\":[{\"type\":\"Annotation\",\"s\":{\"r\":\"2\",\"s\":[{\"value\":[\"\",\"include \"]},{\"s\":[{\"value\":[\"FHIRHelpers\"]}]},{\"value\":[\" version \",\"'4.0.001'\",\" called \",\"FHIRHelpers\"]}]}}]}]},\"parameters\":{\"def\":[{\"localId\":\"5\",\"locator\":\"7:1-7:49\",\"name\":\"Measurement Period\",\"accessLevel\":\"Public\",\"annotation\":[{\"type\":\"Annotation\",\"s\":{\"r\":\"5\",\"s\":[{\"value\":[\"\",\"parameter \",\"\\\"Measurement Period\\\"\",\" \"]},{\"r\":\"4\",\"s\":[{\"value\":[\"Interval<\"]},{\"r\":\"3\",\"s\":[{\"value\":[\"DateTime\"]}]},{\"value\":[\">\"]}]}]}}],\"parameterTypeSpecifier\":{\"localId\":\"4\",\"locator\":\"7:32-7:49\",\"type\":\"IntervalTypeSpecifier\",\"pointType\":{\"localId\":\"3\",\"locator\":\"7:41-7:48\",\"name\":\"{urn:hl7-org:elm-types:r1}DateTime\",\"type\":\"NamedTypeSpecifier\"}}}]},\"contexts\":{\"def\":[{\"locator\":\"9:1-9:15\",\"name\":\"Patient\"}]},\"statements\":{\"def\":[{\"locator\":\"9:1-9:15\",\"name\":\"Patient\",\"context\":\"Patient\",\"expression\":{\"type\":\"SingletonFrom\",\"operand\":{\"locator\":\"9:1-9:15\",\"dataType\":\"{http://hl7.org/fhir}Patient\",\"templateId\":\"http://hl7.org/fhir/StructureDefinition/Patient\",\"type\":\"Retrieve\"}}},{\"localId\":\"15\",\"locator\":\"11:1-12:73\",\"name\":\"ipp\",\"context\":\"Patient\",\"accessLevel\":\"Public\",\"annotation\":[{\"type\":\"Annotation\",\"s\":{\"r\":\"15\",\"s\":[{\"value\":[\"\",\"define \",\"\\\"ipp\\\"\",\":\\n \"]},{\"r\":\"14\",\"s\":[{\"value\":[\"exists \"]},{\"r\":\"13\",\"s\":[{\"s\":[{\"r\":\"7\",\"s\":[{\"r\":\"6\",\"s\":[{\"r\":\"6\",\"s\":[{\"value\":[\"[\",\"\\\"Encounter\\\"\",\"]\"]}]}]},{\"value\":[\" \",\"E\"]}]}]},{\"value\":[\" \"]},{\"r\":\"12\",\"s\":[{\"value\":[\"where \"]},{\"r\":\"12\",\"s\":[{\"r\":\"10\",\"s\":[{\"r\":\"9\",\"s\":[{\"r\":\"8\",\"s\":[{\"value\":[\"E\"]}]},{\"value\":[\".\"]},{\"r\":\"9\",\"s\":[{\"value\":[\"period\"]}]}]},{\"value\":[\".\"]},{\"r\":\"10\",\"s\":[{\"value\":[\"start\"]}]}]},{\"r\":\"12\",\"value\":[\" \",\"during\",\" \"]},{\"r\":\"11\",\"s\":[{\"value\":[\"\\\"Measurement Period\\\"\"]}]}]}]}]}]}]}}],\"expression\":{\"localId\":\"14\",\"locator\":\"12:3-12:73\",\"type\":\"Exists\",\"operand\":{\"localId\":\"13\",\"locator\":\"12:10-12:73\",\"type\":\"Query\",\"source\":[{\"localId\":\"7\",\"locator\":\"12:10-12:24\",\"alias\":\"E\",\"expression\":{\"localId\":\"6\",\"locator\":\"12:10-12:22\",\"dataType\":\"{http://hl7.org/fhir}Encounter\",\"templateId\":\"http://hl7.org/fhir/StructureDefinition/Encounter\",\"type\":\"Retrieve\"}}],\"relationship\":[],\"where\":{\"localId\":\"12\",\"locator\":\"12:26-12:73\",\"type\":\"In\",\"operand\":[{\"name\":\"ToDateTime\",\"libraryName\":\"FHIRHelpers\",\"type\":\"FunctionRef\",\"operand\":[{\"localId\":\"10\",\"locator\":\"12:32-12:45\",\"path\":\"start\",\"type\":\"Property\",\"source\":{\"localId\":\"9\",\"locator\":\"12:32-12:39\",\"path\":\"period\",\"scope\":\"E\",\"type\":\"Property\"}}]},{\"localId\":\"11\",\"locator\":\"12:54-12:73\",\"name\":\"Measurement Period\",\"type\":\"ParameterRef\"}]}}}},{\"localId\":\"17\",\"locator\":\"14:1-15:7\",\"name\":\"denom\",\"context\":\"Patient\",\"accessLevel\":\"Public\",\"annotation\":[{\"type\":\"Annotation\",\"s\":{\"r\":\"17\",\"s\":[{\"value\":[\"\",\"define \",\"\\\"denom\\\"\",\":\\n \"]},{\"r\":\"16\",\"s\":[{\"value\":[\"\\\"ipp\\\"\"]}]}]}}],\"expression\":{\"localId\":\"16\",\"locator\":\"15:3-15:7\",\"name\":\"ipp\",\"type\":\"ExpressionRef\"}},{\"localId\":\"26\",\"locator\":\"17:1-18:52\",\"name\":\"num\",\"context\":\"Patient\",\"accessLevel\":\"Public\",\"annotation\":[{\"type\":\"Annotation\",\"s\":{\"r\":\"26\",\"s\":[{\"value\":[\"\",\"define \",\"\\\"num\\\"\",\":\\n \"]},{\"r\":\"25\",\"s\":[{\"value\":[\"exists \"]},{\"r\":\"24\",\"s\":[{\"s\":[{\"r\":\"19\",\"s\":[{\"r\":\"18\",\"s\":[{\"r\":\"18\",\"s\":[{\"value\":[\"[\",\"\\\"Encounter\\\"\",\"]\"]}]}]},{\"value\":[\" \",\"E\"]}]}]},{\"value\":[\" \"]},{\"r\":\"23\",\"s\":[{\"value\":[\"where \"]},{\"r\":\"23\",\"s\":[{\"r\":\"21\",\"s\":[{\"r\":\"20\",\"s\":[{\"value\":[\"E\"]}]},{\"value\":[\".\"]},{\"r\":\"21\",\"s\":[{\"value\":[\"status\"]}]}]},{\"value\":[\" \",\"~\",\" \"]},{\"r\":\"22\",\"s\":[{\"value\":[\"'finished'\"]}]}]}]}]}]}]}}],\"expression\":{\"localId\":\"25\",\"locator\":\"18:3-18:52\",\"type\":\"Exists\",\"operand\":{\"localId\":\"24\",\"locator\":\"18:10-18:52\",\"type\":\"Query\",\"source\":[{\"localId\":\"19\",\"locator\":\"18:10-18:24\",\"alias\":\"E\",\"expression\":{\"localId\":\"18\",\"locator\":\"18:10-18:22\",\"dataType\":\"{http://hl7.org/fhir}Encounter\",\"templateId\":\"http://hl7.org/fhir/StructureDefinition/Encounter\",\"type\":\"Retrieve\"}}],\"relationship\":[],\"where\":{\"localId\":\"23\",\"locator\":\"18:26-18:52\",\"type\":\"Equivalent\",\"operand\":[{\"name\":\"ToString\",\"libraryName\":\"FHIRHelpers\",\"type\":\"FunctionRef\",\"operand\":[{\"localId\":\"21\",\"locator\":\"18:32-18:39\",\"path\":\"status\",\"scope\":\"E\",\"type\":\"Property\"}]},{\"localId\":\"22\",\"locator\":\"18:43-18:52\",\"valueType\":\"{urn:hl7-org:elm-types:r1}String\",\"value\":\"finished\",\"type\":\"Literal\"}]}}}}]}},\"externalErrors\":[]}", "groups": [ @@ -81,5 +82,8 @@ "approvalDate" : "2023-01-13T16:21:27.014+0000", "lastReviewDate" : "2023-02-13T16:21:27.014+0000" }, - "supplementalData": [] + "supplementalData": [], + "measureSet": { + "measureSetId": "1-1-1-1" + } }