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());
}
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());
}
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));
}
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);
}
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);
}
Aggregations