Search in sources :

Example 1 with Parameter

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

the class ParameterHelperTest method testResolveStringParameter.

@Test
public void testResolveStringParameter() {
    Map<String, Parameter> params = ParameterHelper.parseParameterArguments(Arrays.asList("test:string:I have the:delimiter"));
    assertEquals(1, params.size());
    StringParameter p = (StringParameter) params.get("test");
    assertNotNull("Parameter with expected name not found", p);
    assertEquals("Unexpected value", "I have the:delimiter", p.getValue());
}
Also used : StringParameter(com.ibm.cohort.cql.evaluation.parameters.StringParameter) 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 2 with Parameter

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

the class ParameterHelperTest method testResolveQuantityParameter.

@Test
public void testResolveQuantityParameter() {
    Map<String, Parameter> params = ParameterHelper.parseParameterArguments(Arrays.asList("test:quantity:100:mg/mL"));
    assertEquals(1, params.size());
    QuantityParameter p = (QuantityParameter) params.get("test");
    assertNotNull("Parameter with expected name not found", p);
    assertEquals("Unexpected value", "100", p.getAmount().toString());
    assertEquals("Unexpected value", "mg/mL", p.getUnit().toString());
}
Also used : QuantityParameter(com.ibm.cohort.cql.evaluation.parameters.QuantityParameter) 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 3 with Parameter

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

the class ParameterHelperTest method testResolveDecimalParameter.

@Test
public void testResolveDecimalParameter() {
    Map<String, Parameter> params = ParameterHelper.parseParameterArguments(Arrays.asList("test:decimal:40.0"));
    assertEquals(1, params.size());
    DecimalParameter p = (DecimalParameter) params.get("test");
    assertNotNull("Parameter with expected name not found", p);
    assertEquals("Unexpected value", "40.0", p.getValue());
}
Also used : DecimalParameter(com.ibm.cohort.cql.evaluation.parameters.DecimalParameter) 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 4 with Parameter

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

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

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