Skip to content

Implement CQL 2.0 EquivalentContains/EquivalentIn for Lists - #388

Draft
dehall wants to merge 1 commit into
masterfrom
equivalentcontains
Draft

dehall wants to merge 1 commit into
masterfrom
equivalentcontains

Conversation

@dehall

@dehall dehall commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

DRAFT because these features are not supported in the translator yet. Do not merge this until the translator is updated and we confirm these work with real ELM.

This PR adds support for the standalone EquivalentContains and EquivalentIn operators introduced in CQL 2.0: https://cql.hl7.org/v2.0-changelog.html#equivalent-contains

Note that while the ~contains and ~in operators are defined for CodeSystems and ValueSets as well, those translate into the existing InValueSet/InCodeSystem* ELM expressions, see the translation semantics page: https://cql.hl7.org/06-translationsemantics.html#clinical-operators-2 . So this PR is ~contains and ~in for Lists only.
* = Note even though the InCodeSystem expression is recognized in cql-execution today, we don't actually support checking whether a code is in a CodeSystem, that would require nontrivial terminology support (#289) which isn't implemented here.

Support for the ~contains and ~in in the codeComparator of a Retrieve will be a separate PR a) because there's minimal overlap in implementation between these operators and the codeComparators, and b) so that if the translator supports one before the other we can merge the relevant PR without waiting for the rest.

The ELM in this PR was manually modified to get the appropriate expressions in place, so run npm test and not npm run check for now.

Pull requests into cql-execution require the following.
Submitter and reviewer should ✔ when done.
For items that are not-applicable, mark "N/A" and ✔.

Submitter:

  • This pull request describes why these changes were made
  • Code diff has been done and been reviewed (it does not contain: additional white space, not applicable code changes, debug statements, etc.)
  • Tests are included and test edge cases
  • Tests have been run locally and pass
  • Code coverage has not gone down and all code touched or added is covered.
  • Code passes lint and prettier (hint: use npm run check to run tests, lint, and prettier)
  • All dependent libraries are appropriately updated or have a corresponding PR related to this change
    Reviewer:

Name:

  • Code is maintainable and reusable, reuses existing code and infrastructure where appropriate, and accomplishes the task’s purpose
  • The tests appropriately test the new code, including edge cases
  • You have tried to break the code

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.22%. Comparing base (e8096c6) to head (cd82f03).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #388      +/-   ##
==========================================
+ Coverage   89.19%   89.22%   +0.02%     
==========================================
  Files          60       60              
  Lines        5064     5078      +14     
  Branches     1446     1448       +2     
==========================================
+ Hits         4517     4531      +14     
  Misses        315      315              
  Partials      232      232              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dehall

dehall commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Update: the CQL operator -> ELM expression mapping in the translator semantics page that I mentioned above might be incorrect, since there are also new ELM expressions mentioned in the Logical Spec that seem like they were intended to be what these new operators map to. If that's the case then there's more work needed here. See https://jira.hl7.org/browse/FHIR-59703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants