use of com.ibm.cohort.cql.evaluation.parameters.QuantityParameter 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 com.ibm.cohort.cql.evaluation.parameters.QuantityParameter 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));
}
Aggregations