Prescription Days and Medication Management
Over the past 150 years, some of the most influential medical breakthroughs have been medications that cure disease, relieve symptoms and ultimately extend life and wellness. Considering medication data is essential for measuring the health status of a patient or population, the standards we use to measure compliance with prescriptions should be widely available. Yet processing medication data into useful statistics presents a set of unique challenges.
The primary source of medication data for population health is prescription claims data which provide a timestamp when a medication is filled at a pharmacy. Even if we assume that patients always take the medications they pickup, this data structure still just provides snapshots of a patient’s course of treatment. Medication usage is usually tracked using a metric called “Proportion of Days Covered” (PDC) which measures the ratio of days where a patient should have medication versus the number of days they actually have a supply.
It is best to illustrate this through an example. Let’s pretend you run a farm of horses who eat 10 bushels of apples a day. You have a silo that can fit 300 bushels of apples or enough for 30 days but you can’t fit anymore in your silo and your if the apples are stored there they will rot.
Lets say on Sept 1, you get you apples delivered and then on Oct 1 after 30 days your silo is empty you get another delivery leaving you no gap. In this example, your horses have food for all 30 days. The proportion of days covered is thus 1.0 calculated as 30 days you have food divided by 30 days you need food.
But now its October and your next delivery isn’t until November 1 (31 days away). You are going to be short one day of apples. Your proportion of days covered is going to be 30 divided by 31 or .97 essentially you only have 97% coverage for your horses.
Now for apples maybe this isn’t a big deal. But for medications it can be. Patients often have gaps in their coverage or are picking up their medications early meaning they have extra supply. Most quality measures using medications utilize this ratio to monitor compliance.
The chart above shows the challenge. the patient has one significant period of overlap and then long gap until they refill their prescription again.
There exists a large body of libraries written in SAS to support the calculation of PDC. “Measuring Medication Adherence with Simple Drug Use and Medication Switching provides a great overview of the challenge and is authored by three statisticians at Walgreens and is the source of the image above.
Here we present Python functions that perform a basic calculation for PDC. We are releasing them open-source so that hopefully groups can utilize them and to help the adoption of open-source tools for health data analysis.
The following function should make that calculation. It takes in two inputs: 1. fill_dates: a list containing the dates of each claim fill 2. days supply: a list containing the days supply for of the dates in fill_dates.
The logic above recreates the calculation as presented in the cited paper. Let’s test the calculation by building a test case that matches the paper’s calculation of the same:
Let’s declare our input variables with the same fill dates, days supply, and study period.
Then we can invoke the function and see if the calculation matches.
To demonstrate the libraries, we have downloaded the drug event synthetic file from CMS. For ease of use, we are making available a sqlite database of the drug event file that can be used along with this notebook. This should kickstart your integration of these functions in your environment.
If you run this notebook directly, it will download the database automatically. (its pretty large almost 700mb).
Let’s use a patient as an example ID ‘7D8F1CC821FC36F3’ . The patient has three fills for NDC ‘53869015604’ in our data set. We will load the data into a pandas dataframe and convert the columns to a datetime format. We will also convert the days supply field to super helpful timedelta format which will help with the manipulation of the dates. again view the notebook format to see the full results.
- 08/15/2008 for 30 days
- 12/30/2008 for 30 days
- 06/06/2009 for 9 days our period ends on 06/15
Therefore, the proportion of days covered would be 69 over 304 days or 22%.
Now let’s run our new function on a larger set of patients. This will calculate the proportion of days covered for all patients taking Teriparatide, a medication for osteoporosis treatment.
As shown by the histogram, 120 out of 193 patients on this medication are full compliant.
The days covered utility function is one of the methods included in Alogrex Health’s utilization analysis libraries. Algorex Health’s libraries provide simple models and a huge range of utilization and quality metrics like this one that make it trivial to perform analyses just like this whether you use Python or R.
If you want to accelerate your application of data science using claims or clinical data contact us today.
Originally published at https://blog.algorexhealth.com/2017/07/prescription-days-and-medication-management/.