Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MeasureDef and GroupDef Refactor #598

Merged
merged 10 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public class GroupDef {
private final List<StratifierDef> stratifiers;
private final List<PopulationDef> populations;
private final MeasureScoring measureScoring;
private final boolean useGroupDefImprovementNotation;
private final boolean isIncreaseImprovementNotation;

private final boolean isGroupImpNotation;
private final CodeDef populationBasis;
private final CodeDef improvementNotation;
private final Map<MeasurePopulationType, List<PopulationDef>> populationIndex;

public GroupDef(
Expand All @@ -23,16 +23,19 @@ public GroupDef(
List<StratifierDef> stratifiers,
List<PopulationDef> populations,
MeasureScoring measureScoring,
boolean isIncreaseImprovementNotation,
boolean useGroupDefImprovementNotation) {
boolean isGroupImprovementNotation,
CodeDef improvementNotation,
CodeDef populationBasis) {
//
this.id = id;
this.code = code;
this.stratifiers = stratifiers;
this.populations = populations;
this.populationIndex = index(populations);
this.measureScoring = measureScoring;
this.isIncreaseImprovementNotation = isIncreaseImprovementNotation;
this.useGroupDefImprovementNotation = useGroupDefImprovementNotation;
this.isGroupImpNotation = isGroupImprovementNotation;
this.improvementNotation = improvementNotation;
this.populationBasis = populationBasis;
}

public String id() {
Expand Down Expand Up @@ -77,10 +80,27 @@ public MeasureScoring measureScoring() {
}

public boolean isIncreaseImprovementNotation() {
return this.isIncreaseImprovementNotation;
if (getImprovementNotation() != null) {
return getImprovementNotation().code().equals("increase");
} else {
// default response if null
return true;
}
}

public boolean isGroupImprovementNotation() {
return this.isGroupImpNotation;
}

public boolean isBooleanBasis() {
return getPopulationBasis().code().equals("boolean");
}

public CodeDef getPopulationBasis() {
return this.populationBasis;
}

public boolean useGroupDefImprovementNotation() {
return this.useGroupDefImprovementNotation;
public CodeDef getImprovementNotation() {
return this.improvementNotation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,13 @@ public class MeasureDef {
private Interval defaultMeasurementPeriod;
private final List<GroupDef> groups;
private final List<SdeDef> sdes;
private final boolean isBooleanBasis;
private final boolean useMeasureImpNotation;

public MeasureDef(
String id,
String url,
String version,
List<GroupDef> groups,
List<SdeDef> sdes,
boolean isBooleanBasis,
boolean useMeasureImprovementNotation) {
public MeasureDef(String id, String url, String version, List<GroupDef> groups, List<SdeDef> sdes) {
this.id = id;
this.url = url;
this.version = version;
this.groups = groups;
this.sdes = sdes;
this.isBooleanBasis = isBooleanBasis;
this.useMeasureImpNotation = useMeasureImprovementNotation;
}

public String id() {
Expand All @@ -54,12 +43,4 @@ public List<SdeDef> sdes() {
public List<GroupDef> groups() {
return this.groups;
}

public boolean isBooleanBasis() {
return this.isBooleanBasis;
}

public boolean useMeasureImpNotation() {
return this.useMeasureImpNotation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ protected void evaluateSubject(
EvaluationResult evaluationResult) {
evaluateSdes(subjectId, measureDef.sdes(), evaluationResult);
for (GroupDef groupDef : measureDef.groups()) {
evaluateGroup(measureDef, groupDef, subjectType, subjectId, populationSize, reportType, evaluationResult);
evaluateGroup(groupDef, subjectType, subjectId, populationSize, reportType, evaluationResult);
}
}

Expand Down Expand Up @@ -405,7 +405,6 @@ protected PopulationDef evaluatePopulationMembership(
}

protected void evaluateProportion(
MeasureDef measureDef,
GroupDef groupDef,
String subjectType,
String subjectId,
Expand Down Expand Up @@ -452,7 +451,7 @@ protected void evaluateProportion(
evaluatePopulationMembership(subjectType, subjectId, numeratorExclusion, evaluationResult);
}
// Apply Exclusions and Exceptions
if (measureDef.isBooleanBasis()) {
if (groupDef.isBooleanBasis()) {
// Remove Subject and Resource Exclusions
if (denominatorExclusion != null) {
denominator.getSubjects().removeAll(denominatorExclusion.getSubjects());
Expand Down Expand Up @@ -503,11 +502,7 @@ protected void evaluateProportion(
}

protected void evaluateContinuousVariable(
MeasureDef measureDef,
GroupDef groupDef,
String subjectType,
String subjectId,
EvaluationResult evaluationResult) {
GroupDef groupDef, String subjectType, String subjectId, EvaluationResult evaluationResult) {
PopulationDef initialPopulation = groupDef.getSingle(INITIALPOPULATION);
PopulationDef measurePopulation = groupDef.getSingle(MEASUREPOPULATION);
PopulationDef measureObservation = groupDef.getSingle(MEASUREOBSERVATION);
Expand All @@ -528,7 +523,7 @@ protected void evaluateContinuousVariable(
subjectType, subjectId, groupDef.getSingle(MEASUREPOPULATIONEXCLUSION), evaluationResult);
}
// Apply Exclusions to Population
if (measureDef.isBooleanBasis()) {
if (groupDef.isBooleanBasis()) {
if (measurePopulationExclusion != null) {
measurePopulation.getSubjects().removeAll(measurePopulationExclusion.getSubjects());
measurePopulation.getResources().removeAll(measurePopulationExclusion.getResources());
Expand All @@ -545,7 +540,7 @@ protected void evaluateContinuousVariable(
resource,
measureObservation.expression(),
measureObservation.getEvaluatedResources(),
measureDef.isBooleanBasis());
groupDef.isBooleanBasis());
measureObservation.addResource(observationResult);
}
}
Expand All @@ -564,7 +559,6 @@ protected void evaluateCohort(
}

protected void evaluateGroup(
MeasureDef measureDef,
GroupDef groupDef,
String subjectType,
String subjectId,
Expand All @@ -577,11 +571,10 @@ protected void evaluateGroup(
switch (scoring) {
case PROPORTION:
case RATIO:
evaluateProportion(
measureDef, groupDef, subjectType, subjectId, populationSize, reportType, evaluationResult);
evaluateProportion(groupDef, subjectType, subjectId, populationSize, reportType, evaluationResult);
break;
case CONTINUOUSVARIABLE:
evaluateContinuousVariable(measureDef, groupDef, subjectType, subjectId, evaluationResult);
evaluateContinuousVariable(groupDef, subjectType, subjectId, evaluationResult);
break;
case COHORT:
evaluateCohort(groupDef, subjectType, subjectId, evaluationResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
public class MeasureConstants {
private MeasureConstants() {}

public static final String CQFM_SCORING_SYSTEM_URL = "http://terminology.hl7.org/ValueSet/measure-scoring";
public static final String CQFM_SCORING_EXT_URL =
"http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring";
// this is used on Measure resources to indicate to $care-gaps and $care-list that the measure is compatible for the
Expand Down Expand Up @@ -39,6 +40,7 @@ private MeasureConstants() {}
"http://hl7.org/fhir/5.0/StructureDefinition/extension-MeasureReport.operationOutcome.reference";
public static final String MEASUREMENT_PERIOD_PARAMETER_NAME = "Measurement Period";
public static final String FHIR_MODEL_URI = "http://hl7.org/fhir";
public static final String FHIR_ALL_TYPES_SYSTEM_URL = "http://hl7.org/fhir/fhir-types";
public static final String POPULATION_BASIS_URL =
"http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis";
public static final String EXT_TOTAL_DENOMINATOR_URL =
Expand Down

This file was deleted.

Loading