Library $evaluate unable to handle returned sets
Problem:
When running Library $evaluate for specific expression return types it appears that the operation is unable to render the results into a FHIR parameter component.
This is a problem because the operation is fully unusable without these types of scenarios.
example CQL:
define "Related Encounters":
from
[Encounter] Encounter,
[Condition] Pregnancy
where AC.ActiveDiagnosisPeriod(Encounter, Condition) overlaps Encounter.period
and AgeInYearsAt(start of Encounter.period) between 14 and 50
return { condition: Condition, ed: Encounter }
Error returned when evaluating CQL with this type of expression within it:
{
"resourceType": "Parameters",
"parameter": [
{
"name": "evaluation error",
"resource": {
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "error",
"code": "exception",
"diagnostics": "unknown type when trying to convert to parameters: ParametersParameterComponent"
}
]
}
}
]
}
Scope:
Allow the output of sets of resources like the example above to populate in a parameter component. Choose a format that would indicate the expression the result is sourced from and the alias related to the displayed result
CQL is able to represent a broader of set of types than FHIR (since CQL is not FHIR-specific). The Using CQL with FHIR IG specifies the set of types that can be used in FHIR-based CQL (and, transitively, with operations such as $evaluate):
https://build.fhir.org/ig/HL7/cql-ig/conformance.html#conformance-requirement-4-3
Essentially, even though you can write the CQL above it's not valid for FHIR use-cases.
IOW, this is something to take up as standards feedback.