firely-cql-sdk icon indicating copy to clipboard operation
firely-cql-sdk copied to clipboard

Fix incorrect "value" property type on bound elements in QICore

Open ewoutkramer opened this issue 5 months ago • 0 comments

We need to report a bug to the tracker for the Java cql2elm stack about the handling of getting the property "value" of a bound element. When using FHIR, getting to the value of a bound property produces the following ELM:

{
    "resultTypeName" : "{urn:hl7-org:elm-types:r1}String",
    "path" : "value",
    "type" : "Property",
    "source" : {
            "resultTypeName" : "{http://hl7.org/fhir}UnitsOfTime",
            "path" : "periodUnit",
            "type" : "Property" 
             // other stuff left out here
    }
}

This is from our FHIRed version of CumulativeMedicationDuration, which does not use QICore but FHIR instead. Note how the type of the bound property is the name of the binding ({http://hl7.org/fhir}UnitsOfTime), and the type of the value property is a String.

When the same property access is done through QICore (again from CumulativeMedicationDuration), we see a different translation to ELM:

{
    "resultTypeName" : "{http://hl7.org/fhir}UnitsOfTime",
    "path" : "value",
    "type" : "Property",
    "source" : {
        "path" : "periodUnit",
        "type" : "Property",
    }
}

Now, the access to periodUnit has no type, and the type of the value property is the type of the binding (UnitsOfTime). I think this is wrong, under the assumption that, after the profiled QICore constructs have been erased by the Java cql2elm compiler, the ELM should be exactly the same.

For now, our ELM preprocessor corrects for this specific binding and property access, but the Java cql2elm compiler should be fixed so we can remove that correction.

ewoutkramer avatar Sep 03 '24 08:09 ewoutkramer