-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache function ref #326
base: master
Are you sure you want to change the base?
Cache function ref #326
Conversation
The npx codecov script is deprecated, so use the GitHub action instead.
Codecov ReportAttention: Patch coverage is
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 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only concern with this approach was caching the resolved function for reuse across iterations, but I can't think of a use case where different iterations of the same FunctionRef would result in different function resolutions. I tried to force it with CQL like this:
define function ValueAsString(value FHIR.CodeableConcept):
Coalesce(value.text.value, value.coding[0].display.value, value.coding[0].code.value, 'unknown')
define function ValueAsString(value FHIR.Quantity):
ToString(value.value.value) + ' ' + Coalesce(value.unit.value, value.code.value)
define PatienObservationsAsStrings:
[Observation] O return ValueAsString(O.value as Choice<FHIR.CodeableConcept, FHIR.Quantity>)
but the CQL-to-ELM compiler doesn't allow it because the function invocation is ambiguous. You have to do something like this, which results in two independency FunctionRefs:
define PatienObservationsAsStrings:
[Observation] O return
case
when O.value is FHIR.CodeableConcept then ValueAsString(O.value as FHIR.CodeableConcept)
when O.value is FHIR.Quantity then ValueAsString(O.value as FHIR.Quantity)
else 'unsupported'
end
All that to say, I think this is safe and it appears to work. Still, I'd like for the FLAME team to have a chance to review and possibly regress it against their measures. @hossenlopp - do you agree that your team should review and regress this?
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 If you're interested, here is an example:
I know you said you were going to rework this PR -- so let me know if/when you want me to run regression again. |
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:
npm run test:plus
to run tests, lint, and prettier)cql4browsers.js
built withnpm run build:browserify
if source changed.Reviewer:
Name: