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

319: Update Measure Refresh to use QM IG 3.0.0 approach #327

Merged
Merged
Changes from all 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 @@ -13,7 +13,9 @@

public class MeasureRefreshProcessor {
public Measure refreshMeasure(Measure measureToUse, LibraryManager libraryManager, TranslatedLibrary translatedLibrary, CqlTranslatorOptions options) {
Library moduleDefinitionLibrary = getModuleDefinitionLibrary(measureToUse, libraryManager, translatedLibrary, options);

Library moduleDefinitionLibrary = getModuleDefinitionLibrary(measureToUse, libraryManager, translatedLibrary, options);

measureToUse.setDate(new Date());
// http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/measure-cqfm
setMeta(measureToUse, moduleDefinitionLibrary);
Expand All @@ -27,11 +29,11 @@ public Measure refreshMeasure(Measure measureToUse, LibraryManager libraryManage
clearMeasureExtensions(measureToUse, "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-dataRequirement");
clearMeasureExtensions(measureToUse, "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode");
clearMeasureExtensions(measureToUse, "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition");
clearMeasureExtensions(measureToUse, "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-effectiveDataRequirements");
clearRelatedArtifacts(measureToUse);
setParameters(measureToUse, moduleDefinitionLibrary);
setDataRequirements(measureToUse, moduleDefinitionLibrary);
setDirectReferenceCode(measureToUse, moduleDefinitionLibrary);
setLogicDefinition(measureToUse, moduleDefinitionLibrary);

setEffectiveDataRequirements(measureToUse, moduleDefinitionLibrary);

measureToUse.setRelatedArtifact(moduleDefinitionLibrary.getRelatedArtifact());

return measureToUse;
Expand Down Expand Up @@ -68,29 +70,29 @@ private void clearRelatedArtifacts(Measure measure) {
measure.getRelatedArtifact().removeIf(r -> r.getType() == RelatedArtifact.RelatedArtifactType.DEPENDSON);
}

private void setLogicDefinition(Measure measureToUse, Library moduleDefinitionLibrary) {
moduleDefinitionLibrary.getExtension().forEach(extension -> {
if (extension.getUrl().equalsIgnoreCase("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition")) {
measureToUse.addExtension(extension);
}
});
}

private void setDirectReferenceCode(Measure measureToUse, Library moduleDefinitionLibrary) {
moduleDefinitionLibrary.getExtension().forEach(extension -> {
if(extension.getUrl().equalsIgnoreCase("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode")) {
measureToUse.addExtension(extension);
}
});
}

private void setDataRequirements(Measure measureToUse, Library moduleDefinitionLibrary) {
moduleDefinitionLibrary.getDataRequirement().forEach(dataRequirement -> {
Extension dataReqExtension = new Extension();
dataReqExtension.setUrl("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-dataRequirement");
dataReqExtension.setValue(dataRequirement);
measureToUse.addExtension(dataReqExtension);
});
private void setEffectiveDataRequirements(Measure measureToUse, Library moduleDefinitionLibrary) {
moduleDefinitionLibrary.setId("effective-data-requirements");
int delIndex = -1;
for (Resource res : measureToUse.getContained()) {
if (res instanceof Library && ((Library)res).getId().equalsIgnoreCase("effective-data-requirements")) {
delIndex = measureToUse.getContained().indexOf(res);
break;
}
}
if (delIndex >= 0) {
measureToUse.getContained().remove(delIndex);
}
measureToUse.getContained().add(moduleDefinitionLibrary);
Extension effDataReqExtension = new Extension();
effDataReqExtension.setUrl("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-effectiveDataRequirements");
effDataReqExtension.setId("effective-data-requirements");
effDataReqExtension.setValue(new Reference().setReference("#effective-data-requirements"));
measureToUse.addExtension(effDataReqExtension);
}

private void setParameters(Measure measureToUse, Library moduleDefinitionLibrary) {
Expand Down Expand Up @@ -120,4 +122,6 @@ private void setMeta(Measure measureToUse, Library moduleDefinitionLibrary){
measureToUse.getMeta().addProfile("http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/computable-measure-cqfm");
}
}


}