Skip to content

Improve handling of boundless and unknown intervals#365

Open
cmoesel wants to merge 2 commits into
masterfrom
boundless-and-unknown-intervals
Open

Improve handling of boundless and unknown intervals#365
cmoesel wants to merge 2 commits into
masterfrom
boundless-and-unknown-intervals

Conversation

@cmoesel
Copy link
Copy Markdown
Member

@cmoesel cmoesel commented May 29, 2026

Add special case logic for boundless intervals (e.g., Interval[null, null]) and unknown intervals (e.g., Interval(null, null)).

When we process an Interval that has both boundaries null, we can't infer the point type since we have no value to infer it from. This caused problems in the existing logic that needs to know the point type for some calculations. To address this, I've added special-case logic for these edge cases since we often don't really need to know the point type to arrive at the correct answer.

I initially tried implementing this by using the point type of the other argument in each operation, but this turned out to be kind of messy and still was not perfect (in particular, it failed tests like Interval[null, null] overlaps Interval[null, null]).

My CQL Long PR introduces the approach of using the resultType from the ELM when we can't easily infer types from the data. We should extend that to also work in these cases, but since we want to get this fix out ASAP, I decided to implement this approach first. We need this approach regardless since ELM does not always carry the resultType.

NOTE: The CI that runs npm audit currently fails, but the reported audit issues are currently not resolvable, so there's not much we can do.

Fixes #364.

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 test:plus to run tests, lint, and prettier)
  • All dependent libraries are appropriately updated or have a corresponding PR related to this change
  • cql4browsers.js built with npm run build:browserify if source changed.

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

cmoesel added 2 commits May 29, 2026 12:28
Add special case logic for boundless intervals (e.g., Interval[null, null]) and  unknown intervals (e.g., Interval(null, null)
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.19298% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.56%. Comparing base (5bc96b7) to head (fd13dd2).

Files with missing lines Patch % Lines
src/datatypes/interval.ts 77.19% 0 Missing and 13 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #365      +/-   ##
==========================================
- Coverage   87.58%   87.56%   -0.02%     
==========================================
  Files          52       52              
  Lines        4606     4658      +52     
  Branches     1297     1331      +34     
==========================================
+ Hits         4034     4079      +45     
+ Misses        359      354       -5     
- Partials      213      225      +12     

☔ View full report in Codecov by Sentry.
📢 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.

@lmd59 lmd59 self-requested a review May 29, 2026 16:56
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.

Incorrect Test Patient Evaluation with Interval[null, null] Overlap

2 participants