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

DRY extraction of measure for calculation #216

Closed sarahmcdougall closed 1 year ago

sarahmcdougall commented 1 year ago

Summary

Code refactors related to measure extraction for the calculate function and its helpers.

New behavior

Main motivation: Future work related to composite measure calculation will require looping over component measures and calling various helpers on each component measure. Therefore, we want to limit the amount of code duplication related to measure extraction since we will want to specify the measure outside the helper functions when looping over the components rather than doing a .find() for the first measure in the given bundle every time.

No new behavior should be introduced.

Code changes

Some context behind these changes:

Testing guidance

github-actions[bot] commented 1 year ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟒 Statements
85.26% (-0% πŸ”»)
1995/2340
🟑 Branches
73.9% (-0.01% πŸ”»)
1767/2391
🟒 Functions
87.34% (-0.03% πŸ”»)
352/403
🟒 Lines
85.56% (+0.01% πŸ”Ό)
1926/2251
Show files with reduced coverage πŸ”»
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------- | :------------------------------------------------------------- | :------- | :-------- | :------------------------------------------------------------- | | 🟒 |
`...` / ELMInfoCache.ts
|
78.38% (-0.57% πŸ”»)
| 43.9% | 71.43% |
80.56% (-0.53% πŸ”»)
|

Test suite run success

371 tests passing in 28 suites.

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

sarahmcdougall commented 1 year ago
  1. I know you were more focused on detailedResults for this task, so it is okay if you don't want to add this but I think you can eliminate a call to extractMeasureFromBundle in calculateDataRequirements with the following:

Yeah I saw this too but figured it's out of scope. But it's an easy fix so I'll add it

  1. Also potentially not in the scope of the task and I didn't look into it too much, but I think it may be possible to make the constructor in MeasureReportBuilder take measure rather than MeasureBundle. I think this would eliminate a call to extractMeasureFromBundle in calculateGapsInCare.

Also saw this and figured it's out of scope for now. I don't want to mess with anything related to measure reports until we get detailed results working for composite measures, and it will cause a good deal of unit test fixes.