Skip to content

DataRequirementsProcessor produces duplicate cqf-logicDefinition extensions #1738

@c-schuler

Description

@c-schuler

The DataRequirementsProcessor.gatherDataRequirements() method can produce duplicate cqf-logicDefinition extensions on the returned module definition Library when the same CQL definition is reachable through multiple include paths in the library dependency graph.

For example, a Measure whose primary library includes libraries that share common dependencies (diamond dependency pattern) results in the same definition appearing multiple times in the output. The duplicates are identical in libraryName, name, and statement — only the displaySequence differs.

Observed on a Measure with 8 duplicated definitions (6 from the primary library, 2 FHIRHelpers definitions from a shared dependency). The ElmRequirements.collapse() method deduplicates at the requirements level using a libraryIdentifier.id + definitionName key, but duplicates are still present in the final extensions produced by extractLogicDefinitions().

A workaround has been applied in cqf-tooling (cqframework/cqf-tooling#594) to deduplicate by (libraryName, name) before using the returned Library, but ideally the DataRequirementsProcessor should not produce duplicates in the first place.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions