cqframework / cqf-tooling

Tooling for CQL and IG Authors
Apache License 2.0
19 stars 22 forks source link

ModelInfo generation issues #392

Closed brynrhodes closed 1 year ago

brynrhodes commented 2 years ago

ModelInfo generation for QICore 4.1.1 incorrectly infers cardinality of Encounter.diagnosis, and does not produce any elements for the ProcedureNotDone class.

brynrhodes commented 2 years ago

The issue is that because the elements have extensions defined, the generator is trying to add the extension elements as first-class elements to the types. In the case of primitive types, or constructed types (like choice, interval), the generator cannot construct a new derived class to support the new elements, and so it fails (by design). In the case of extension elements being added to types that are already derived, the replacement of the type on the already constructed ClassInfoElement ignores the cardinality, effectively resetting the ListTypeSpecifier to a NamedTypeSpecifier.

The fix for the extensions on primitives and constructed types is to issue a warning that the slice is being ignored and just drop it. This will need to be addressed another way, perhaps with a qualified element on the parent class? (i.e. performed_dataAbsentReason) although this would be a challenge with plural elements.

The fix for the derived types is just to make sure that if the existing element is a listTypeSpecifier, replace the element type of the listTypeSpecifier, rather than the typeSpecifier directly.

brynrhodes commented 1 year ago

Included in 2.4.0 release