use of com.ibm.cohort.cql.evaluation.CqlEvaluator 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());
}
use of com.ibm.cohort.cql.evaluation.CqlEvaluator in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testPatientIsFemaleFalse.
@Test
public void testPatientIsFemaleFalse() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.MALE, null);
CqlEvaluator evaluator = setupTestFor(patient, "cql.basic");
String expression = "Female";
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("Test", "1.0.0"), null, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
expected.put(expression, false);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of com.ibm.cohort.cql.evaluation.CqlEvaluator in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testMissingRequiredCQLParameterSomeSpecified.
@Test
public void testMissingRequiredCQLParameterSomeSpecified() 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("Unused", new IntegerParameter(100));
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, null);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of com.ibm.cohort.cql.evaluation.CqlEvaluator in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testUOMEquivalence_demonstrateEqualityIssue.
/*
* The following `testUOMEquivalence` tests are intended to document the engine behavior
* when an author attempts to compare quantities with different UoM values.
*/
@Test
public void testUOMEquivalence_demonstrateEqualityIssue() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, "1983-12-02");
CqlEvaluator evaluator = setupTestFor(patient, "cql.uomequivalence");
String expression = "IsEqual";
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("TestUOMCompare", "1.0.0"), null, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
// when you compare two quantities with different UoM, the
// the engine returns null.
expected.put(expression, null);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of com.ibm.cohort.cql.evaluation.CqlEvaluator in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testSimplestHTTPRequestSettings.
@Test
public void testSimplestHTTPRequestSettings() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, null);
FhirServerConfig fhirConfig = getFhirServerConfig();
CqlEvaluator evaluator = setupTestFor(patient, fhirConfig, "cql.basic");
String expression = "Female";
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("Test", "1.0.0"), null, new ImmutablePair<>("Patient", "123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
expected.put(expression, true);
Assert.assertEquals(expected, actual.getExpressionResults());
}
Aggregations