use of org.hl7.fhir.r4.model.Expression in project quality-measure-and-cohort-service by Alvearie.
the class MeasureTestBase method getCohortMeasure.
public Measure getCohortMeasure(String measureName, Library library, String expression) throws Exception {
Measure measure = getTemplateMeasure(measureName, library, MeasureScoring.COHORT);
Measure.MeasureGroupComponent group = new Measure.MeasureGroupComponent();
addPopulations(group, Collections.singletonMap(MeasurePopulationType.INITIALPOPULATION, expression));
measure.addGroup(group);
return measure;
}
use of org.hl7.fhir.r4.model.Expression in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testUsingUSCoreWithTranslation.
@Test
public void testUsingUSCoreWithTranslation() throws Exception {
Patient patient = getPatient("123", AdministrativeGender.MALE, "1983-12-02");
CqlEvaluator evaluator = setupTestFor(patient, "cql.uscore");
String expression = "QueryByGender";
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("TestUSCore", "1.0.0"), null, newPatientContext("123"), Collections.singleton(expression));
Assert.assertEquals(1, actual.getExpressionResults().size());
List<Object> value = (List) actual.getExpressionResults().get(expression);
Assert.assertEquals(1, value.size());
assertFhirEquals(patient, (IBaseResource) value.get(0));
}
use of org.hl7.fhir.r4.model.Expression in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testRequiredCQLParameterSpecifiedPatientInRange.
@Test
public void testRequiredCQLParameterSpecifiedPatientInRange() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, "1978-05-06");
CqlEvaluator evaluator = setupTestFor(patient, "cql.parameters");
String expression = "Female";
Map<String, Parameter> parameters = new HashMap<>();
parameters.put("MaxAge", new IntegerParameter(50));
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("TestWithParams", "1.0.0"), parameters, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
expected.put(expression, true);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of org.hl7.fhir.r4.model.Expression in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testUOMEquivalence_demonstrateConversionOfBothSides.
@Test
public void testUOMEquivalence_demonstrateConversionOfBothSides() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, "1983-12-02");
CqlEvaluator evaluator = setupTestFor(patient, "cql.uomequivalence");
String expression = "UpConvert";
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("TestUOMCompare", "1.0.0"), null, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
// The safest thing to do is convert the left and right
// values to a known, fixed unit
expected.put(expression, true);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of org.hl7.fhir.r4.model.Expression in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testRequiredCQLParameterSpecifiedPatientOutOfRange.
@Test
public void testRequiredCQLParameterSpecifiedPatientOutOfRange() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, "1978-05-06");
CqlEvaluator evaluator = setupTestFor(patient, "cql.parameters");
String expression = "Female";
Map<String, Parameter> parameters = new HashMap<>();
parameters.put("MaxAge", new IntegerParameter(40));
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("TestWithParams", "1.0.0"), parameters, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
expected.put(expression, false);
Assert.assertEquals(expected, actual.getExpressionResults());
}
Aggregations