diff --git a/src/main/java/gov/cms/madie/madiefhirservice/services/TestCaseBundleService.java b/src/main/java/gov/cms/madie/madiefhirservice/services/TestCaseBundleService.java index 3c9d1c8..fc37c86 100644 --- a/src/main/java/gov/cms/madie/madiefhirservice/services/TestCaseBundleService.java +++ b/src/main/java/gov/cms/madie/madiefhirservice/services/TestCaseBundleService.java @@ -242,29 +242,36 @@ private List buildMeasureReportGroupC .map( population -> { var measureReportGroupComponent = new MeasureReport.MeasureReportGroupComponent(); + measureReportGroupComponent.setId(population.getGroupId()); + // adding populations if (population.getPopulationValues() != null) { var measureReportGroupPopulationComponents = population.getPopulationValues().stream() .map( testCasePopulationValue -> { - String populationCode = testCasePopulationValue.getName().toCode(); - String populationDisplay = - testCasePopulationValue.getName().getDisplay(); - int expectedValue = - FhirResourceHelpers.getExpectedValue( - testCasePopulationValue.getExpected()); - return (new MeasureReport.MeasureReportGroupPopulationComponent()) - .setCode( - FhirResourceHelpers.buildCodeableConcept( - populationCode, - UriConstants.POPULATION_SYSTEM_URI, - populationDisplay)) - .setCount(expectedValue); + var groupComponent = + (new MeasureReport.MeasureReportGroupPopulationComponent()) + .setCode( + FhirResourceHelpers.buildCodeableConcept( + testCasePopulationValue.getName().toCode(), + UriConstants.POPULATION_SYSTEM_URI, + testCasePopulationValue.getName().getDisplay())) + .setCount( + FhirResourceHelpers.getExpectedValue( + testCasePopulationValue.getExpected())); + groupComponent.setId(testCasePopulationValue.getId()); + return groupComponent; }) .collect(Collectors.toList()); measureReportGroupComponent.setPopulation(measureReportGroupPopulationComponents); } - + // adding measure score + measureReportGroupComponent.setMeasureScore( + new Quantity() + .setValue( + StringUtils.equalsIgnoreCase("boolean", population.getPopulationBasis()) + ? 1.0 + : 0)); // adding stratification for patient basis if (population.getStratificationValues() != null) { if (StringUtils.equalsIgnoreCase("boolean", population.getPopulationBasis())) { diff --git a/src/main/java/gov/cms/madie/madiefhirservice/utils/FhirResourceHelpers.java b/src/main/java/gov/cms/madie/madiefhirservice/utils/FhirResourceHelpers.java index 92a52d8..5f939b3 100644 --- a/src/main/java/gov/cms/madie/madiefhirservice/utils/FhirResourceHelpers.java +++ b/src/main/java/gov/cms/madie/madiefhirservice/utils/FhirResourceHelpers.java @@ -95,13 +95,13 @@ public static List buildStratu MeasureReport.StratifierGroupPopulationComponent stratifierGroupPopulationComponent = new MeasureReport.StratifierGroupPopulationComponent(); - String populationCode = populationValue.getName().toCode(); - String populationDisplay = populationValue.getName().getDisplay(); stratifierGroupPopulationComponent.setId(populationValue.getId()); stratifierGroupPopulationComponent.setCode( buildCodeableConcept( - populationCode, UriConstants.POPULATION_SYSTEM_URI, populationDisplay)); + populationValue.getName().toCode(), + UriConstants.POPULATION_SYSTEM_URI, + populationValue.getName().getDisplay())); stratifierGroupPopulationComponent.setCount( isPatientBased