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
267 stars 123 forks source link

Ambiguous type reference is not throwing an error #1388

Open brynrhodes opened 4 months ago

brynrhodes commented 4 months ago

When two models have a type with the same unqualified name, and that name is referenced in CQL logic, the specification indicates that an ambiguous error should be raised:

library Test version '1.0.0'

using FHIR version '4.0.1'
using System version '1.0.0'

define function f(q Quantity): q

Specification link: https://cql.hl7.org/03-developersguide.html#multiple-data-models

There is a nuance that if the ambiguity is with the System model, and the System model declaration is implicit, the explicit model is preferred. However, if the system model declaration is explicit, this should be an error. (JIRA tracker to document this nuance: https://jira.hl7.org/browse/FHIR-46435)

So the following library is fine:

library Test version '1.0.0'

using FHIR version '4.0.1'

define function f(q Quantity): q

But the first one should give an ambiguous type reference.