cqframework / cqframework/cqf-tooling

ModelInfo for observation-bp status binding is ambiguous

Open
#518 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
22
Forks
26
PR merge metrics
No merged PRs in 30d

Description

In profile-informed models, the mapping layer is intended to map all references to elements in profiles down to their base FHIR equivalents. In the case of a binding, the use of the element-binding-name extension is causing an ambiguity because the profile is overriding the element-binding-name. Specifically, for observation-bp, the status binding renames the base ObservationStatus to Status, resulting in an ambiguous type name.

Given the following expression (from https://github.com/cqframework/ecqm-content-qicore-2024/blob/main/input/cql/Status.cql#194):

define function "BloodPressure"(Obs List<"QICore.observation-bp">):
  Obs O
    where O.status in { 'final', 'amended', 'corrected' }

The ELM output is:

 "operand" : [ {
                     "locator" : "195:11-195:18",
                     "resultTypeName" : "{http://hl7.org/fhir}Status",
                     "path" : "value",
                     "type" : "Property",
                     "source" : {
                        "path" : "status",
                        "scope" : "O",
                        "type" : "Property"
                     }
                  },

As we can see, this refers to a FHIR binding {http://hl7.org/fhir}Status. This binding can indeed be found in the FHIR specification, but is used for VerificationResult.status. Since the CQL here is referring to Observation.status (for which the binding name is {http://hl7.org/fhir}ObservationStatus), our ELM->C# compiler reports a type error.

This is due to the elementdefinition-bindingname extension that appears on the binding of the status element in the profile (https://hl7.org/fhir/bp.profile.xml.html):

      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="Status"/>
        </extension>
        <strength value="required"/>
        <valueSet value="http://hl7.org/fhir/ValueSet/observation-status"/>
      </binding>

The fix is most likely to use the elementdefinition-bindingname from the base resource definition, rather than the name of the binding in the profile.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the mapping layer that resolves FHIR element binding names, starting with handling of the elementdefinition-bindingName extension and the ELM resultTypeName shown for Observation.status. Compare the profile and base-resource definitions; done means the observation-bp expression resolves to ObservationStatus rather than the ambiguous Status and the ELM-to-C# type error is gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.