use of org.hl7.fhir.r5.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testRequiredCQLParameterSpecifiedPatientInRange.
@Test
public void testRequiredCQLParameterSpecifiedPatientInRange() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, "1978-05-06");
CqlEvaluator evaluator = setupTestFor(patient, "cql.parameters");
String expression = "Female";
Map<String, Parameter> parameters = new HashMap<>();
parameters.put("MaxAge", new IntegerParameter(50));
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("TestWithParams", "1.0.0"), parameters, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
expected.put(expression, true);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of org.hl7.fhir.r5.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testRequiredCQLParameterSpecifiedPatientOutOfRange.
@Test
public void testRequiredCQLParameterSpecifiedPatientOutOfRange() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, "1978-05-06");
CqlEvaluator evaluator = setupTestFor(patient, "cql.parameters");
String expression = "Female";
Map<String, Parameter> parameters = new HashMap<>();
parameters.put("MaxAge", new IntegerParameter(40));
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("TestWithParams", "1.0.0"), parameters, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
expected.put(expression, false);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of org.hl7.fhir.r5.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class CqlEvaluatorIntegrationTest method testMissingRequiredCQLParameterSomeSpecified.
@Test
public void testMissingRequiredCQLParameterSomeSpecified() throws Exception {
Patient patient = getPatient("123", Enumerations.AdministrativeGender.FEMALE, "1978-05-06");
CqlEvaluator evaluator = setupTestFor(patient, "cql.parameters");
String expression = "Female";
Map<String, Parameter> parameters = new HashMap<>();
parameters.put("Unused", new IntegerParameter(100));
CqlEvaluationResult actual = evaluator.evaluate(new CqlVersionedIdentifier("TestWithParams", "1.0.0"), parameters, newPatientContext("123"), Collections.singleton(expression));
Map<String, Object> expected = new HashMap<>();
expected.put(expression, null);
Assert.assertEquals(expected, actual.getExpressionResults());
}
use of org.hl7.fhir.r5.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class CDMMeasureEvaluation method getParameterExtensions.
protected static List<Extension> getParameterExtensions(Measure measure, Context context, Map<String, Parameter> parameterMap) {
Set<String> parameterNames = new HashSet<>();
// Check for special parameters we handle elsewhere
if (context.resolveParameterRef(null, CDMConstants.MEASUREMENT_PERIOD) != null) {
parameterNames.add(CDMConstants.MEASUREMENT_PERIOD);
}
if (context.resolveParameterRef(null, CDMConstants.PRODUCT_LINE) != null) {
parameterNames.add(CDMConstants.PRODUCT_LINE);
}
if (parameterMap != null) {
parameterNames.addAll(parameterMap.keySet());
}
List<Extension> parameterExtensions = measure.getExtensionsByUrl(CDMConstants.MEASURE_PARAMETER_URL);
for (Extension e : parameterExtensions) {
ParameterDefinition parameterDefinition = (ParameterDefinition) e.getValue();
parameterNames.add(parameterDefinition.getName());
}
return parameterNames.stream().map(x -> createParameterExtension(context, x)).filter(Objects::nonNull).collect(Collectors.toList());
}
use of org.hl7.fhir.r5.model.Parameters in project quality-measure-and-cohort-service by Alvearie.
the class CQLToFHIRMeasureReportHelper method getFhirTypeForInterval.
private static IBaseDatatype getFhirTypeForInterval(Interval interval) {
Object low = interval.getLow();
Object high = interval.getHigh();
if (low instanceof DateTime) {
// Handle DateTime conversion to force UTC timezone
Period period = new Period();
period.setStartElement(createDateTimeType((DateTime) low));
period.setEndElement(createDateTimeType((DateTime) high));
return period;
} else if (low instanceof Quantity) {
return converter.toFhirRange(interval);
} else {
logger.warn("Support not implemented for Interval parameters of type {} on a MeasureReport", low.getClass());
return null;
}
}
Aggregations