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
18 stars 6 forks source link

Fix ratio function reuse numer only #199

Closed elsaperelli closed 1 year ago

elsaperelli commented 1 year ago

Summary

Fixes #187 This pull request (by @hossenlopp) fixes the bug in #187. Fixes ratio, episode-based measure observation results, for same function, not appearing correctly. Now, we ensure that observations are not nulled out by finding the populationResult whose criteriaExpression matches the desiredPopulation criteriaExpression AND whose populationId matches the desiredPopulation id.

New behavior

Before, in getObservationResultForPopulation() in MeasureBundleHelpers.ts, we found the populationResult of the measure observation that references the desired population in its criteria reference by doing a .find on populationResults and looking for the result whose criteriaExpression matched the criteriaExpression of the desiredObservation. In cases where populationResults had the same criteriaExpression, this could lead to issues because the .find would result in returning the first result that had a matching criteriaExpression. In order to fix this, we added a check to the .find to ensure that the population id of the population result matched the population id of the desired observation. If the populationId does not exist in the population results, then true is returned.

Code changes

Testing guidance

github-actions[bot] commented 1 year ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟒 Statements 85.01% 1990/2341
🟑 Branches
73.68% (+0.02% πŸ”Ό)
1755/2382
🟒 Functions 87.1% 351/403
🟒 Lines
85.3% (+0.01% πŸ”Ό)
1920/2251
Show files with reduced coverage πŸ”»
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------- | :--------- | :------------------------------------------------------------- | :-------- | :------------------------------------------------------------- | | 🟒 |
`...` / MeasureBundleHelpers.ts
| 98.74% |
91.57% (-0.19% πŸ”»)
| 100% |
98.64% (+0.01% πŸ”Ό)
|

Test suite run success

364 tests passing in 28 suites.

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