Search in sources :

Example 6 with MeasureEvidenceOptions

use of com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions in project quality-measure-and-cohort-service by Alvearie.

the class MeasureEvaluatorTest method in_populations_defines_returned.

@Test
public void in_populations_defines_returned() throws Exception {
    CapabilityStatement metadata = getCapabilityStatement();
    mockFhirResourceRetrieval("/metadata?_format=json", metadata);
    Patient patient = getPatient("123", AdministrativeGender.MALE, "1970-10-10");
    // Add 2 names to test list
    HumanName name1 = new HumanName();
    name1.setFamily("Jones");
    HumanName name2 = new HumanName();
    name2.setFamily("Smith");
    patient.setName(Arrays.asList(name1, name2));
    // Add marital status to test codeable concept
    CodeableConcept maritalStatus = new CodeableConcept();
    Coding maritalCoding = new Coding();
    maritalCoding.setCode("M");
    maritalCoding.setSystem("http://terminology.hl7.org/CodeSystem/v3-MaritalStatus");
    maritalCoding.setDisplay("Married");
    maritalStatus.setCoding(Arrays.asList(maritalCoding));
    maritalStatus.setText("Married");
    patient.setMaritalStatus(maritalStatus);
    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(true, DefineReturnOptions.ALL));
    assertNotNull(report);
    assertFalse(report.getEvaluatedResource().isEmpty());
    List<Extension> returnedExtensions = report.getExtensionsByUrl(CDMConstants.EVIDENCE_URL);
    assertFalse(returnedExtensions.isEmpty());
    assertEquals(30, returnedExtensions.size());
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) HumanName(org.hl7.fhir.r4.model.HumanName) Coding(org.hl7.fhir.r4.model.Coding) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) Measure(org.hl7.fhir.r4.model.Measure) Patient(org.hl7.fhir.r4.model.Patient) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) Library(org.hl7.fhir.r4.model.Library) MeasureEvidenceOptions(com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.Test)

Example 7 with MeasureEvidenceOptions

use of com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions 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());
}
Also used : Address(org.hl7.fhir.r4.model.Address) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) Measure(org.hl7.fhir.r4.model.Measure) Patient(org.hl7.fhir.r4.model.Patient) Library(org.hl7.fhir.r4.model.Library) MeasureEvidenceOptions(com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions) Test(org.junit.Test)

Example 8 with MeasureEvidenceOptions

use of com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions 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));
}
Also used : CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) Measure(org.hl7.fhir.r4.model.Measure) Patient(org.hl7.fhir.r4.model.Patient) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) Library(org.hl7.fhir.r4.model.Library) MeasureEvidenceOptions(com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions) Test(org.junit.Test)

Example 9 with MeasureEvidenceOptions

use of com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions in project quality-measure-and-cohort-service by Alvearie.

the class R4MeasureEvaluatorBuilderTest method validateMeasureEvaluator.

private void validateMeasureEvaluator(MeasureEvaluator evaluator) {
    MeasureReport report = evaluator.evaluatePatientMeasure(MEASURE_NAME, PATIENT_ID, null, new MeasureEvidenceOptions());
    List<MeasureReportGroupComponent> groups = report.getGroup();
    Assert.assertEquals(1, groups.size());
    MeasureReportGroupPopulationComponent component = groups.get(0).getPopulationFirstRep();
    List<Coding> codings = component.getCode().getCoding();
    Assert.assertEquals(1, codings.size());
    Coding coding = codings.get(0);
    Assert.assertEquals("initial-population", coding.getCode());
    int count = component.getCount();
    Assert.assertEquals(1, count);
}
Also used : MeasureReportGroupPopulationComponent(org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupPopulationComponent) Coding(org.hl7.fhir.r4.model.Coding) MeasureReportGroupComponent(org.hl7.fhir.r4.model.MeasureReport.MeasureReportGroupComponent) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) MeasureEvidenceOptions(com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions)

Example 10 with MeasureEvidenceOptions

use of com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions in project quality-measure-and-cohort-service by Alvearie.

the class PatientListMeasureEvaluationTest method when_serialize_deserialize___properties_are_unchanged.

@Test
public void when_serialize_deserialize___properties_are_unchanged() throws Exception {
    FhirServerConfig dataServerConfig = new FhirServerConfig();
    dataServerConfig.setEndpoint("dataserver");
    FhirServerConfig termServerConfig = new FhirServerConfig();
    termServerConfig.setEndpoint("termserver");
    Map<String, Parameter> parameterOverrides = new HashMap<>();
    parameterOverrides.put("Measurement Period", new IntervalParameter(new DateParameter("2019-07-04"), true, new DateParameter("2020-07-04"), true));
    MeasureContext ctx = new MeasureContext("measureId", parameterOverrides);
    PatientListMeasureEvaluation evaluation = new PatientListMeasureEvaluation();
    evaluation.setDataServerConfig(dataServerConfig);
    evaluation.setTerminologyServerConfig(termServerConfig);
    List<String> patientIds = new ArrayList<>();
    patientIds.add("patientId1");
    patientIds.add("patientId2");
    evaluation.setPatientIds(patientIds);
    evaluation.setMeasureContext(ctx);
    evaluation.setEvidenceOptions(new MeasureEvidenceOptions(false, MeasureEvidenceOptions.DefineReturnOptions.ALL));
    ObjectMapper om = new ObjectMapper();
    String serialized = om.writeValueAsString(evaluation);
    PatientListMeasureEvaluation deserialized = om.readValue(serialized, PatientListMeasureEvaluation.class);
    assertEquals(evaluation, deserialized);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) MeasureEvidenceOptions(com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions) MeasureContext(com.ibm.cohort.engine.measure.MeasureContext) DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) FhirServerConfig(com.ibm.cohort.fhir.client.config.FhirServerConfig) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

MeasureEvidenceOptions (com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions)18 Measure (org.hl7.fhir.r4.model.Measure)15 Test (org.junit.Test)15 Library (org.hl7.fhir.r4.model.Library)14 MeasureReport (org.hl7.fhir.r4.model.MeasureReport)11 CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)10 Patient (org.hl7.fhir.r4.model.Patient)10 DateParameter (com.ibm.cohort.cql.evaluation.parameters.DateParameter)6 IntervalParameter (com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)6 Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)6 MeasureContext (com.ibm.cohort.engine.measure.MeasureContext)6 HashMap (java.util.HashMap)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 IParser (ca.uhn.fhir.parser.IParser)4 FhirContext (ca.uhn.fhir.context.FhirContext)3 PatientListMeasureEvaluation (com.ibm.cohort.engine.api.service.model.PatientListMeasureEvaluation)3 Coding (org.hl7.fhir.r4.model.Coding)3 MeasureEvaluation (com.ibm.cohort.engine.api.service.model.MeasureEvaluation)2 Headers (com.jayway.restassured.response.Headers)2 ValidatableResponse (com.jayway.restassured.response.ValidatableResponse)2