projecttacoma / fqm-execution

fqm-execution is a library that allows users to calculate FHIR-based electronic Clinical Quality Measures (eCQMs) and retrieve the results in a variety of formats
https://projecttacoma.github.io/fqm-execution/
Apache License 2.0
17 stars 6 forks source link

Check if dataRequirement resourceType does not have patient search params #289

Closed elsaperelli closed 8 months ago

elsaperelli commented 8 months ago

Summary

We found an issue when running dataRequirements with CMS68. It will error out with the Task resource on CMS68 since the Task resource type is in the compartment definition, but does not have any search parameters so it is not included in PatientParameters.ts (the file that is a result of running the parseCompartmentDefiniton.js script in the deqm-test-server repo). Now, running dataRequirements on this measure no longer errors out.

New behavior

Now, we only do a .forEach on the indexed content of PatientParameters for a resourceType if that resourceType exists in PatientParameters.

Code changes

Testing guidance

QUESTION: Should we be adding an extension to dataRequirements whose resourceType is not in PatientParameters.ts? I tried looking into the spec for fhirQueryPattern but wasn't sure...

github-actions[bot] commented 8 months ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟒 Statements 86.37% 2369/2743
🟑 Branches
73.68% (+0% πŸ”Ό)
2197/2982
🟒 Functions 88.89% 424/477
🟒 Lines 86.7% 2289/2640
Show files with reduced coverage πŸ”»
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------- | :--------- | :------------------------------------------------------------- | :-------- | :----- | | 🟒 |
`...` / DataRequirementHelpers.ts
| 85.03% |
80.31% (-0.11% πŸ”»)
| 78.57% | 85.71% |

Test suite run success

449 tests passing in 31 suites.

Report generated by πŸ§ͺjest coverage report action from 8f0c58d32c44e523fd912386602e688568051318

elsaperelli commented 8 months ago

patient compartment definition

This all made sense to me until I looked at the compartment definiton for a patient...it looks like Task is included? It was in the compartmentdefinition-patient.json in deqm-test-server, but didn't have any params so it was not added to PatientParameters.ts. But now I am confused because https://build.fhir.org/compartmentdefinition-patient.json.html shows Task not only included in the definition but it also has two params, "patient" and "focus". This leads me to believe that this PR's fix is actually not correct, and that the correct solution is parsing this seemingly new patient compartment definition? Maybe we can also ask @hossenlopp about this.

elsaperelli commented 8 months ago

patient compartment definition

This all made sense to me until I looked at the compartment definiton for a patient...it looks like Task is included? It was in the compartmentdefinition-patient.json in deqm-test-server, but didn't have any params so it was not added to PatientParameters.ts. But now I am confused because https://build.fhir.org/compartmentdefinition-patient.json.html shows Task not only included in the definition but it also has two params, "patient" and "focus". This leads me to believe that this PR's fix is actually not correct, and that the correct solution is parsing this seemingly new patient compartment definition? Maybe we can also ask @hossenlopp about this.

Update: It seems like Task was not in the patient compartment definition in R4 (hence why it wasn't in deqm-test-server or PatientParameters.ts) but it is in R5...so perhaps an update to the compartment definition and parsing needs to be done.

sarahmcdougall commented 8 months ago

Looks like our version of the compartment definition in deqm-test-server is from 2019, so it makes sense that recent versions have additional resources. Not sure if we want to take the jump to R5 yet, but I did notice a version from 2022 that we might be able to use to get us up to date? https://hl7.org/fhir/R4B/compartmentdefinition-patient.json.html