use of org.hl7.fhir.dstu3.model.Library in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluatorTest method measure_default_unsupported_type.
@Test(expected = UnsupportedFhirTypeException.class)
public void measure_default_unsupported_type() throws Exception {
CapabilityStatement metadata = getCapabilityStatement();
mockFhirResourceRetrieval("/metadata?_format=json", metadata);
Patient patient = getPatient("123", AdministrativeGender.MALE, "1970-10-10");
mockFhirResourceRetrieval(patient);
Library library = mockLibraryRetrieval("TestAdultMales", DEFAULT_VERSION, "cql/fhir-measure/test-parameter-defaults.cql");
expressionsByPopulationType.clear();
expressionsByPopulationType.put(MeasurePopulationType.INITIALPOPULATION, INITIAL_POPULATION);
expressionsByPopulationType.put(MeasurePopulationType.DENOMINATOR, DENOMINATOR);
expressionsByPopulationType.put(MeasurePopulationType.NUMERATOR, NUMERATOR);
Measure measure = getProportionMeasure("ProportionMeasureName", library, expressionsByPopulationType);
Address unsupportedType = new Address();
unsupportedType.setCity("Cleaveland");
measure.addExtension(createMeasureParameter("SomeAge", unsupportedType));
mockFhirResourceRetrieval(measure);
evaluator.evaluatePatientMeasure(measure.getId(), patient.getId(), null, new MeasureEvidenceOptions());
}
use of org.hl7.fhir.dstu3.model.Library in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluatorTest method in_initial_population_denominator_and_nothing_else___proportion_evaluated_correctly.
@Test
public void in_initial_population_denominator_and_nothing_else___proportion_evaluated_correctly() throws 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");
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);
assertNotNull(report);
assertEquals(expressionsByPopulationType.size(), report.getGroupFirstRep().getPopulation().size());
for (MeasureReport.MeasureReportGroupPopulationComponent pop : report.getGroupFirstRep().getPopulation()) {
MeasurePopulationType type = MeasurePopulationType.fromCode(pop.getCode().getCodingFirstRep().getCode());
switch(type) {
case INITIALPOPULATION:
assertEquals(1, pop.getCount());
break;
case DENOMINATOR:
assertEquals(1, pop.getCount());
break;
case NUMERATOR:
assertEquals(0, pop.getCount());
break;
default:
fail("Unexpected population type in result");
}
}
}
use of org.hl7.fhir.dstu3.model.Library in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluatorTest method elm_in_initial_population___cohort_evaluated_correctly.
@Test
public void elm_in_initial_population___cohort_evaluated_correctly() throws 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.xml", ELM_MIME_TYPE);
Measure measure = getCohortMeasure("CohortMeasureName", library, INITIAL_POPULATION);
mockFhirResourceRetrieval(measure);
MeasureReport report = evaluator.evaluatePatientMeasure(measure.getId(), patient.getId(), null);
assertNotNull(report);
assertEquals(1, report.getGroupFirstRep().getPopulationFirstRep().getCount());
verify(1, getRequestedFor(urlEqualTo("/Patient/123?_format=json")));
// These ensure that the cache is working
verify(1, getRequestedFor(urlMatching("/Library\\?url=http.*&_format=json")));
verify(1, getRequestedFor(urlEqualTo("/Library?name%3Aexact=" + library.getName() + "&version=1.0.0&_format=json")));
}
use of org.hl7.fhir.dstu3.model.Library 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.dstu3.model.Library 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);
}
Aggregations