use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluatorTest method setupDefineReturnLibrary.
private Library setupDefineReturnLibrary() throws Exception {
Library fhirHelpers = mockLibraryRetrieval("FHIRHelpers", "4.0.0", "cql/fhir-helpers/FHIRHelpers.cql");
Library library2 = mockLibraryRetrieval("TestAdultMales2", DEFAULT_VERSION, "cql/fhir-measure/test-adult-males2.cql");
Library library3 = mockLibraryRetrieval("TestAdultMales3", DEFAULT_VERSION, "cql/fhir-measure/test-adult-males3.cql");
Library library = mockLibraryRetrieval("TestAdultMales", DEFAULT_VERSION, "cql/fhir-measure/test-adult-males.cql");
library.addRelatedArtifact(asRelation(fhirHelpers));
library.addRelatedArtifact(asRelation(library2));
library.addRelatedArtifact(asRelation(library3));
return library;
}
use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluatorTest method runCareGapTest.
private void runCareGapTest(Map<String, Parameter> parameters, Map<String, Integer> careGapExpectations) throws ParseException, Exception {
CapabilityStatement metadata = getCapabilityStatement();
mockFhirResourceRetrieval("/metadata?_format=json", metadata);
Patient patient = getPatient("123", AdministrativeGender.MALE, "1970-10-10");
mockFhirResourceRetrieval(patient);
Library library = mockLibraryRetrieval("TestDummyPopulations", DEFAULT_VERSION, "cql/fhir-measure/test-dummy-populations.cql");
Measure measure = getCareGapMeasure("ProportionMeasureName", library, expressionsByPopulationType, "CareGap1", "CareGap2");
mockFhirResourceRetrieval(measure);
MeasureReport report = evaluator.evaluatePatientMeasure(measure.getId(), patient.getId(), parameters);
assertNotNull(report);
assertPopulationExpectations(measure, report, careGapExpectations);
}
use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluatorTest method multilevel_library_dependencies___successfully_loaded_and_evaluated.
@Test
public void multilevel_library_dependencies___successfully_loaded_and_evaluated() throws Exception {
mockFhirResourceRetrieval("/metadata?_format=json", getCapabilityStatement());
Patient patient = getPatient("123", AdministrativeGender.MALE, "1970-10-10");
mockFhirResourceRetrieval(patient);
Library nestedHelperLibrary = mockLibraryRetrieval("NestedChild", DEFAULT_VERSION, "cql/fhir-measure-nested-libraries/test-nested-child.cql");
Library helperLibrary = mockLibraryRetrieval("Child", DEFAULT_VERSION, "cql/fhir-measure-nested-libraries/test-child.cql");
helperLibrary.addRelatedArtifact(asRelation(nestedHelperLibrary));
Library library = mockLibraryRetrieval("Parent", DEFAULT_VERSION, "cql/fhir-measure-nested-libraries/test-parent.cql");
library.addRelatedArtifact(asRelation(helperLibrary));
Measure measure = getCareGapMeasure("NestedLibraryMeasure", library, expressionsByPopulationType, "CareGap1", "CareGap2");
mockFhirResourceRetrieval(measure);
Map<String, Parameter> passingParameters = new HashMap<>();
passingParameters.put("InInitialPopulation", new BooleanParameter(true));
List<MeasureContext> measureContexts = new ArrayList<>();
measureContexts.add(new MeasureContext(measure.getId(), passingParameters));
List<MeasureReport> reports = evaluator.evaluatePatientMeasures(patient.getId(), measureContexts);
assertEquals(1, reports.size());
MeasureReport report = reports.get(0);
verifyStandardPopulationCounts(report);
}
use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluatorTest method in_populations_no_evaluated_resources_returned.
@Test
public void in_populations_no_evaluated_resources_returned() throws Exception {
CapabilityStatement metadata = getCapabilityStatement();
mockFhirResourceRetrieval("/metadata?_format=json", metadata);
Patient patient = getPatient("123", AdministrativeGender.MALE, "1970-10-10");
mockFhirResourceRetrieval(patient);
Library library = setupDefineReturnLibrary();
expressionsByPopulationType.clear();
expressionsByPopulationType.put(MeasurePopulationType.INITIALPOPULATION, INITIAL_POPULATION);
expressionsByPopulationType.put(MeasurePopulationType.DENOMINATOR, DENOMINATOR);
expressionsByPopulationType.put(MeasurePopulationType.NUMERATOR, NUMERATOR);
Measure measure = getProportionMeasure("ProportionMeasureName", library, expressionsByPopulationType);
mockFhirResourceRetrieval(measure);
MeasureReport report = evaluator.evaluatePatientMeasure(measure.getId(), patient.getId(), null, new MeasureEvidenceOptions());
assertNotNull(report);
assertTrue(report.getEvaluatedResource().isEmpty());
assertEquals(null, report.getExtensionByUrl(CDMConstants.EVIDENCE_URL));
}
use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MeasureHelperTest method testResolveByIdentifier_getLatestMeasure.
@Test
public void testResolveByIdentifier_getLatestMeasure() throws Exception {
String identifierSystem = "system1";
String identifierValue = "val1";
Measure measure1 = getCohortMeasure("Test", getLibrary("123", DEFAULT_VERSION, "cql/basic/Test-1.0.0.xml"), "Female");
Measure measure2 = getCohortMeasure("Test", getLibrary("123", DEFAULT_VERSION, "cql/basic/Test-1.0.0.xml"), "Female");
Measure measure3 = getCohortMeasure("Test", getLibrary("123", DEFAULT_VERSION, "cql/basic/Test-1.0.0.xml"), "Female");
measure1.setVersion("1.0.0");
measure2.setVersion("2.0.0");
org.hl7.fhir.r4.model.Identifier identifier = new IdentifierBuilder().buildValue(identifierValue).buildSystem(identifierSystem).build();
measure1.setIdentifier(Collections.singletonList(identifier));
measure2.setIdentifier(Collections.singletonList(identifier));
measure3.setIdentifier(Collections.singletonList(identifier));
MappingBuilder builder = get(urlPathEqualTo("/Measure")).withQueryParam("identifier", new EqualToPattern(identifierSystem + '|' + identifierValue)).withQueryParam("_format", new EqualToPattern("json"));
mockFhirResourceRetrieval(builder, getBundle(measure1, measure2, measure3));
Measure actual = MeasureHelper.loadMeasure(new Identifier(identifierSystem, identifierValue), null, resolver);
assertNotNull(actual);
assertEquals("Test", actual.getName());
assertEquals("2.0.0", actual.getVersion());
}
Aggregations