Search in sources :

Example 1 with IntervalParameter

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());
}
Also used : DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) StringParameter(com.ibm.cohort.cql.evaluation.parameters.StringParameter) CodeParameter(com.ibm.cohort.cql.evaluation.parameters.CodeParameter) TimeParameter(com.ibm.cohort.cql.evaluation.parameters.TimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) DecimalParameter(com.ibm.cohort.cql.evaluation.parameters.DecimalParameter) QuantityParameter(com.ibm.cohort.cql.evaluation.parameters.QuantityParameter) BooleanParameter(com.ibm.cohort.cql.evaluation.parameters.BooleanParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) IntegerParameter(com.ibm.cohort.cql.evaluation.parameters.IntegerParameter) TimeParameter(com.ibm.cohort.cql.evaluation.parameters.TimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Test(org.junit.Test)

Example 2 with IntervalParameter

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());
}
Also used : DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) StringParameter(com.ibm.cohort.cql.evaluation.parameters.StringParameter) CodeParameter(com.ibm.cohort.cql.evaluation.parameters.CodeParameter) TimeParameter(com.ibm.cohort.cql.evaluation.parameters.TimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) DecimalParameter(com.ibm.cohort.cql.evaluation.parameters.DecimalParameter) QuantityParameter(com.ibm.cohort.cql.evaluation.parameters.QuantityParameter) BooleanParameter(com.ibm.cohort.cql.evaluation.parameters.BooleanParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) IntegerParameter(com.ibm.cohort.cql.evaluation.parameters.IntegerParameter) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Test(org.junit.Test)

Example 3 with IntervalParameter

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());
}
Also used : DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) StringParameter(com.ibm.cohort.cql.evaluation.parameters.StringParameter) CodeParameter(com.ibm.cohort.cql.evaluation.parameters.CodeParameter) TimeParameter(com.ibm.cohort.cql.evaluation.parameters.TimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) DecimalParameter(com.ibm.cohort.cql.evaluation.parameters.DecimalParameter) QuantityParameter(com.ibm.cohort.cql.evaluation.parameters.QuantityParameter) BooleanParameter(com.ibm.cohort.cql.evaluation.parameters.BooleanParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) IntegerParameter(com.ibm.cohort.cql.evaluation.parameters.IntegerParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Test(org.junit.Test)

Example 4 with IntervalParameter

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());
}
Also used : DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) Measure(org.hl7.fhir.r4.model.Measure) DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Test(org.junit.Test)

Example 5 with IntervalParameter

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);
}
Also used : DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) Measure(org.hl7.fhir.r4.model.Measure) DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)

Aggregations

IntervalParameter (com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)26 Test (org.junit.Test)24 Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)23 DateParameter (com.ibm.cohort.cql.evaluation.parameters.DateParameter)17 HashMap (java.util.HashMap)14 DatetimeParameter (com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter)12 Measure (org.hl7.fhir.r4.model.Measure)12 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)11 MeasureContext (com.ibm.cohort.engine.measure.MeasureContext)10 IntegerParameter (com.ibm.cohort.cql.evaluation.parameters.IntegerParameter)9 FhirServerConfig (com.ibm.cohort.fhir.client.config.FhirServerConfig)9 Library (org.hl7.fhir.r4.model.Library)9 FhirContext (ca.uhn.fhir.context.FhirContext)8 IParser (ca.uhn.fhir.parser.IParser)8 QuantityParameter (com.ibm.cohort.cql.evaluation.parameters.QuantityParameter)8 PatientListMeasureEvaluation (com.ibm.cohort.engine.api.service.model.PatientListMeasureEvaluation)8 ByteArrayInputStream (java.io.ByteArrayInputStream)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)8 BooleanParameter (com.ibm.cohort.cql.evaluation.parameters.BooleanParameter)7 CodeParameter (com.ibm.cohort.cql.evaluation.parameters.CodeParameter)7