-
Notifications
You must be signed in to change notification settings - Fork 96
Add pdc calculation to pharmacy models #770
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
base: main
Are you sure you want to change the base?
Conversation
@saywurdson do you have any published documentation on the process or logic that you followed to develop this? This would help me validate the work as well as provide instruction for future maintenance of this algorithm. |
Hi @davidshimamoto I also used some of the logic from the OHDSI drug era table implementation to understand how to consolidate medication records into continuous medicaiton treatment periods while factoring in some real-life medication refill scenarios like gap periods between fills and overlapping fills where a patient gets a refill but still has some medication from the previous fill left. Here is a link to their code: https://github.com/OHDSI/ETL-CMS/blob/master/SQL/create_CDMv5_drug_era_non_stockpile.sql Please let me know if you need anything else! P.S. I also have the python code I used to create the seed file for map NDCs/product-level RXCUIs to the active ingredient level RXCUIs to consolidate different medications that have the same active ingredient. I didn't think it fit into this PR but I'm happy to share it with you if it will help with ongoing maintenance |
Describe your changes
This PR adds new capabilities to the Tuva healthcare data framework for calculating medication adherence metrics, specifically the Proportion of Days Covered (PDC).
To do this, I have created 3 pharmacy models that ultimately calculate pdc and associated metrics:
pharmacy__stg_add_ingredient_concepts
- Maps pharmacy claims to active ingredients via RxCUIpharmacy__int_calculate_sub_exposures
- Groups overlapping prescriptions for the same ingredient into continuous sub-exposures, and applies a 30-day persistence window to combine sub-exposures that are part of the same treatment periodpharmacy__pdc
- Calculates final adherence metrics including total days covered and PDC percentagesThis PR also adds a value set to pharmacy to facilitate the creation of
pharmacy__stg_add_ingredient_concepts
I added some comments to explain the logic behind some of the choices. Feel free to remove if it is too messy.
How has this been tested?
I created the models in my local tuva instance using duckdb as a database. Code ran with no errors
Reviewer focus
I would like to validate that the logic used to calculate the drug eras/treatment periods makes sense. I think my logic is solid but there may be others who have done this calculation that have better insight.
Checklist before requesting a review
tuva_last_run
to the final output -- added to the final pdc model tablePackage release checklist
dbt_project.yml
(Optional) Gif of how this PR makes you feel
Loom link