Skip to content
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

appliesResult to StratifierResult in detailed results output #308

Merged
merged 9 commits into from
Aug 9, 2024

Conversation

elsaperelli
Copy link
Contributor

Summary

This PR adds an optional attribute to the StratifierResult interface so that we can report the result of a stratifier that includes an appliesTo extension for Patient-based Measures only.

New behavior

The appliesTo extension indicates which population a stratifier should apply to. If it is included on a Measure.group.stratifier, we now report the result of the stratifier AND the result of the population it applies to on the appliesResult attribute on the StratifierResult. The previous result attribute remains as it was: simply the result of the stratifier. The DetailedResults now contain the raw stratifier result in result (like before) as well as the result of the stratifier with the population result it applies to taken into consideration in appliesResult.

Code changes

  • src/calculation/DetailedResultsBuilder.ts - add AND logic of population result and stratifier result to appliesResult attribute of StratifierResults for patient based measures
  • src/types/Calculator.ts - add optional appliesResult attribute to StratifierResult interface
  • test/unit/DetailedResultsBuilder.test.ts - unit tests for described changes

Testing guidance

  • Run detailed results with the measure and patient bundles provided in Calculation for Stratification does not consider associated population #306 . This can be done in a variety of ways but I personally just the cli: npm run cli -- detailed -m <path to mb> --p <path to patient bundle (I think the file they provide is in an array so just make sure to get rid of that)> -s 2025-01-01 -e 2025-12-31 --trust-meta-profile true -o --debug
  • Inspect the detailedResults.json. Make sure the stratifierResults.result are the same as before and the stratifierResults.appliesResult are correct based on the population result that stratifier applies to.

Copy link

github-actions bot commented Aug 5, 2024

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
85.35% (+0.09% 🔼)
2423/2839
🟡 Branches
72.89% (+0.09% 🔼)
2269/3113
🟢 Functions
87.47% (+0.1% 🔼)
433/495
🟢 Lines
85.65% (+0.09% 🔼)
2340/2732
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / MeasureReportBuilder.ts
73.26% (-0.67% 🔻)
54.77% (-1.21% 🔻)
66.67% (-0.98% 🔻)
76.02% (-0.57% 🔻)

Test suite run success

456 tests passing in 31 suites.

Report generated by 🧪jest coverage report action from 8fd71a3

Copy link
Contributor

@lmd59 lmd59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Contributor

@hossenlopp hossenlopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The place where the appliedResult is created needs to be moved to have accurate results.

if (appliesToExtension) {
const popCode = appliesToExtension.valueCodeableConcept?.coding?.[0].code;
if (popCode) {
popValue = patientResults[popCode];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the right place to get the results for population as the patientResults is the raw data from the engine. The define statement that provides the results might not match the code. Should look back at the populationResults that have already been collected and find by populationType.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally the populationResults will not be accurate at this point and should happen after the call to handlePoulationValues on line 35.

const result = isStatementValueTruthy(value);
const appliesResult = isStatementValueTruthy(value && popValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call to isStatementValueTruthy shouldn't be needed as the && should be done on the result and the boolean result found in the populationResults.

Copy link
Contributor

@hossenlopp hossenlopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A handful of things in the new function.

It should also be run on the individual episode results after handlePopulationValues at https://github.com/projecttacoma/fqm-execution/blob/master/src/calculation/DetailedResultsBuilder.ts#L439.

The code in the measure report builder that does appliesTo logic could be removed and the appliedResult could be used instead of the result.

src/calculation/DetailedResultsBuilder.ts Outdated Show resolved Hide resolved
src/calculation/DetailedResultsBuilder.ts Outdated Show resolved Hide resolved
src/calculation/DetailedResultsBuilder.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@hossenlopp hossenlopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Copy link
Contributor

@hossenlopp hossenlopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the Stratification addition to the README. This looks ready to go!

Copy link
Contributor

@lmd59 lmd59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made one optional test description clarification

Co-authored-by: lmd59 <laurend@mitre.org>
@elsaperelli elsaperelli merged commit b0241d9 into master Aug 9, 2024
6 checks passed
@elsaperelli elsaperelli deleted the detailed-stratifiers branch August 9, 2024 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants