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
266 stars 122 forks source link

Support for CQL manipulating BackboneElement types #1253

Open JPercival opened 1 year ago

JPercival commented 1 year ago

Not sure if this is still an issue. Please just close if the issue is resolved/fixed...

In CQL, we want to be able to return BackboneElement and child element types from (at least) functions. For example:

define function "MedicationRequestResource"(medicationRequest MedicationRequest, profileURLs List<FHIR.canonical>):
  medicationRequest m
  return MedicationRequest{
    id: FHIR.id {value: 'LCR-' + m.id},
    meta: MetaElement(medicationRequest, profileURLs),
    dosageInstruction: DosageInstructionElement(m.dosageInstruction),
    dispenseRequest: DispenseRequestElement(m.dispenseRequest)
  }

define function "DosageInstructionElement"(dosageInstruction Dosage):
  return Dosage {
    ...
  }

define function "DispenseRequestElement"(dispenseRequest BackboneElement):
  return BackboneElement {
    dispenseInterval: ...
    validityPeriod: ...
  }

Last I heard, there were issues dealing with these types of child elements and backbone elements.

JPercival commented 1 year ago

BackboneElements are generally abstract types in the FHIR spec, and are declared implicitly as part of an overall Resource definition. IOW, it's probably not valid to work with BackboneElement directly. I'll do a bit more research on this.