README.md

adheRenceRX

A package of functions used to assess medication adherence from prescription claims databases

Healthcare stakeholders and researchers are constantly trying to stay ahead of the curve with quality metrics. Often, adherence is at the center of this conversation as it relates to quality metrics surrounding medication therapy; however, it can often be difficult to calculate adherence with the nuanced definitions of Proportion of Days Covered (PDC) compared to Medication Possession Ratio (MPR). This package will allow one to calculate either metric (PDC or MPR) simply by inputting their data, in the format specifified below, and indicating which columns house the relevant data. Further, the gantt() function will return a Gantt Chart for fill history visualization for any given patient

To get started:

install.packages("devtools")
install_github("btbeal/adheRenceRX")

This package is useful for:

Taking a data frame of an already cleaned subset of patient claims and returning either the PDC or MPR calculations in a list of three (MPR) or four (PDC) tibbles: - The proportion of your population meeting the threshold (adherence_threshold, which = 80% by default) - The individual IDs, their total gap in therapy within the date range, and the metric for each patient - The data frame of all relevant dates of a patients ID re-formatted (if appropriate for MPR calculations) - The initial Data (PDC only)

It comes with three functions:

medication_possession_ratio() and proportion_days_covered(), which both take the arguments: - x (a pharmaceutical claims database) - date_var (the fill date column for each claim) - pt_id_var (the patient ID column) - drug_var (the drug variable; recommend using Drug Name rather than NDC assuming drug name includes strength and are all formatted similarly) - day_supply_var (days supply column) - adherence_threshold (threshold for patient population adherence to be compliant (usually at or greater than 80%, the default) - measurement_year (measurement year; default is 2018)

and...

gantt(), which takes the list returned from the proportion_days_covered() and the id; - x the list returned from proportion_days_covered() - id the patient ID

Per the HEDIS guidelines, it accounts for:

The calculations:

PDC: the number of days in a period "covered" divided by the total days in a period for each patient

MPR: the sum of days supply for every fill within a period divided by the total days within that period

The appropriate way to use these functions:

Often times with tracking adherence, researchers or health systems will be focused on a particular subset of their population (those with more than two ACE/ARB fills or those receiving statin therapies). These functions assume that one has taken an appropriate subset of their population. Further, these functions assume that you have only claims that are relevant to the adherence measure. For example, if one is tracking statin adherence, only statins should be present in the data frame passed to the functions. Notably, if there are patients that should be on a statin but are not, in this example, they should be merged back to the final column with 0 for their MPR or PDC values.

Recommendations:

pharmacy_claims_data <- pharmacy_claims_data %>% 
        # unite creates a new column in a dataframe by combining two initial columns (in this case, the drug and strength) 
  unite(new_drug_column, c(initial_drug_column, initial_strength_column), sep = " ")

Example of use:

library(adheRenceRX)

claim_frame <- tibble(
  # Column of patient IDs
  ID = c(rep("21", 5), rep("48", 3), rep("59", 8)),
  # Column of dates (class: Date or POSIXct)
  date = c(as.POSIXct(rep("2018-10-11",3), tz = "UTC"),
           as.POSIXct("2018-11-11", tz = "UTC"),
           as.POSIXct("2018-12-11", tz = "UTC"),
           as.POSIXct(rep("2018-08-27", 2), tz = "UTC"),
           as.POSIXct("2018-11-15", tz = "UTC"),
           as.POSIXct(rep("2018-04-28", 5), tz = "UTC"),
           as.POSIXct(rep("2018-12-25", 3), tz = "UTC")),
  # Column of days supply from claim
  days_supply = c(30, 30, 60, 90, 30, 30, 60, 15, 30, 30, 60, 90, 30, 30, 30, 90),
  # Preferentially would have the drug's NDC here; however, that does not account for different manufacturers of the same drug
  # Either will work. May run both to do a sensitivity analysis
  drug = c("x", "x", "y", "y", "y", "x", "y", "x", "x", "x", "x", "y", "y", "x", "x", "y")

)

For PDC calculation:
# note that the variable names should be UNQUOTED
proportion_days_covered(x = claim_frame,
                        date_var = date,
                        day_supply_var = days_supply,
                        drug_var = drug,
                        pt_id_var = ID)

returns:

$`Percent of Patients Eligible`
# A tibble: 1 x 1
  percent_patients_eligible
                       <dbl>
1                         33

$`Summary of Gaps`
# A tibble: 3 x 4
  ID      gap range      pdc
  <chr> <dbl> <time>   <dbl>
1 21        0  81 days   100
2 48       51 126 days    60
3 59      121 247 days    51

$`Adjusted Data`
# A tibble: 7 x 7
# Groups:   ID, date [7]
  date                ID    drug  daysupply total_days end_date              gap
  <dttm>              <chr> <chr>     <dbl>      <dbl> <dttm>              <dbl>
1 2018-04-28 00:00:00 59    x            30        120 2018-08-26 00:00:00   121
2 2018-12-25 00:00:00 59    y            90          6 2018-12-31 00:00:00     0
3 2018-08-27 00:00:00 48    y            60         60 2018-10-26 00:00:00    20
4 2018-11-15 00:00:00 48    x            15         15 2018-11-30 00:00:00     0
5 2018-10-11 00:00:00 21    x            30         60 2018-12-10 00:00:00     0
6 2018-12-10 00:00:00 21    y            90         21 2018-12-31 00:00:00     0
7 2018-12-31 00:00:00 21    y            30          0 2018-12-31 00:00:00     0

$`Initial Data`
# A tibble: 7 x 7
# Groups:   ID, date [7]
  date                ID    drug  daysupply total_days end_date              gap
  <dttm>              <chr> <chr>     <dbl>      <dbl> <dttm>              <dbl>
1 2018-04-28 00:00:00 59    x            30        120 2018-08-26 00:00:00     0
2 2018-08-27 00:00:00 48    y            60         60 2018-10-26 00:00:00     0
3 2018-10-11 00:00:00 21    x            30         60 2018-12-10 00:00:00     0
4 2018-11-11 00:00:00 21    y            90         90 2019-02-09 00:00:00     0
5 2018-11-15 00:00:00 48    x            15         15 2018-11-30 00:00:00     0
6 2018-12-11 00:00:00 21    y            30         30 2019-01-10 00:00:00     0
7 2018-12-25 00:00:00 59    y            90         90 2019-03-25 00:00:00     0


For MPR calculation:
# note that the variable names should be UNQUOTED
medication_possesson_ratio(x = claim_frame,
                        date_var = date,
                        day_supply_var = days_supply,
                        drug_var = drug,
                        pt_id_var = ID)
[[1]]
# A tibble: 1 x 1
    mpr
  <dbl>
1 0.333

[[2]]
# A tibble: 3 x 4
  ID    total_days range      MPR
  <chr> <time>     <time>   <dbl>
1 21    130 days    81 days   160
2 48     75 days   126 days    60
3 59    126 days   247 days    51


[[3]]
# A tibble: 7 x 4
# Groups:   ID, date [7]
  date                ID    drug  total_adjusted
  <dttm>              <chr> <chr> <time>        
1 2018-10-11 00:00:00 21    x      60 days      
2 2018-11-11 00:00:00 21    y      50 days      
3 2018-12-11 00:00:00 21    y      20 days      
4 2018-08-27 00:00:00 48    y      60 days      
5 2018-11-15 00:00:00 48    x      15 days      
6 2018-04-28 00:00:00 59    x     120 days      
7 2018-12-25 00:00:00 59    y       6 days  
For gantt():
x_argument <- proportion_days_covered(x = claim_frame,
                        date_var = date,
                        day_supply_var = days_supply,
                        drug_var = drug,
                        pt_id_var = ID)

gantt(x = x_argument,
      id = 21)

Examples of Gantt Charts created using gantt():

from the claim_frame data above Gantt_1

from de-identified claims data

Gantt_2

Gantt_3

Enjoy and please provide recommendations/feedback!



btbeal/adheRenceRX documentation built on June 5, 2019, 11:02 a.m.