diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/common/MeasureEvaluator.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/common/MeasureEvaluator.java index e6f55f9b0..c28e2aa52 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/common/MeasureEvaluator.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/common/MeasureEvaluator.java @@ -415,7 +415,7 @@ protected void evaluateProportion( // check populations R4MeasureScoringTypePopulations.validateScoringTypePopulations( groupDef.populations().stream().map(PopulationDef::type).collect(Collectors.toList()), - MeasureScoring.fromCode(groupDef.measureScoring().toCode())); + groupDef.measureScoring()); PopulationDef initialPopulation = groupDef.getSingle(INITIALPOPULATION); PopulationDef numerator = groupDef.getSingle(NUMERATOR); diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/dstu3/Dstu3MeasureDefBuilder.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/dstu3/Dstu3MeasureDefBuilder.java index ab9824543..39c0271b7 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/dstu3/Dstu3MeasureDefBuilder.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/dstu3/Dstu3MeasureDefBuilder.java @@ -183,16 +183,18 @@ private void validateImprovementNotationCode(String improvementNotationValue) { } public String getGroupImprovementNotationExt(Measure.MeasureGroupComponent group) { - StringType value = (StringType) group.getExtensionByUrl(MEASUREREPORT_IMPROVEMENT_NOTATION_EXTENSION) + var ext = group.getExtensionByUrl(MEASUREREPORT_IMPROVEMENT_NOTATION_EXTENSION) .getValue(); + assert ext instanceof StringType; + StringType value = (StringType) ext; return value.getValue(); } - public boolean groupHasImprovementNotationExt(MeasureGroupComponent group) { + private boolean groupHasImprovementNotationExt(MeasureGroupComponent group) { return group.getExtensionByUrl(MEASUREREPORT_IMPROVEMENT_NOTATION_EXTENSION) != null; } - public boolean isGroupIncreaseImprovementNotation(Measure measure, MeasureGroupComponent group) { + private boolean isGroupIncreaseImprovementNotation(Measure measure, MeasureGroupComponent group) { // default improvement Notation boolean isIncreaseImpNotation = true; boolean useGroupImpNotation = groupHasImprovementNotationExt(group); @@ -205,7 +207,7 @@ public boolean isGroupIncreaseImprovementNotation(Measure measure, MeasureGroupC return isIncreaseImpNotation; } - public boolean useMeasureImprovementNotation(List groups) { + private boolean useMeasureImprovementNotation(List groups) { // if no groups are present then useMeasure if (groups == null || groups.isEmpty()) { return true; diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/r4/R4MeasureDefBuilder.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/r4/R4MeasureDefBuilder.java index 9ffb7ef02..bb80a0712 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/r4/R4MeasureDefBuilder.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/r4/R4MeasureDefBuilder.java @@ -262,16 +262,18 @@ private void validateImprovementNotationCode(CodeableConcept improvementNotation } } - public CodeableConcept getGroupImprovementNotationExt(MeasureGroupComponent group) { - return (CodeableConcept) group.getExtensionByUrl(MEASUREREPORT_IMPROVEMENT_NOTATION_EXTENSION) + private CodeableConcept getGroupImprovementNotationExt(MeasureGroupComponent group) { + var ext = group.getExtensionByUrl(MEASUREREPORT_IMPROVEMENT_NOTATION_EXTENSION) .getValue(); + assert ext instanceof CodeableConcept; + return (CodeableConcept) ext; } - public boolean groupHasImprovementNotationExt(MeasureGroupComponent group) { + private boolean groupHasImprovementNotationExt(MeasureGroupComponent group) { return group.getExtensionByUrl(MEASUREREPORT_IMPROVEMENT_NOTATION_EXTENSION) != null; } - public boolean isGroupIncreaseImprovementNotation(Measure measure, MeasureGroupComponent group) { + private boolean isGroupIncreaseImprovementNotation(Measure measure, MeasureGroupComponent group) { // default improvement Notation boolean isIncreaseImpNotation = true; boolean useGroupImpNotation = groupHasImprovementNotationExt(group); diff --git a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/r4/R4MeasureScoringTypePopulations.java b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/r4/R4MeasureScoringTypePopulations.java index dd83d01f4..ebc170bb0 100644 --- a/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/r4/R4MeasureScoringTypePopulations.java +++ b/cqf-fhir-cr/src/main/java/org/opencds/cqf/fhir/cr/measure/r4/R4MeasureScoringTypePopulations.java @@ -34,7 +34,7 @@ public static Set getPopulations() { return data.stream().map(PROPORTION_ALLOWED::getPopulationType).collect(Collectors.toSet()); } - public static void isMember(List populations) { + public static void validateMember(List populations) { var populationSet = getPopulations(); for (MeasurePopulationType popType : populations) { if (!populationSet.contains(popType)) { @@ -66,7 +66,7 @@ public static Set getPopulations() { return data.stream().map(PROPORTION_REQUIRED::getPopulationType).collect(Collectors.toSet()); } - public static void hasRequired(List populations) { + public static void validateRequired(List populations) { for (MeasurePopulationType requiredPop : getPopulations()) { if (!populations.contains(requiredPop)) { throw new UnsupportedOperationException(String.format( @@ -100,7 +100,7 @@ public static Set getPopulations() { return data.stream().map(RATIO_ALLOWED::getPopulationType).collect(Collectors.toSet()); } - public static void isMember(List populations) { + public static void validateMember(List populations) { var populationSet = getPopulations(); for (MeasurePopulationType popType : populations) { if (!populationSet.contains(popType)) { @@ -131,7 +131,7 @@ public static Set getPopulations() { return data.stream().map(RATIO_REQUIRED::getPopulationType).collect(Collectors.toSet()); } - public static void hasRequired(List populations) { + public static void validateRequired(List populations) { for (MeasurePopulationType requiredPop : getPopulations()) { if (!populations.contains(requiredPop)) { throw new UnsupportedOperationException( @@ -166,7 +166,7 @@ public static Set getPopulations() { .collect(Collectors.toSet()); } - public static void isMember(List populations) { + public static void validateMember(List populations) { var populationSet = getPopulations(); for (MeasurePopulationType popType : populations) { if (!populationSet.contains(popType)) { @@ -199,7 +199,7 @@ public static Set getPopulations() { .collect(Collectors.toSet()); } - public static void hasRequired(List populations) { + public static void validateRequired(List populations) { for (MeasurePopulationType requiredPop : getPopulations()) { if (!populations.contains(requiredPop)) { throw new UnsupportedOperationException(String.format( @@ -228,7 +228,7 @@ public static Set getPopulations() { return data.stream().map(COHORT_ALLOWED::getPopulationType).collect(Collectors.toSet()); } - public static void isMember(List populations) { + public static void validateMember(List populations) { var populationSet = getPopulations(); for (MeasurePopulationType popType : populations) { if (!populationSet.contains(popType)) { @@ -257,7 +257,7 @@ public static Set getPopulations() { return data.stream().map(COHORT_REQUIRED::getPopulationType).collect(Collectors.toSet()); } - public static void hasRequired(List populations) { + public static void validateRequired(List populations) { for (MeasurePopulationType requiredPop : getPopulations()) { if (!populations.contains(requiredPop)) { throw new UnsupportedOperationException(String.format( @@ -276,20 +276,20 @@ public static void validateScoringTypePopulations( List populations, MeasureScoring measureScoring) { switch (measureScoring) { case RATIO: - RATIO_ALLOWED.isMember(populations); - RATIO_REQUIRED.hasRequired(populations); + RATIO_ALLOWED.validateMember(populations); + RATIO_REQUIRED.validateRequired(populations); break; case PROPORTION: - PROPORTION_ALLOWED.isMember(populations); - PROPORTION_REQUIRED.hasRequired(populations); + PROPORTION_ALLOWED.validateMember(populations); + PROPORTION_REQUIRED.validateRequired(populations); break; case COHORT: - COHORT_ALLOWED.isMember(populations); - COHORT_REQUIRED.hasRequired(populations); + COHORT_ALLOWED.validateMember(populations); + COHORT_REQUIRED.validateRequired(populations); break; case CONTINUOUSVARIABLE: - CONTINUOUS_VARIABLE_ALLOWED.isMember(populations); - CONTINUOUS_VARIABLE_REQUIRED.hasRequired(populations); + CONTINUOUS_VARIABLE_ALLOWED.validateMember(populations); + CONTINUOUS_VARIABLE_REQUIRED.validateRequired(populations); break; default: throw new UnsupportedOperationException( diff --git a/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/Measure.java b/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/Measure.java index e11cf1c6d..b9235d7e9 100644 --- a/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/Measure.java +++ b/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/Measure.java @@ -552,7 +552,7 @@ private List getContainedIdsPerResourceType(ResourceType theResourceType */ public SelectedReport subjectResultsHaveResourceType(String resourceType) { var lists = value().getContained().stream() - .filter(t -> t.getResourceType().equals(ResourceType.List)) + .filter(t -> t instanceof ListResource) .map(x -> (ListResource) x) .collect(Collectors.toList()); for (ListResource list : lists) { diff --git a/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/MeasureReportTypeIndividualTest.java b/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/MeasureReportTypeIndividualTest.java index e31ae4cc7..d8b7ba2f4 100644 --- a/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/MeasureReportTypeIndividualTest.java +++ b/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/MeasureReportTypeIndividualTest.java @@ -22,8 +22,6 @@ * has measure url * has correct status * has period - * errors when missing required population - * errors when using not allowed population */ public class MeasureReportTypeIndividualTest { private static final String CLASS_PATH = "org/opencds/cqf/fhir/cr/measure/r4"; diff --git a/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/MeasureReportTypeSummaryTest.java b/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/MeasureReportTypeSummaryTest.java index ed9a79579..3114a2f0a 100644 --- a/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/MeasureReportTypeSummaryTest.java +++ b/cqf-fhir-cr/src/test/java/org/opencds/cqf/fhir/cr/measure/r4/MeasureReportTypeSummaryTest.java @@ -22,8 +22,6 @@ * has measure url * has correct status * has period - * errors when missing required population - * errors when using not allowed population */ public class MeasureReportTypeSummaryTest { private static final String CLASS_PATH = "org/opencds/cqf/fhir/cr/measure/r4";