Search in sources :

Example 36 with ParameterDefinition

use of org.hl7.fhir.r5.model.ParameterDefinition in project quality-measure-and-cohort-service by Alvearie.

the class MeasureEvaluatorTest method createMeasureParameter.

private Extension createMeasureParameter(String name, Type defaultValue) {
    Extension measureParameter = new Extension();
    measureParameter.setUrl(MEASURE_PARAMETER_URL);
    ParameterDefinition parameterDefinition = new ParameterDefinition();
    parameterDefinition.setName(name);
    measureParameter.setValue(parameterDefinition);
    Extension defaultValueExtension = new Extension();
    defaultValueExtension.setUrl(PARAMETER_DEFAULT_URL);
    defaultValueExtension.setValue(defaultValue);
    parameterDefinition.addExtension(defaultValueExtension);
    return measureParameter;
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition)

Example 37 with ParameterDefinition

use of org.hl7.fhir.r5.model.ParameterDefinition in project quality-measure-and-cohort-service by Alvearie.

the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testString__shouldReturnStringParameter.

@Test
public void testString__shouldReturnStringParameter() {
    ParameterDefinition parameterDefinition = getBaseParameterDefinition("string");
    String expectedValue = "data";
    StringType fhirValue = new StringType(expectedValue);
    parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
    assertEquals(new StringParameter(expectedValue), R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
Also used : StringParameter(com.ibm.cohort.cql.evaluation.parameters.StringParameter) StringType(org.hl7.fhir.r4.model.StringType) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Test(org.junit.Test)

Example 38 with ParameterDefinition

use of org.hl7.fhir.r5.model.ParameterDefinition in project quality-measure-and-cohort-service by Alvearie.

the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testPeriod__shouldReturnIntervalParameterOfDateTimeParameter.

@Test
public void testPeriod__shouldReturnIntervalParameterOfDateTimeParameter() {
    ParameterDefinition parameterDefinition = getBaseParameterDefinition("Period");
    Period fhirValue = new Period();
    fhirValue.setStartElement(new DateTimeType("2020-01-01T12:00:00.0"));
    fhirValue.setEndElement(new DateTimeType("2020-02-04T11:00:00.0-05:00"));
    parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
    IntervalParameter expectedParameter = new IntervalParameter(new DatetimeParameter("2020-01-01T12:00:00.0"), true, new DatetimeParameter("2020-02-04T11:00:00.0-05:00"), true);
    assertEquals(expectedParameter, R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
Also used : DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Period(org.hl7.fhir.r4.model.Period) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Test(org.junit.Test)

Example 39 with ParameterDefinition

use of org.hl7.fhir.r5.model.ParameterDefinition in project quality-measure-and-cohort-service by Alvearie.

the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testBase64Binary__shouldReturnStringParameter.

@Test
public void testBase64Binary__shouldReturnStringParameter() {
    ParameterDefinition parameterDefinition = getBaseParameterDefinition("base64Binary");
    String base64String = "AAA";
    Base64BinaryType fhirValue = new Base64BinaryType(base64String);
    parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
    assertEquals(new StringParameter(base64String), R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
Also used : StringParameter(com.ibm.cohort.cql.evaluation.parameters.StringParameter) Base64BinaryType(org.hl7.fhir.r4.model.Base64BinaryType) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Test(org.junit.Test)

Example 40 with ParameterDefinition

use of org.hl7.fhir.r5.model.ParameterDefinition 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)

Aggregations

ParameterDefinition (org.hl7.fhir.r4.model.ParameterDefinition)32 Test (org.junit.Test)26 Extension (org.hl7.fhir.r4.model.Extension)14 DatetimeParameter (com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter)9 ArrayList (java.util.ArrayList)9 DateTimeType (org.hl7.fhir.r4.model.DateTimeType)9 QuantityParameter (com.ibm.cohort.cql.evaluation.parameters.QuantityParameter)8 StringParameter (com.ibm.cohort.cql.evaluation.parameters.StringParameter)8 Quantity (org.hl7.fhir.r4.model.Quantity)8 Range (org.hl7.fhir.r4.model.Range)8 CodeParameter (com.ibm.cohort.cql.evaluation.parameters.CodeParameter)7 IntervalParameter (com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)7 Period (org.hl7.fhir.r4.model.Period)7 BooleanParameter (com.ibm.cohort.cql.evaluation.parameters.BooleanParameter)6 ConceptParameter (com.ibm.cohort.cql.evaluation.parameters.ConceptParameter)6 DateParameter (com.ibm.cohort.cql.evaluation.parameters.DateParameter)6 DecimalParameter (com.ibm.cohort.cql.evaluation.parameters.DecimalParameter)6 IntegerParameter (com.ibm.cohort.cql.evaluation.parameters.IntegerParameter)6 RatioParameter (com.ibm.cohort.cql.evaluation.parameters.RatioParameter)6 TimeParameter (com.ibm.cohort.cql.evaluation.parameters.TimeParameter)6