From 137725aedef80e85373ef9b2a21adf3dd0f5e808 Mon Sep 17 00:00:00 2001 From: Rohit Kandimalla Date: Fri, 1 Dec 2023 11:52:04 -0500 Subject: [PATCH 1/2] MAT-6502 Adding improvement notation to measure bundle --- .../constants/UriConstants.java | 6 +++++ .../services/MeasureTranslatorService.java | 20 ++++++++++++++ .../MeasureTranslatorServiceTest.java | 27 +++++++++++++++++++ .../SimpleFhirMeasureLib/madie_measure.json | 4 +-- 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/src/main/java/gov/cms/madie/madiefhirservice/constants/UriConstants.java b/src/main/java/gov/cms/madie/madiefhirservice/constants/UriConstants.java index 1b6cf253..ea3bfefa 100644 --- a/src/main/java/gov/cms/madie/madiefhirservice/constants/UriConstants.java +++ b/src/main/java/gov/cms/madie/madiefhirservice/constants/UriConstants.java @@ -57,6 +57,12 @@ public static final class CqfMeasures { public static final String RATE_AGGREGATION_URI = "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-rateAggregation"; + + public static final String IMPROVEMENT_NOTATION_URI = + "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-improvementNotation"; + + public static final String IMPROVEMENT_NOTATION_CODE_SYSTEM_URI = + "http://terminology.hl7.org/CodeSystem/measure-improvement-notation"; } public static final class CqfTestCases { 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 38283d5a..3b4a625c 100644 --- a/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java +++ b/src/main/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorService.java @@ -271,9 +271,29 @@ public MeasureGroupComponent buildGroup(Group madieGroup) { UriConstants.CqfMeasures.RATE_AGGREGATION_URI, new CodeType(madieGroup.getRateAggregation()))); } + if (StringUtils.isNotBlank(madieGroup.getImprovementNotation())) { + element.addExtension( + new Extension( + UriConstants.CqfMeasures.IMPROVEMENT_NOTATION_URI, + buildImprovementNotation(madieGroup.getImprovementNotation()))); + } return (MeasureGroupComponent) element; } + private CodeableConcept buildImprovementNotation(String improvementNotation) { + if ("Increased score indicates improvement".equalsIgnoreCase(improvementNotation)) { + return buildCodeableConcept( + "increase", + UriConstants.CqfMeasures.IMPROVEMENT_NOTATION_CODE_SYSTEM_URI, + improvementNotation); + } else { + return buildCodeableConcept( + "decrease", + UriConstants.CqfMeasures.IMPROVEMENT_NOTATION_CODE_SYSTEM_URI, + improvementNotation); + } + } + private List getMeasureTypes(List measureGroupTypes) { if (CollectionUtils.isEmpty(measureGroupTypes)) { return null; 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 b9ad15d9..ca3244a1 100644 --- a/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java +++ b/src/test/java/gov/cms/madie/madiefhirservice/services/MeasureTranslatorServiceTest.java @@ -171,6 +171,19 @@ public void testCreateFhirMeasureForMadieMeasure() { .getExtensionByUrl(UriConstants.CqfMeasures.RATE_AGGREGATION_URI) .getValue() .primitiveValue()); + + Extension improvementNotationExt = + group1.getExtensionByUrl(UriConstants.CqfMeasures.IMPROVEMENT_NOTATION_URI); + CodeableConcept improvementNotation = + improvementNotationExt.getValue().castToCodeableConcept(improvementNotationExt.getValue()); + assertEquals( + madieMeasure.getGroups().get(0).getImprovementNotation(), + improvementNotation.getCoding().get(0).getDisplay()); + assertEquals("increase", improvementNotation.getCoding().get(0).getCode()); + assertEquals( + UriConstants.CqfMeasures.IMPROVEMENT_NOTATION_CODE_SYSTEM_URI, + improvementNotation.getCoding().get(0).getSystem()); + Extension scoringUnitExt1 = group1.getExtensionByUrl(UriConstants.CqfMeasures.SCORING_UNIT_URI); assertThat(scoringUnitExt1, is(notNullValue())); assertThat(scoringUnitExt1.getValue(), is(notNullValue())); @@ -237,6 +250,20 @@ public void testCreateFhirMeasureForMadieMeasure() { .getValue() .primitiveValue(), is(equalTo("boolean"))); + assertNull(group2.getExtensionByUrl(UriConstants.CqfMeasures.RATE_AGGREGATION_URI)); + Extension improvementNotationExt1 = + group2.getExtensionByUrl(UriConstants.CqfMeasures.IMPROVEMENT_NOTATION_URI); + CodeableConcept improvementNotation1 = + improvementNotationExt1 + .getValue() + .castToCodeableConcept(improvementNotationExt1.getValue()); + assertEquals( + madieMeasure.getGroups().get(1).getImprovementNotation(), + improvementNotation1.getCoding().get(0).getDisplay()); + assertEquals("decrease", improvementNotation1.getCoding().get(0).getCode()); + assertEquals( + UriConstants.CqfMeasures.IMPROVEMENT_NOTATION_CODE_SYSTEM_URI, + improvementNotation1.getCoding().get(0).getSystem()); Extension group2Ex = group2.getExtension().get(0); assertThat(group2Ex.getUrl(), is(equalTo(UriConstants.CqfMeasures.SCORING_URI))); CodeableConcept group2CodeableConcept = group2Ex.castToCodeableConcept(group2Ex.getValue()); diff --git a/src/test/resources/measures/SimpleFhirMeasureLib/madie_measure.json b/src/test/resources/measures/SimpleFhirMeasureLib/madie_measure.json index 26937517..b81a91a8 100644 --- a/src/test/resources/measures/SimpleFhirMeasureLib/madie_measure.json +++ b/src/test/resources/measures/SimpleFhirMeasureLib/madie_measure.json @@ -169,7 +169,7 @@ ], "measureObservations":null, "groupDescription":"test 4495 group 1", - "improvementNotation":"", + "improvementNotation":"Increased score indicates improvement", "rateAggregation":"Rate Aggregation Example", "scoringUnit":{ "label":"kg kilogram", @@ -222,7 +222,7 @@ ], "measureObservations":null, "groupDescription":"group2", - "improvementNotation":"", + "improvementNotation":"Decreased score indicates improvement", "rateAggregation":"", "measureGroupTypes":[ "Outcome" From ede369e0ace7f30d234501951c738be88b8fa95b Mon Sep 17 00:00:00 2001 From: Rohit Kandimalla Date: Tue, 5 Dec 2023 08:40:18 -0500 Subject: [PATCH 2/2] formatting --- src/main/resources/templates/Measure.liquid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/Measure.liquid b/src/main/resources/templates/Measure.liquid index bbc121ed..c010288f 100644 --- a/src/main/resources/templates/Measure.liquid +++ b/src/main/resources/templates/Measure.liquid @@ -1016,4 +1016,4 @@ {% endif %} - \ No newline at end of file +