Clinical Quality Language (CQL) is an HL7 specification for the expression of clinical knowledge that can be used within both the Clinical Decision Support (CDS) and Clinical Quality Measurement (CQM) domains. This repository contains complementary tooling in support of that specification.
CQL 1.5 introduced support for terminology types to allow references to terminology to be passed as arguments, rather than forcing an expand whenever a value set or code system is referenced. This capability is backwards-compatible, but there are cases where the translator is not accounting for the new capability correctly, resulting in errors when translating CQL that makes use of value set references as arguments to functions.
The following library illustrates this issue:
library TestVSCastFunction
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'
valueset "Narcolepsy": 'https://www.ncqa.org/fhir/valueset/2.16.840.1.113883.3.464.1004.1182'
define function "VS Cast Function"(VSet List<System.Code>):
( ( cast { "VSet", 1 }[0]as Tuple {
codes List<System.Code>,
oid System.String,
version System.String
}
).codes ) VSetCodes
return System.Code { code: VSetCodes.code, system: VSetCodes.system }
define function "Conditions in ValueSet"(conditions List<Condition>, codes List<System.Code>):
conditions C
where FHIRHelpers.ToConcept(C.code) in codes
define TestConditions:
[Condition] C
where C.code in "Narcolepsy"
define TestConditionsViaFunction:
"Conditions in ValueSet"([Condition], "VS Cast Function"("Narcolepsy"))
define TestConditionsDirectly:
"Conditions in ValueSet"([Condition], "Narcolepsy")
Specifically, in 1.5, the invocation signature of the value set references is ValueSet, whereas in 1.4 it is list<System.Code>.
Some of these changes impact trial-use aspects of the CQL and ELM specifications, An HL7 Jira tracker has been submitted to address those changes: FHIR-34804
CQL 1.5 introduced support for terminology types to allow references to terminology to be passed as arguments, rather than forcing an expand whenever a value set or code system is referenced. This capability is backwards-compatible, but there are cases where the translator is not accounting for the new capability correctly, resulting in errors when translating CQL that makes use of value set references as arguments to functions.
The following library illustrates this issue:
Specifically, in 1.5, the invocation signature of the value set references is
ValueSet
, whereas in 1.4 it islist<System.Code>
.