Search in sources :

Example 36 with Measure

use of org.hl7.fhir.r5.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);
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) Test(org.junit.Test)

Example 37 with Measure

use of org.hl7.fhir.r5.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);
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) Test(org.junit.Test)

Example 38 with Measure

use of org.hl7.fhir.r5.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);
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) Test(org.junit.Test)

Example 39 with Measure

use of org.hl7.fhir.r5.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);
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) Test(org.junit.Test)

Example 40 with Measure

use of org.hl7.fhir.r5.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")));
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Patient(org.hl7.fhir.r4.model.Patient) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) CanonicalType(org.hl7.fhir.r4.model.CanonicalType) BooleanParameter(com.ibm.cohort.cql.evaluation.parameters.BooleanParameter) Measure(org.hl7.fhir.r4.model.Measure) ConceptParameter(com.ibm.cohort.cql.evaluation.parameters.ConceptParameter) RatioParameter(com.ibm.cohort.cql.evaluation.parameters.RatioParameter) IntegerParameter(com.ibm.cohort.cql.evaluation.parameters.IntegerParameter) DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) CodeParameter(com.ibm.cohort.cql.evaluation.parameters.CodeParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) DecimalParameter(com.ibm.cohort.cql.evaluation.parameters.DecimalParameter) QuantityParameter(com.ibm.cohort.cql.evaluation.parameters.QuantityParameter) StringParameter(com.ibm.cohort.cql.evaluation.parameters.StringParameter) TimeParameter(com.ibm.cohort.cql.evaluation.parameters.TimeParameter) BooleanParameter(com.ibm.cohort.cql.evaluation.parameters.BooleanParameter) Library(org.hl7.fhir.r4.model.Library) Test(org.junit.Test)

Aggregations

Measure (org.hl7.fhir.r4.model.Measure)119 Test (org.junit.Test)97 Library (org.hl7.fhir.r4.model.Library)61 Patient (org.hl7.fhir.r4.model.Patient)45 MeasureReport (org.hl7.fhir.r4.model.MeasureReport)44 HashMap (java.util.HashMap)24 ArrayList (java.util.ArrayList)23 DateParameter (com.ibm.cohort.cql.evaluation.parameters.DateParameter)22 IntervalParameter (com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)22 Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)22 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)21 ByteArrayOutputStream (java.io.ByteArrayOutputStream)21 MeasureEvidenceOptions (com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions)20 CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)20 Test (org.junit.jupiter.api.Test)18 Extension (org.hl7.fhir.r4.model.Extension)15 StringType (org.hl7.fhir.r4.model.StringType)15 DatetimeParameter (com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter)14 CanonicalType (org.hl7.fhir.r4.model.CanonicalType)14 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)14