cqframework / clinical_quality_language

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.
https://confluence.hl7.org/display/CDS/Clinical+Quality+Language
Apache License 2.0
256 stars 120 forks source link

Support direct-reference codes for plural terminology targets #1181

Open brynrhodes opened 1 year ago

brynrhodes commented 1 year ago

The retrieve operation supports both value sets and direct-reference codes as the terminology target for a retrieve. However, if the path for that terminology target results in a multi-cardinality element, value sets work, but direct-reference codes do not, resulting in an error that the terminology target cannot be resolved:

library EncounterTest

using QICore version '4.1.1'

include FHIRHelpers version '4.2.000'

codesystem "Concept Codes": 'http://example.org/fhir/CodeSystem/concept-codes'

valueset "Inpatient Encounters": 'http://hl7.org/fhir/ValueSet/inpatient-encounters'

code "Inpatient": 'inpatient' from "Concept Codes"

context Patient

define "Encounters By ValueSet":
  ["Encounter": "Inpatient Encounters"]

define "Encounters By Code":
  ["Encounter": "Inpatient"]

The issue is that the retrieve would require the following:

define "Encounters By Code":
  ["Encounter"] E
    where exists ((E.type) T where T ~ "Inpatient")

Alternatively, an overload of the equivalent operation:

~(List<Code>, Code)
brynrhodes commented 1 year ago

Note this is related to CQLIT-368. The workaround is to use a ValueSet (i.e. create a value set with the direct-reference code required and use that value set).