FirelyTeam / firely-cql-sdk

BSD 3-Clause "New" or "Revised" License
28 stars 16 forks source link

Update CQL Conversion Mapping (Id / FhirString) #466

Closed baseTwo closed 3 weeks ago

baseTwo commented 3 weeks ago

Bug created from this discussion on Slack.

There seems to be a mismatch between the element types in the spec (see diagram) and the fhir model in the sdk.

Image

According to the spec, and Id inherits from FhirString, however this is not the case. They both inherit from the same type: FhirString : PrimitiveType : DataType : Element : ... Id : PrimitiveType : DataType : Element : ...

Note: this applies to all the primitive types on the diagram, they do not go through the intermediate types as on the diagram above! Actual type hierarchy below Image

The generated C# assumes Id can be safely cast to FhirString. (The example below equates to properties, on of type Id and the other of type FhirString). This is not compliable. Image

After discussing with the firely-net-sdk team, they are convinced it is the spec that is incorrect/unclear.

So, the conversion mappings in the ELM-to-C# engine would have to be updated, so that types are converted instead of casted.