Search in sources :

Example 11 with DatetimeParameter

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

the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testInstant__shouldReturnDateTimeParameter.

@Test
public void testInstant__shouldReturnDateTimeParameter() {
    ParameterDefinition parameterDefinition = getBaseParameterDefinition("instant");
    String instantString = "2020-01-01T12:30:00.0Z";
    InstantType fhirValue = new InstantType(instantString);
    parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
    assertEquals(new DatetimeParameter(instantString), R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
Also used : DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) InstantType(org.hl7.fhir.r4.model.InstantType) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Test(org.junit.Test)

Example 12 with DatetimeParameter

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

the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testDateTimeWithTimezone__shouldReturnDatetimeParameter.

@Test
public void testDateTimeWithTimezone__shouldReturnDatetimeParameter() {
    ParameterDefinition parameterDefinition = getBaseParameterDefinition("dateTime");
    String dateString = "2020-01-01T00:00:00.0+04:00";
    DateTimeType fhirValue = new DateTimeType(dateString);
    parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
    assertEquals(new DatetimeParameter(dateString), R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
Also used : DateTimeType(org.hl7.fhir.r4.model.DateTimeType) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Test(org.junit.Test)

Example 13 with DatetimeParameter

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

the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testDateTimeNoTimezone__shouldReturnDatetimeParameter.

@Test
public void testDateTimeNoTimezone__shouldReturnDatetimeParameter() {
    ParameterDefinition parameterDefinition = getBaseParameterDefinition("dateTime");
    String dateString = "2020-01-01T00:00:00.0";
    DateTimeType fhirValue = new DateTimeType(dateString);
    parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
    assertEquals(new DatetimeParameter("2020-01-01T00:00:00.0"), R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
Also used : DateTimeType(org.hl7.fhir.r4.model.DateTimeType) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Test(org.junit.Test)

Aggregations

DatetimeParameter (com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter)13 Test (org.junit.Test)10 IntervalParameter (com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)8 Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)7 IntegerParameter (com.ibm.cohort.cql.evaluation.parameters.IntegerParameter)6 DateTimeType (org.hl7.fhir.r4.model.DateTimeType)6 ParameterDefinition (org.hl7.fhir.r4.model.ParameterDefinition)6 BooleanParameter (com.ibm.cohort.cql.evaluation.parameters.BooleanParameter)5 CodeParameter (com.ibm.cohort.cql.evaluation.parameters.CodeParameter)5 DateParameter (com.ibm.cohort.cql.evaluation.parameters.DateParameter)5 DecimalParameter (com.ibm.cohort.cql.evaluation.parameters.DecimalParameter)5 QuantityParameter (com.ibm.cohort.cql.evaluation.parameters.QuantityParameter)5 StringParameter (com.ibm.cohort.cql.evaluation.parameters.StringParameter)5 TimeParameter (com.ibm.cohort.cql.evaluation.parameters.TimeParameter)5 Date (java.util.Date)4 InstantType (org.hl7.fhir.r4.model.InstantType)4 Period (org.hl7.fhir.r4.model.Period)4 ConceptParameter (com.ibm.cohort.cql.evaluation.parameters.ConceptParameter)3 RatioParameter (com.ibm.cohort.cql.evaluation.parameters.RatioParameter)3 UnsupportedFhirTypeException (com.ibm.cohort.engine.measure.parameter.UnsupportedFhirTypeException)3