cql-execution
cql-execution copied to clipboard
Cache function ref
This is primarily a performance enhancement. When function use is defined within a Query, every iteration of elements in the where clause caused a re-evaluation of finding the correct FunctionDef to use. When there are a large number of items to go through this becomes a very expensive process, mainly due to the type comparisons that are used to perform the FunctionDef lookups.
This PR implements caching of the FunctionDef look ups with a FunctionRef the first time it is executed.
Note that this PR also contains updates to 3 node modules that were not passing audit tests Pull requests into cql-execution require the following. Submitter and reviewer should ✔ when done. For items that are not-applicable, mark "N/A" and ✔.
This is primarily a performance enhancement. When function use is defined within a Query, every iteration of elements in the where clause caused a re-evaluation of finding the correct FunctionDef to use. When there are a large number of items to go through this becomes a very expensive process, mainly due to the type comparisons that are used to perform the FunctionDef lookups.
This PR implements caching of the FunctionDef look ups with a FunctionRef the first time it is executed.
Note that this PR also contains updates to 3 node modules that were not passing audit tests 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:
- [x] This pull request describes why these changes were made
- [x] 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
- [x] Tests have been run locally and pass
- [x] Code coverage has not gone down and all code touched or added is covered.
- [x] Code passes lint and prettier (hint: use
npm run test:plusto run tests, lint, and prettier) - [x] All dependent libraries are appropriately updated or have a corresponding PR related to this change
- [x]
cql4browsers.jsbuilt withnpm run build:browserifyif 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
Codecov Report
Attention: Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
Project coverage is 87.06%. Comparing base (
2cd244c) to head (befc506).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/elm/reusable.ts | 77.77% | 3 Missing and 1 partial :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #326 +/- ##
==========================================
+ Coverage 87.04% 87.06% +0.02%
==========================================
Files 52 52
Lines 4517 4524 +7
Branches 1273 1275 +2
==========================================
+ Hits 3932 3939 +7
Misses 377 377
Partials 208 208
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I'll also note that the npm audit is unresolvable because the vulnerable module has not yet released a patch.
@rdingwell - I got to run a FQM regression on this using the updated FQM regression script in fqm-regression#321. The changes in this branch did fail regression. They don't affect the "statement results" but do affect the "clause results" -- and it seems to all be related to calls to FHIRHelpers.ToInterval. I'm not familiar enough w/ FQM or the regression script to make much sense of it or determine if it really is a problem or not, but... I thought I'd let you know.
If you're interested, here is an example:
- Measure CQL: EXM125-7.3.000.cql
- Measure Library: library-EXM125-7.3.000.json
- Test Patients: EXM125-7.3.000 tests
- Results w/ master: results-tests-denom-EXM125-bundle.json, results-tests-numer-EXM125-bundle.json
- Results w/ cache_function_ref: results-tests-denom-EXM125-bundle.json, results-tests-numer-EXM125-bundle.json
- Diff of results: EXM125-results-diff.html.zip (zipped because GitHub doesn't support attaching .html files)
I know you said you were going to rework this PR -- so let me know if/when you want me to run regression again.