Skip to content

Conversation

@lmd59
Copy link
Contributor

@lmd59 lmd59 commented Aug 12, 2025

Addresses #226 by creating a new type (CQLValueSet) that aligns with the CQL 1.5 specification defined ValueSet type.
Note: This type naming is currently CQLValueSet so as not to change the interface of ValueSet, but this is intended to be a temporary decision that should be updated for the next major update. At the next major update, change CQLValueSet -> ValueSet and ValueSet -> ValueSetExpansion.

This PR shifts valueset resolution to the point that it is required, such as when hasMatch or expand is called. It does not cache valueset expansions in the context and leaves valueset caching up to the code service. This includes an update to equivalence that only expands valuesets to check matching codes if the valuesets do not have an exact match of id/version. The PR also adds a consistent error if passed valuesets are not able to be resolved by the code service.

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.

~ Code coverage has not gone down, but not all added/touched code is covered as code lines represent unlikely cases that would be difficult to test.

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

codecov-commenter commented Aug 12, 2025

Codecov Report

❌ Patch coverage is 94.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.55%. Comparing base (9672631) to head (65cc22f).

Files with missing lines Patch % Lines
src/datatypes/clinical.ts 92.30% 1 Missing ⚠️
src/elm/clinical.ts 93.75% 0 Missing and 1 partial ⚠️
src/elm/external.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #349      +/-   ##
==========================================
+ Coverage   87.47%   87.55%   +0.08%     
==========================================
  Files          52       52              
  Lines        4566     4596      +30     
  Branches     1291     1295       +4     
==========================================
+ Hits         3994     4024      +30     
- Misses        358      359       +1     
+ Partials      214      213       -1     

☔ 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.

@hossenlopp hossenlopp self-requested a review August 13, 2025 21:38
@hossenlopp hossenlopp self-assigned this Aug 13, 2025
@lmd59 lmd59 marked this pull request as ready for review August 14, 2025 02:07
elsaperelli and others added 14 commits August 14, 2025 08:04
- Add libraryName to CodeSystemRef
- Update Library to resolve CodeSystems in other libraries
- Fix bug that put included library codesystems into the main library
- Fix bug that returned wrong value set when main library and included library had value sets with same name
- Add tests for resolving value sets from included libraries
Create internal vs class

Export correct types and delay expansion of vs
@elsaperelli elsaperelli self-requested a review August 14, 2025 14:18
@elsaperelli elsaperelli self-assigned this Aug 14, 2025
Copy link
Contributor

@hossenlopp hossenlopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass review. I mainly looked from the aspect of the change in code coverage. Found a few things worth changing and others worth discussing.

Copy link
Contributor

@elsaperelli elsaperelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments/questions for now but looks good!

@elsaperelli elsaperelli requested a review from hossenlopp August 18, 2025 14:18
@elsaperelli elsaperelli self-requested a review August 18, 2025 14:18
Copy link
Contributor

@hossenlopp hossenlopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a few more suggestions on tests.

Copy link
Contributor

@elsaperelli elsaperelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm! 🥳

lmd59 and others added 2 commits August 18, 2025 14:17
@lmd59 lmd59 requested review from cmoesel and elsaperelli August 18, 2025 18:43
@hossenlopp hossenlopp self-requested a review August 18, 2025 19:38
Copy link
Member

@cmoesel cmoesel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work, @lmd59 -- and great reviews, @hossenlopp and @elsaperelli!

I left one tiny comment about a test that I think could be improved, but I wouldn't let it hold up this PR from being merged. So... if @lmd59 has time to address it, great! Let's do that! But if she doesn't has time, then LGTM!

const vs = await this['unknown Three Arg'].exec(this.ctx);
vs.id.should.equal('1.2.3.4.5.6.7.8.9');
vs.version.should.equal('1');
vs.codesystems.length.should.equal(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we should check that the codesystem we get is the one we expect (instead of just checking that the codesystems array is length 1).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this test and the one below it in 65cc22f.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect. Thank you!

@hossenlopp hossenlopp requested a review from cmoesel August 19, 2025 20:01
@cmoesel cmoesel merged commit ab321f4 into master Aug 19, 2025
8 checks passed
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.

6 participants