Compute Proportion of Days Covered for Maintenance Medication Members
Last updated: November 29, 2026
Quick Overview
Given a pharmacy fills table (member_id, drug_class, fill_date, days_supply), compute each member's Proportion of Days Covered (PDC) per drug class from their first fill through a period end date, shifting early refills so overlapping supply is not double counted. Flag members at or above the 0.80 adherence threshold.
CVS Health
November 29, 20260
0
0 solved
Given a pharmacy fills table (member_id, drug_class, fill_date, days_supply), compute each member's Proportion of Days Covered (PDC) per drug class from their first fill through a period end date, shifting early refills so overlapping supply is not double counted. Flag members at or above the 0.80 adherence threshold.
CVS Health pharmacy and Aetna Medicare teams track PDC because it feeds Medicare Star Ratings adherence measures for statins, diabetes drugs and RAS antagonists. Interviewers use this to see whether a candidate can turn a clinical metric definition into exact interval arithmetic, especially the early refill carry-forward rule.
What the Interviewer Expects
- Defines the denominator as first fill date through period end, inclusive
- Shifts an early refill to start the day after prior supply runs out
- Clips supply that extends past the period end
- Computes per member and per drug class, not per NDC
- Validates results on a hand-traced example
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you handle a member who switches between two statins mid-year?
- How would you exclude members in hospice or with inpatient stays that pause coverage?
- How would you rewrite this as SQL at the scale of tens of millions of members?
- Why does PQA require at least two fills before a member enters the denominator?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
- One row per dispense:
member_id,drug_class(statin, RASA, diabetes),fill_date(date),days_supply(int). - Measurement window runs from the member's first fill in the class to `period_...
Approach
Sort fills per member and class. Walk them in order while tracking next_free, the first day not yet covered. Each fill starts at max(fill_date, next_free) and covers days_supply days. Clip each ...