use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MapFhirResourceResolverIntegrationTest method when_resolve_by_identifier_no_version_single_result___result_is_returned.
@Test
public void when_resolve_by_identifier_no_version_single_result___result_is_returned() {
Measure expected = new Measure();
expected.setId("test-id");
expected.addIdentifier().setSystem("my_system").setValue("my_identifier");
expected.setVersion("1.0.0");
expected.setUrl("http://alvearie.io/fhir/Measure/MyTestMeasure");
resolver.addResource(expected);
Measure actual = resolver.resolveByIdentifier("my_identifier", "my_system", null);
assertNotNull(actual);
}
use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MapFhirResourceResolverIntegrationTest method when_resolve_by_name_with_version_multiple_result___latest_semantic_version_returned.
@Test
public void when_resolve_by_name_with_version_multiple_result___latest_semantic_version_returned() {
Measure expected = getMeasure("MyTestMeasure", "1.2.0", "my_identifier");
resolver.addResource(expected);
Measure other = getMeasure("MyTestMeasure", "1.0.0", "my_identifier");
resolver.addResource(other);
other = getMeasure("MyTestMeasure", "9.5.zzzzz", "my_identifier");
resolver.addResource(other);
Measure actual = resolver.resolveByName("MyTestMeasure", null);
assertNotNull(actual);
assertEquals(expected, actual);
}
use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MapFhirResourceResolverIntegrationTest method when_resolve_by_name_with_version_single_result___return_single_result.
@Test
public void when_resolve_by_name_with_version_single_result___return_single_result() {
Measure expected = getMeasure("MyTestMeasure", "9.5.zzzzz", "my_identifier");
resolver.addResource(expected);
Measure other = getMeasure("MyTestMeasure", "1.0.0", "my_identifier");
resolver.addResource(other);
other = getMeasure("MyTestMeasure", "1.2.0", "my_identifier");
resolver.addResource(other);
Measure actual = resolver.resolveByName("MyTestMeasure", "9.5.zzzzz");
assertNotNull(actual);
assertEquals(expected, actual);
}
use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MapFhirResourceResolverIntegrationTest method when_resolve_by_identifier_no_version_none_matched___null_is_returned.
@Test
public void when_resolve_by_identifier_no_version_none_matched___null_is_returned() {
Measure expected = getMeasure("MyTestMeasure", "2.0.0", "my_identifier");
resolver.addResource(expected);
Measure other = getMeasure("MyTestMeasure", "1.0.0", "my_identifier");
resolver.addResource(other);
other = getMeasure("MyTestMeasure", "1.2.0", "my_identifier");
resolver.addResource(other);
Measure actual = resolver.resolveByIdentifier("some_other_identifier", "my_system", null);
assertNull(actual);
}
use of org.hl7.fhir.r4b.model.Measure in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluatorTest method id_based_library_link___successfully_loaded_and_evaluated.
@Test
public void id_based_library_link___successfully_loaded_and_evaluated() throws Exception {
mockFhirResourceRetrieval("/metadata?_format=json", getCapabilityStatement());
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("IDBasedLibraryMeasure", library, expressionsByPopulationType, "CareGap1", "CareGap2");
measure.setLibrary(Arrays.asList(new CanonicalType("Library/" + library.getId())));
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);
verify(1, getRequestedFor(urlEqualTo("/Library/" + library.getId() + "?_format=json")));
}
Aggregations