diff --git a/src/main/java/gov/cms/madie/services/MeasureMapper.java b/src/main/java/gov/cms/madie/services/MeasureMapper.java index 319edcb..86b00d0 100644 --- a/src/main/java/gov/cms/madie/services/MeasureMapper.java +++ b/src/main/java/gov/cms/madie/services/MeasureMapper.java @@ -90,7 +90,7 @@ public interface MeasureMapper { @Mapping(target = "aggregation", source = "rateAggregation") @Mapping(target = "rationale", source = "measure.measureMetaData.rationale") @Mapping(target = "recommendations", source = "measure.measureMetaData.clinicalRecommendation") - @Mapping(target = "improvementNotations", source = "measure.improvementNotation") + @Mapping(target = "improvementNotations", expression = "java(getImprovementNotations(measure))") @Mapping(target = "references", source = "measure.measureMetaData.references") @Mapping(target = "definitions", source = "measure.measureMetaData.definition") @Mapping(target = "guidance", source = "measure.measureMetaData.guidance") @@ -143,6 +143,13 @@ public interface MeasureMapper { @Mapping(target = "uuid", source = "measureSetId") QualityMeasureSetType measureToQualityMeasureSet(QdmMeasure measure); + default String getImprovementNotations(QdmMeasure measure) { + if ("Other".equals(measure.getImprovementNotation())) { + return measure.getImprovementNotationOther(); + } + return measure.getImprovementNotation(); + } + // measureGrouping mappings default MeasureGroupingType measureToMeasureGroupingType( QdmMeasure measure, CqlLookups cqlLookups) { diff --git a/src/test/java/gov/cms/madie/services/MeasureMapperTest.java b/src/test/java/gov/cms/madie/services/MeasureMapperTest.java index 4e8142b..cbb5d05 100644 --- a/src/test/java/gov/cms/madie/services/MeasureMapperTest.java +++ b/src/test/java/gov/cms/madie/services/MeasureMapperTest.java @@ -1022,4 +1022,23 @@ void testCqlDefinitionsToFunctionsType() { assertThat(argumentTypes.get(0).getQdmDataType(), is(equalTo(arg1.getQdmDataType()))); assertThat(argumentTypes.get(0).getArgumentName(), is(equalTo(arg1.getArgumentName()))); } + + @Test + void testGetImprovementNotationsForOther() { + String customNotation = "Custom improvement notation"; + QdmMeasure measure = + QdmMeasure.builder() + .improvementNotation("Other") + .improvementNotationOther(customNotation) + .build(); + assertThat(measureMapper.getImprovementNotations(measure), is(equalTo(customNotation))); + } + + @Test + void testGetImprovementNotationsForIncreaseScore() { + String notation = "Increased score indicates improvement"; + QdmMeasure measure = + QdmMeasure.builder().improvementNotation(notation).improvementNotationOther("").build(); + assertThat(measureMapper.getImprovementNotations(measure), is(equalTo(notation))); + } }