use of com.ibm.cohort.cql.evaluation.parameters.IntervalParameter in project quality-measure-and-cohort-service by Alvearie.
the class ParameterHelperTest method testResolveIntervalTimeParameter.
@Test
public void testResolveIntervalTimeParameter() {
Map<String, Parameter> params = ParameterHelper.parseParameterArguments(Arrays.asList("test:interval:time,T12:13:14,T22:33:44"));
assertEquals(1, params.size());
IntervalParameter p = (IntervalParameter) params.get("test");
TimeParameter start = (TimeParameter) p.getStart();
assertEquals("T12:13:14", start.getValue());
TimeParameter end = (TimeParameter) p.getEnd();
assertEquals("T22:33:44", end.getValue());
}
use of com.ibm.cohort.cql.evaluation.parameters.IntervalParameter in project quality-measure-and-cohort-service by Alvearie.
the class ParameterHelperTest method testResolveIntervalDatetimeParameter.
@Test
public void testResolveIntervalDatetimeParameter() {
Map<String, Parameter> params = ParameterHelper.parseParameterArguments(Arrays.asList("test:interval:datetime,@2020-01-02T12:13:14,@2021-02-03T22:33:44"));
assertEquals(1, params.size());
IntervalParameter p = (IntervalParameter) params.get("test");
DatetimeParameter start = (DatetimeParameter) p.getStart();
assertEquals("@2020-01-02T12:13:14", start.getValue());
DatetimeParameter end = (DatetimeParameter) p.getEnd();
assertEquals("@2021-02-03T22:33:44", end.getValue());
}
use of com.ibm.cohort.cql.evaluation.parameters.IntervalParameter 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.IntervalParameter in project quality-measure-and-cohort-service by Alvearie.
the class DefaultMeasurementPeriodStrategyTest method parameter_not_null_date___value_used.
@Test
public void parameter_not_null_date___value_used() {
Measure measure = new Measure();
Map<String, Parameter> parameterOverrides = Collections.singletonMap(DefaultMeasurementPeriodStrategy.DEFAULT_MEASUREMENT_PERIOD_PARAMETER, new IntervalParameter(new DateParameter("2020-03-14"), true, new DateParameter("2020-09-14"), true));
Pair<String, String> result = new DefaultMeasurementPeriodStrategy().getMeasurementPeriod(measure, parameterOverrides);
assertEquals("Unexpected start", "2020-03-14", result.getLeft());
assertEquals("Unexpected end", "2020-09-14", result.getRight());
}
use of com.ibm.cohort.cql.evaluation.parameters.IntervalParameter in project quality-measure-and-cohort-service by Alvearie.
the class DefaultMeasurementPeriodStrategyTest method runGetMeasurementPeriodTest.
private void runGetMeasurementPeriodTest(String parameterName, String start, String end) {
Measure measure = new Measure();
Map<String, Parameter> parameterOverrides = Collections.singletonMap(parameterName, new IntervalParameter(new DateParameter(start), true, new DateParameter(end), true));
Pair<String, String> result = new DefaultMeasurementPeriodStrategy().setMeasurementPeriodParameter(parameterName).getMeasurementPeriod(measure, parameterOverrides);
assertEquals("Unexpected start", result.getLeft(), start);
assertEquals("Unexpected end", result.getRight(), end);
}
Aggregations