Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Proportion of days covered from pharmacy fill dates and days' supply function

PDC = C / T; a_i = max(f_i, a_prev + S_prev); C = sum_(i=1)^n [(E - a_i + 1) * (E - a_i + 1 > 0) * (E - a_i + 1 < S_i) + S_i * (E - a_i + 1 >= S_i)]; PDC_stay = C_adj / (T - H)

Maps a patient's dispensing records, each a fill date and a days' supply, and an observation period to the proportion of days covered (PDC), the share of days in the period on which at least one fill provides medicine, each day counted once. Same-drug refills collected before the previous supply runs out are shifted to start the day after it ends, overlaps between different drugs in a class are not shifted, supply running past the end of the period is ignored, and the CMS method removes inpatient and skilled nursing facility stay days. The records follow the notation of the Proportion of Days Covered article. The medication possession ratio, which sums days' supply instead, is HE-FM-MPR-001.

  • Proportion of days covered as unique covered days over days in the observation period

    PDC = C / T

    Divides the number of days in the observation period on which at least one fill provides medicine, after shifting overlapping supply of the same drug, by the number of days in the period, counted from the index date (the first fill) to the end date inclusive. Each day counts once however many fills cover it, and only days inside the period count, so the PDC cannot exceed 1. It is reported as a proportion or multiplied by 100 as a percentage, and is often dichotomised at 0.8.

  • Overlap shifting rule: start day of an early same-drug refill in the proportion of days covered

    a_i = max(f_i, a_prev + S_prev)

    Moves the start of a refill of the same drug, collected before the previous supply has run out, to the day after that supply ends, on the PQA premise that the patient finishes the old supply before starting the new one. Fills are taken in date order and the rule is applied in sequence, so each start is compared with the end of the previous fill as already shifted. The first fill starts on its dispensing day, and a refill collected after the previous supply has ended keeps its own date. CMS defines the same drug by the active ingredient at generic name level.

  • Covered days in the PDC observation period from shifted same-drug fills

    C = sum_(i=1)^n [(E - a_i + 1) * (E - a_i + 1 > 0) * (E - a_i + 1 < S_i) + S_i * (E - a_i + 1 >= S_i)]

    Adds, over the n fills of one drug after shifting, the days of each fill's supply that fall on or before the last day of the period. Shifting leaves the fills without overlap, so the sum counts each day once; a fill that starts after the end day adds nothing, and supply running past the end day is ignored. Day numbers run from the index date as day 1, so every fill starts on or after day 1 and the end day E equals the number of days in the period. Each comparison in parentheses inside the bracket equals 1 when it is true and 0 otherwise, so a fill adds its full supply when the supply ends on or before the end day, only the days up to the end day when it runs past it, and nothing when it starts after the end day.

  • Proportion of days covered adjusted for inpatient and skilled nursing facility stays

    PDC_stay = C_adj / (T - H)

    Applies the CMS adjustment for inpatient (IP) and skilled nursing facility (SNF) stays, during which the facility is assumed to supply the medicine. Stay days in the measurement period, including the discharge date, are removed from both numerator and denominator, and days' supply that overlaps a stay is shifted to uncovered days after discharge, if there are any. A patient whose stays span the whole treatment period is excluded.

Proportion of Days Covered — Functions & Formulae | HealthEconomics.wiki