Skip to content

CQL 2.0 Miscellaneous new functions - #389

Draft
dehall wants to merge 3 commits into
masterfrom
misc_functions
Draft

dehall wants to merge 3 commits into
masterfrom
misc_functions

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 two of the miscellaneous new functions in CQL 2.0, Round(Quantity) and MatchesFull.

In implementing MatchesFull I noticed our existing implementation of Matches was already doing a full-string match, so essentially this change renames our old Matches as the new MatchesFull and re-implements Matches as a partial string match (but still allowing a full string match if the user puts the ^ and $ into the regex on their own).
Note the 1.5.3 spec already specified this should be partial-string matching so that was a bug https://cql.hl7.org/N1A/09-b-cqlreference.html#matches

Note that the CQL 2.0 changes list Slice as a new function, but behind the scenes the Slice ELM expression is what's used for the existing Skip, Tail, and Take CQL functions, so there's nothing new needed on our side to support the new function once the translator supports it.

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. Each function was added in its own commit so we can cherry-pick onto a separate PR if one feature is added before another in the translator and we want to get them in.

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

codecov-commenter commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #389      +/-   ##
==========================================
+ Coverage   89.19%   89.21%   +0.01%     
==========================================
  Files          60       60              
  Lines        5064     5073       +9     
  Branches     1446     1448       +2     
==========================================
+ Hits         4517     4526       +9     
  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.

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