-
Notifications
You must be signed in to change notification settings - Fork 31
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
CMS HCC Payment Risk Score Weighting by Member Months #453
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pfehlinger, I'm sorry for the delayed review while I was out on PTO. This is looking really good! This solution makes a lot of sense, and I like how you calculated the member months for the total year.
I appreciate your comments about creating a dependency between CMS HCC and Financial PMPM. I'm not super concerned about this. We have other marts that have dependencies as well. We use the data type variables (claims_enabled / clinical_enabled) to help control this. In theory, someone has to have claims in order to run both CMS HCC and Financial PMPM.
I left two comments with requests for changes. I am running the CI testing as well to make sure the syntax works in the other data warehouses we support.
patient_id | ||
, cast(substr(year_month, 1, 4) as integer) as eligible_year | ||
, COUNT(1) as member_months | ||
from {{ ref('financial_pmpm__member_months') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of our design patterns is to include an ephemeral staging model for every data mart. You can think of this as an "input layer" for the data mart. This helps with documentation and mapping.
You can see in the staging folder for this mart that we are referencing models from Core. Can you add a new staging model for financial_pmpm__member_months
? You can then replace your reference in this CTE with the staging model. I would name it something like cms_hcc__stg_financial_pmpm__member_months
.
, cast(substr(year_month, 1, 4) as integer) as eligible_year | ||
, COUNT(1) as member_months | ||
from {{ ref('financial_pmpm__member_months') }} | ||
group by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a payment_year filter to ensure that the member months being used in this calculation are from the correct date range? You can see how we do this in the intermediate model for eligibility. You can include the Jinja code for payment year at the top and then add a where clause to make sure your eligible_year matches the payment_year.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sarah-tuva It technically isn't necessary as in the join I am joining on year, thus it wouldn't matter. I can include for performance considerations if it is necessary. The larger question I have is: Is tuva constrained to run a single payment year at a time? Or could multiple payment years run at once? If it is the latter or the latter is desirable in a future state, then I would opt to not have the filter. If it is only designed to run serially one year at a time, then I can add the filter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pfehlinger I missed that join down below. That works for me!
To answer your question, the data mart is currently designed to run one payment year at a time. Snapshots can be enabled to support analytics over multiple payment years. We have had some internal discussions around refactoring this mart to run all possible payment years with the given data. This would change the ability for someone to run analytics on any year they choose, though. I would love to hear your feedback on what you think would be most useful.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Hi @pfehlinger, the CI testing failed for Redshift. It looks like the substring syntax doesn't work in Redshift but does in BigQuery and Snowflake. Dbt has some cross-database macros we can look at using or create a custom macro. Let me know if you want any help with creating/testing this. |
…ment_risk_score by member months
…. Added ephemeral staging for member months in cms_hcc
19e537c
to
86b95c2
Compare
@sarah-tuva I made the changes you suggested:
I didn't do the eligible year per my comment above. There are still all those other items in terms of proper PR I would like to learn (docs & version number) |
{{ config( | ||
enabled = var('cms_hcc_enabled',var('financial_pmpm_enabled', var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))) | as_bool | ||
) | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the var reference for clinical. That could cause issues.
{{ config( | |
enabled = var('cms_hcc_enabled',var('financial_pmpm_enabled', var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))) | as_bool | |
) | |
}} | |
{{ config( | |
enabled = var('cms_hcc_enabled',var('financial_pmpm_enabled', var('claims_enabled',var('tuva_marts_enabled',False)))) | as_bool | |
) | |
}} |
This comment was marked as outdated.
This comment was marked as outdated.
1 similar comment
Workflow has finished with the following statuses:
|
Describe your changes
This resolves #337 by adding two new columns to
cms_hcc.patient_risk_scores
:member_months
andpayment_risk_score_weighted_by_months
. The member months are derived from the finanicial_pmpm mart, specifically financial_pmpm.member_months, utilizing payment year eligibility. Weighting is simply multiplying thepayment_risk_score
bymember_months
. This enables easier membership aggregations as a "population risk score" would now besum(payment_risk_score_weighted_by_months)/sum(member_months)
. If a member does not have eligibility in the payment year, both fields are NULL.I chose to link to financial_pmpm at the suggestion of @sarah-tuva (thank you!). I am calling this out explicitly in case there are concerns about dependencies between two marts.
The weighting occurs prior to rounding, thus there is a loss of accuracy due to rounding. Technically, the rounding for the score calculations today do not align with CMS rounding, namely rounding to the third decimal after each step. See pg. 11ff. If there is a desire to align with CMS, I would be happy to adjust the code to follow that methodology and update my weighting to align as well.
How has this been tested?
The tuva-demo data does not have 2019 eligibility which is necessary for this implementation. As such, I updated
enrollment_end_date
for patient_id10013
incore.eligibility
to be '2019-12-31'. I then executed dbt run --select tag:financial_pmpm and then dbt run --select tag:cms_hcc to confirm the value of 12 was showing formember_months
and that the multiplication was correct.Reviewer focus
Checklist before requesting a review
(Optional) Gif of how this PR makes you feel
Loom link