Search in sources :

Example 6 with Parameter

use of com.ibm.cohort.cql.evaluation.parameters.Parameter 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());
}
Also used : IntegerParameter(com.ibm.cohort.cql.evaluation.parameters.IntegerParameter) 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) Test(org.junit.Test)

Example 7 with Parameter

use of com.ibm.cohort.cql.evaluation.parameters.Parameter 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 8 with Parameter

use of com.ibm.cohort.cql.evaluation.parameters.Parameter in project quality-measure-and-cohort-service by Alvearie.

the class ParameterHelperTest method testResolveBooleanParameter.

@Test
public void testResolveBooleanParameter() {
    Map<String, Parameter> params = ParameterHelper.parseParameterArguments(Arrays.asList("test:boolean:true"));
    assertEquals(1, params.size());
    BooleanParameter p = (BooleanParameter) params.get("test");
    assertNotNull("Parameter with expected name not found", p);
    assertEquals("Unexpected value", true, p.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) BooleanParameter(com.ibm.cohort.cql.evaluation.parameters.BooleanParameter) Test(org.junit.Test)

Example 9 with Parameter

use of com.ibm.cohort.cql.evaluation.parameters.Parameter in project quality-measure-and-cohort-service by Alvearie.

the class ParameterHelperTest method testResolveDateTimeParameter.

@Test
public void testResolveDateTimeParameter() {
    Map<String, Parameter> params = ParameterHelper.parseParameterArguments(Arrays.asList("test:datetime:@2020-09-27T12:13:14"));
    assertEquals(1, params.size());
    DatetimeParameter p = (DatetimeParameter) params.get("test");
    assertNotNull("Parameter with expected name not found", p);
    assertEquals("Unexpected value", "@2020-09-27T12:13:14", p.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) Test(org.junit.Test)

Example 10 with Parameter

use of com.ibm.cohort.cql.evaluation.parameters.Parameter 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)

Aggregations

Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)60 Test (org.junit.Test)53 IntervalParameter (com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)52 IntegerParameter (com.ibm.cohort.cql.evaluation.parameters.IntegerParameter)40 HashMap (java.util.HashMap)38 DatetimeParameter (com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter)35 StringParameter (com.ibm.cohort.cql.evaluation.parameters.StringParameter)34 DateParameter (com.ibm.cohort.cql.evaluation.parameters.DateParameter)33 DecimalParameter (com.ibm.cohort.cql.evaluation.parameters.DecimalParameter)32 BooleanParameter (com.ibm.cohort.cql.evaluation.parameters.BooleanParameter)26 CodeParameter (com.ibm.cohort.cql.evaluation.parameters.CodeParameter)26 QuantityParameter (com.ibm.cohort.cql.evaluation.parameters.QuantityParameter)26 TimeParameter (com.ibm.cohort.cql.evaluation.parameters.TimeParameter)26 Measure (org.hl7.fhir.r4.model.Measure)19 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)16 Patient (org.hl7.fhir.r4.model.Patient)15 Library (org.hl7.fhir.r4.model.Library)14 ConceptParameter (com.ibm.cohort.cql.evaluation.parameters.ConceptParameter)12 RatioParameter (com.ibm.cohort.cql.evaluation.parameters.RatioParameter)12 ArrayList (java.util.ArrayList)11