use of com.ibm.cohort.cql.evaluation.parameters.IntegerParameter in project quality-measure-and-cohort-service by Alvearie.
the class ParameterHelperTest method testResolveIntegerParameter.
@Test
public void testResolveIntegerParameter() {
Map<String, Parameter> params = ParameterHelper.parseParameterArguments(Arrays.asList("test:integer:40"));
assertEquals(1, params.size());
IntegerParameter p = (IntegerParameter) params.get("test");
assertNotNull("Parameter with expected name not found", p);
assertEquals("Unexpected value", 40, p.getValue());
}
use of com.ibm.cohort.cql.evaluation.parameters.IntegerParameter in project quality-measure-and-cohort-service by Alvearie.
the class ParameterHelperTest method testResolveIntervalIntegerParameter.
@Test
public void testResolveIntervalIntegerParameter() {
Map<String, Parameter> params = ParameterHelper.parseParameterArguments(Arrays.asList("test:interval:integer,10,20"));
assertEquals(1, params.size());
IntervalParameter p = (IntervalParameter) params.get("test");
assertEquals(10, ((IntegerParameter) p.getStart()).getValue());
assertEquals(20, ((IntegerParameter) p.getEnd()).getValue());
}
use of com.ibm.cohort.cql.evaluation.parameters.IntegerParameter in project quality-measure-and-cohort-service by Alvearie.
the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testInteger__shouldReturnIntegerParameter.
@Test
public void testInteger__shouldReturnIntegerParameter() {
ParameterDefinition parameterDefinition = getBaseParameterDefinition("integer");
int expectedValue = 10;
IntegerType fhirValue = new IntegerType(expectedValue);
parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
assertEquals(new IntegerParameter(expectedValue), R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
use of com.ibm.cohort.cql.evaluation.parameters.IntegerParameter 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 com.ibm.cohort.cql.evaluation.parameters.IntegerParameter 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