Closed elsaperelli closed 1 year ago
St.:grey_question: |
Category | Percentage | Covered / Total |
---|---|---|---|
π’ | Statements | 86.42% (+0.01% πΌ) |
2202/2548 |
π‘ | Branches | 75.18% (+0.14% πΌ) |
2014/2679 |
π’ | Functions | 88.77% (-0.15% π») |
403/454 |
π’ | Lines | 86.75% (+0.01% πΌ) |
2127/2452 |
409 tests passing in 31 suites.
Report generated by π§ͺjest coverage report action from 97b6a4ad2ae27559cc331cb6b3af237bb42a7a9b
Summary
This PR adds support for calculating measure reports for composite measures with the
weighted
scoring type. More information regarding the component-levelweighted
scoring type can be found here.New behavior
Before, if you tried to build a measure report from a composite measure with scoring type
weighted
, you got the following error:"Weighted scoring not implemented for composite measures"
. Now, you can build a measure report from a composite measure with scoring typeweighted
!Code changes
CompositeReportBuilder.ts
- newaddResults
function that handlesweighted
scoring as well asweightedComponents
property that keeps track of each component in the composite measure and its associated weight. Per the spec, if a weight extension does not exist, then the weight is treated as 1.AbstractMeasureReportBuilder.ts
- newaddResults
abstract function.Calculator.ts
-addResults
is now called so thatweighted
scoring composite measures can be handled.CompositeReportBuilder.test.ts
/simple-composite-measure-weighted-scoring.json
- added a quick unit test that checks the measure report for a composite measure withweighted
scoring type in two examples: one where weight is defined through an extension and one where no weight is defined so it is assumed to be 1.MeasureReportBuilder.addSDE.test.ts
/MeasureReportBuilder.test.ts
- updated other unit tests to handle abstract class changes.Code change explanations
all-or-nothing
,opportunity
,linear
, andweighted
. The first three areindividual-based
scoring methods that are already implemented in theCompositeReportBuilder.ts
addPatientResults
method. I could not add theweighted
scoring calculation to that method because that method goes through individual patient results, but forweighted
I need to keep track the results of each component. Therefore, I decided to add a method to theAbstractMeasureReportBuilder
classaddResults
that goes through all of the patient results. InMeasureReportBuilder.ts
, this method simply callsaddPatientResults
in a loop, but inCompositeReportBuilder.ts
, it goes through all of the patient results and for each component increments the numerator or denominator count.Testing guidance
npm run check
- make sure unit tests pass and there are no lint errors.npm run test:integration
- make sure integration tests still pass.tests/integration/composite-all-or-nothing/composite-all-or-nothing-bundle.json
to have scoring type beweighted
and also adding cqfm-weight extension to the related artifacts. Let me know if you want an example!npm run cli -- reports -m test/integration/composite-all-or-nothing/composite-weighted.json --patients-directory test/integration/composite-all-or-nothing/patients -s 2023-01-01 -e 2023-12-31 --report-type "summary"