use of org.hl7.fhir.r4b.model.ParameterDefinition in project quality-measure-and-cohort-service by Alvearie.
the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testCodeableConcept__shouldReturnConceptParameter.
@Test
public void testCodeableConcept__shouldReturnConceptParameter() {
ParameterDefinition parameterDefinition = getBaseParameterDefinition("CodeableConcept");
CodeableConcept fhirValue = new CodeableConcept();
fhirValue.setText("plainText");
fhirValue.addCoding(makeCoding("s1", "val1", "d1", "ver1"));
fhirValue.addCoding(makeCoding("s2", "val2", "d2", "ver2"));
parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
List<CodeParameter> expectedCodeParameters = new ArrayList<>();
expectedCodeParameters.add(new CodeParameter().setSystem("s1").setValue("val1").setDisplay("d1").setVersion("ver1"));
expectedCodeParameters.add(new CodeParameter().setSystem("s2").setValue("val2").setDisplay("d2").setVersion("ver2"));
ConceptParameter expectedParameter = new ConceptParameter().setDisplay("plainText");
expectedParameter.setCodes(expectedCodeParameters);
assertEquals(expectedParameter, R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
use of org.hl7.fhir.r4b.model.ParameterDefinition in project quality-measure-and-cohort-service by Alvearie.
the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testRatio__shouldReturnRatioParameter.
@Test
public void testRatio__shouldReturnRatioParameter() {
ParameterDefinition parameterDefinition = getBaseParameterDefinition("Ratio");
String denominatorString = "1.5";
String numeratorString = "2.5";
BigDecimal denominatorValue = new BigDecimal(denominatorString);
BigDecimal numeratorValue = new BigDecimal(numeratorString);
String unit = "ml";
org.hl7.fhir.r4.model.Ratio fhirValue = new org.hl7.fhir.r4.model.Ratio().setDenominator(new org.hl7.fhir.r4.model.Quantity().setValue(denominatorValue).setUnit(unit)).setNumerator(new org.hl7.fhir.r4.model.Quantity().setValue(numeratorValue).setUnit(unit));
parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
RatioParameter expectedParameter = new RatioParameter().setDenominator(new QuantityParameter().setUnit(unit).setAmount(denominatorString)).setNumerator(new QuantityParameter().setUnit(unit).setAmount(numeratorString));
assertEquals(expectedParameter, R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
use of org.hl7.fhir.r4b.model.ParameterDefinition in project quality-measure-and-cohort-service by Alvearie.
the class R4ParameterDefinitionWithDefaultToCohortParameterConverterTest method testQuantity__shouldReturnQuantityParameter.
@Test
public void testQuantity__shouldReturnQuantityParameter() {
ParameterDefinition parameterDefinition = getBaseParameterDefinition("Quantity");
String decimalString = "1.5";
BigDecimal bigDecimalValue = new BigDecimal(decimalString);
String unit = "ml";
org.hl7.fhir.r4.model.Quantity fhirValue = new org.hl7.fhir.r4.model.Quantity();
fhirValue.setUnit(unit);
fhirValue.setValue(bigDecimalValue);
parameterDefinition.addExtension(CDMConstants.PARAMETER_DEFAULT_URL, fhirValue);
QuantityParameter expectedParameter = new QuantityParameter().setUnit(unit).setAmount(decimalString);
assertEquals(expectedParameter, R4ParameterDefinitionWithDefaultToCohortParameterConverter.toCohortParameter(parameterDefinition));
}
use of org.hl7.fhir.r4b.model.ParameterDefinition 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));
}
use of org.hl7.fhir.r4b.model.ParameterDefinition 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));
}
Aggregations