Skip to content

Commit

Permalink
code review edits
Browse files Browse the repository at this point in the history
  • Loading branch information
Capt-Mac committed Nov 12, 2024
1 parent 59d1f2c commit 63e2fd3
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -205,7 +207,7 @@ public boolean isGroupIncreaseImprovementNotation(Measure measure, MeasureGroupC
return isIncreaseImpNotation;
}

public boolean useMeasureImprovementNotation(List<GroupDef> groups) {
private boolean useMeasureImprovementNotation(List<GroupDef> groups) {
// if no groups are present then useMeasure
if (groups == null || groups.isEmpty()) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static Set<MeasurePopulationType> getPopulations() {
return data.stream().map(PROPORTION_ALLOWED::getPopulationType).collect(Collectors.toSet());
}

public static void isMember(List<MeasurePopulationType> populations) {
public static void validateMember(List<MeasurePopulationType> populations) {
var populationSet = getPopulations();
for (MeasurePopulationType popType : populations) {
if (!populationSet.contains(popType)) {
Expand Down Expand Up @@ -66,7 +66,7 @@ public static Set<MeasurePopulationType> getPopulations() {
return data.stream().map(PROPORTION_REQUIRED::getPopulationType).collect(Collectors.toSet());
}

public static void hasRequired(List<MeasurePopulationType> populations) {
public static void validateRequired(List<MeasurePopulationType> populations) {
for (MeasurePopulationType requiredPop : getPopulations()) {
if (!populations.contains(requiredPop)) {
throw new UnsupportedOperationException(String.format(
Expand Down Expand Up @@ -100,7 +100,7 @@ public static Set<MeasurePopulationType> getPopulations() {
return data.stream().map(RATIO_ALLOWED::getPopulationType).collect(Collectors.toSet());
}

public static void isMember(List<MeasurePopulationType> populations) {
public static void validateMember(List<MeasurePopulationType> populations) {
var populationSet = getPopulations();
for (MeasurePopulationType popType : populations) {
if (!populationSet.contains(popType)) {
Expand Down Expand Up @@ -131,7 +131,7 @@ public static Set<MeasurePopulationType> getPopulations() {
return data.stream().map(RATIO_REQUIRED::getPopulationType).collect(Collectors.toSet());
}

public static void hasRequired(List<MeasurePopulationType> populations) {
public static void validateRequired(List<MeasurePopulationType> populations) {
for (MeasurePopulationType requiredPop : getPopulations()) {
if (!populations.contains(requiredPop)) {
throw new UnsupportedOperationException(
Expand Down Expand Up @@ -166,7 +166,7 @@ public static Set<MeasurePopulationType> getPopulations() {
.collect(Collectors.toSet());
}

public static void isMember(List<MeasurePopulationType> populations) {
public static void validateMember(List<MeasurePopulationType> populations) {
var populationSet = getPopulations();
for (MeasurePopulationType popType : populations) {
if (!populationSet.contains(popType)) {
Expand Down Expand Up @@ -199,7 +199,7 @@ public static Set<MeasurePopulationType> getPopulations() {
.collect(Collectors.toSet());
}

public static void hasRequired(List<MeasurePopulationType> populations) {
public static void validateRequired(List<MeasurePopulationType> populations) {
for (MeasurePopulationType requiredPop : getPopulations()) {
if (!populations.contains(requiredPop)) {
throw new UnsupportedOperationException(String.format(
Expand Down Expand Up @@ -228,7 +228,7 @@ public static Set<MeasurePopulationType> getPopulations() {
return data.stream().map(COHORT_ALLOWED::getPopulationType).collect(Collectors.toSet());
}

public static void isMember(List<MeasurePopulationType> populations) {
public static void validateMember(List<MeasurePopulationType> populations) {
var populationSet = getPopulations();
for (MeasurePopulationType popType : populations) {
if (!populationSet.contains(popType)) {
Expand Down Expand Up @@ -257,7 +257,7 @@ public static Set<MeasurePopulationType> getPopulations() {
return data.stream().map(COHORT_REQUIRED::getPopulationType).collect(Collectors.toSet());
}

public static void hasRequired(List<MeasurePopulationType> populations) {
public static void validateRequired(List<MeasurePopulationType> populations) {
for (MeasurePopulationType requiredPop : getPopulations()) {
if (!populations.contains(requiredPop)) {
throw new UnsupportedOperationException(String.format(
Expand All @@ -276,20 +276,20 @@ public static void validateScoringTypePopulations(
List<MeasurePopulationType> 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ private List<String> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 63e2fd3

Please sign in to comment.