Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backwards compatibility issues with terminology references #707

Closed
brynrhodes opened this issue Dec 22, 2021 · 2 comments
Closed

Backwards compatibility issues with terminology references #707

brynrhodes opened this issue Dec 22, 2021 · 2 comments
Assignees
Labels
bug cql The issue relates to or requires a change or clarification on the CQL specification enhancement
Milestone

Comments

@brynrhodes
Copy link
Member

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>.

@brynrhodes brynrhodes self-assigned this Dec 22, 2021
@brynrhodes brynrhodes added the bug label Dec 22, 2021
@brynrhodes brynrhodes added this to the Maintenance milestone Dec 22, 2021
brynrhodes added a commit that referenced this issue Dec 30, 2021
…4 and the new terminology types:

1. In 1.4 compatibility mode, a reference to a `codesystem` or `valueset` declaration is typed as a `List<Code>`, rather than the `ValueSet` or `CodeSystem` types introduced in 1.5.
2. In 1.4 compatibility mode, references to the new terminology types results in a compile-time error.
3. In 1.4 compatibility mode, terminology membership operators can only be resolved with references to `codesystem` or `valueset` declarations
4. In 1.5 or greater, a `ValueSetRef` will be output with the new `preserve` attribute set to true.

For a more detailed discussion, see https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Implementing-the-CQL-1.5-Terminology-Types
@brynrhodes brynrhodes added cql The issue relates to or requires a change or clarification on the CQL specification enhancement labels Dec 30, 2021
@brynrhodes
Copy link
Member Author

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

brynrhodes added a commit that referenced this issue Dec 30, 2021
…patibility

#707: Fixed several issues related to backwards compatibility with 1.…
@brynrhodes
Copy link
Member Author

Included in 1.5.6 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cql The issue relates to or requires a change or clarification on the CQL specification enhancement
Projects
None yet
Development

No branches or pull requests

1 participant