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

add monthly patient risk models #627

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

wtyree
Copy link

@wtyree wtyree commented Oct 22, 2024

Describe your changes

This PR modifies existing patient risk models to support monthly cumulative risk scores and adds new monthly risk factors and monthly risk scores models. A new base table cms_hcc__int_monthly_collection_dates was created to provide the monthly scaffolding for all payment years and all collection period ranges. For each payment and collection year, there are collection start and end periods that go from the beginning of the collection year to the end of each month. 2023-01-01 to 2023-01-31, 2023-01-01 to 2023-02-28, and so on. The existing intermediate models were then updated to pass the payment year and collection period end date through each model. There are then final monthly risk factors and risk scores models that maintain that monthly granularity. The existing final models were updated to maintain support for the existing version of the models.

This change enables a few different analyses:

  • A look at how risk is trending for the current collection period.
  • The ability to compare risk progress by month across years. For example, a YoY comparison of how risk is trending.
  • By taking the final collection period for each year, a historical yearly look at patient risk without having to have snapshotted from that point in time.

How has this been tested?

We have tested this on our own Tuva implementation using our patient data. We have confirmed that the cms_hcc__patient_risk_scores are identical in this version.

To see what the YoY comparison might look like, you can use queries like:

select 
    month
    , "2022"
    , "2023"
    , "2024"
    , "2025"
from (
    select 
        payment_year
        , extract(month from collection_end_date) as month
        , normalized_risk_score
    from tuva.cms_hcc.patient_risk_scores_monthly
    ) as risk_scores
    PIVOT(avg(normalized_risk_score) FOR payment_year IN (ANY ORDER BY payment_year))
order by 1
;

One important callout: the adjustment rates end at payment year 2024. I have included some logic to use the max payment year from that file when the year is not available. This is something we use internally to allow us to see how we're progressing this year for payment year 2025. I'm not sure though how Tuva may want this to be handled. You can see an example of this here.

Reviewer focus

How well does this fit into Tuva's plans for this mart? My understanding of risk scores is still developing, have I overlooked anything obvious? In general, I would be willing to use this as a discussion starter if more is needed.

Checklist before requesting a review

  • I have added at least one Github label to this PR (bug, enhancement, breaking change,...)
    • No permissions to do this
  • My code follows style guidelines
    • Dead link
  • (New models) YAML files are categorized by sub folder and models listed in alphabetical order
  • (New models) I have added a config to each new model to enable it for claims and/or clinical data
  • (New models) I have added the variable tuva_last_run to the final output
  • (Optional) I have recorded a Loom to explain this PR

Package release checklist

  • I have updated dbt docs
  • I have updated the version number in the dbt_project.yml

(Optional) Gif of how this PR makes you feel

Loom link

@sarah-tuva sarah-tuva self-requested a review October 31, 2024 16:05
@sarah-tuva sarah-tuva added breaking-change Changes have been made that may cause other components to fail enhancement labels Oct 31, 2024
@sarah-tuva
Copy link
Member

@wtyree this is amazing! I think it looks awesome. I'm running the CI tests now to make sure it works in the other data warehouses we support. I'll be running some tests locally on other datasets to compare results and let you know early next week.

Just for transparency, this will be a breaking change, so we will need to package it with other changes when we're ready for the next minor release.

Thanks again for sharing your enhancements to this data mart! 🙏

This comment was marked as outdated.

Copy link
Member

@sarah-tuva sarah-tuva left a comment

Choose a reason for hiding this comment

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

Hey Wyatt, I need to request a few syntax changes for the other data warehouses we support. I am still testing in Fabric, so I'll submit another review after that. One thing I know we'll have to change is all of the || to concat.

@wtyree
Copy link
Author

wtyree commented Nov 4, 2024

Thanks for the review @sarah-tuva, I'm excited to be able to contribute! I will take a look at the recommendations for making things more generalizable to other data warehouses.

@wtyree
Copy link
Author

wtyree commented Nov 4, 2024

@sarah-tuva I've made the requested changes and learned some things about using dbt in a way that's more portable! Thanks for the feedback. Let me know if there's anything else that I've missed.

@sarah-tuva
Copy link
Member

@sarah-tuva I've made the requested changes and learned some things about using dbt in a way that's more portable! Thanks for the feedback. Let me know if there's anything else that I've missed.

Thanks for making those changes so quickly! I'll re-run the CI tests and finish my validation.

Copy link

github-actions bot commented Nov 5, 2024

Workflow has finished with the following statuses:

  • BigQuery Clinical and Claims: success
  • BigQuery Claims: success
  • BigQuery Clinical: success
  • Fabric Clinical and Claims: success
  • Fabric Claims: success
  • Fabric Clinical: success
  • Redshift Clinical and Claims: success
  • Redshift Claims: success
  • Redshift Clinical: success
  • Snowflake Clinical and Claims: success
  • Snowflake Claims: success
  • Snowflake Clinical: success

Copy link
Member

@sarah-tuva sarah-tuva left a comment

Choose a reason for hiding this comment

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

@wtyree I've completed my validation, and the CI tests are now passing. Thank you so much for your work on this PR and for sharing your enhancements to this data mart! We're really excited to get this merged in. We will bundle this with other breaking changes in the upcoming weeks.

@wtyree
Copy link
Author

wtyree commented Nov 8, 2024

Great! Thanks so much for the review and for the help getting this through. It will certainly be useful for us and I hope it will be useful for others as well.

@aneiderhiser aneiderhiser added the community Label for issues created by community members label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Changes have been made that may cause other components to fail community Label for issues created by community members enhancement
Projects
Status: Ready to Merge
Development

Successfully merging this pull request may close these issues.

3 participants