Rishav Bhattarai
Case study · PCVI Atlas

Pharmaco-Climatic Vulnerability Atlas

Which American communities are pharmacologically primed to die in a heatwave, and can you trust that answer? A national data pipeline built from scratch, four silent bugs caught before they shipped, and an honest null result instead of an easy yes.

8.79Mclaim rows, 50 states
276drugs crosswalked
236HRRs in final analysis
4shipping bugs caught
The problem

Certain common medications (blood pressure drugs, diuretics, some psychiatric and antiepileptic drugs) impair the body's ability to regulate core temperature. As heatwaves intensify, public health agencies and health systems need to know where this risk concentrates: not just where it's hot, but where hot overlaps with a population taking heat-sensitizing drugs at scale. No existing public dataset answers this at a national, sub-state level.

This case study is about taking on an ambiguous question with no existing tooling, building the pipeline to answer it end to end and, the harder part, being honest when the rigorous analysis doesn't confirm the easy answer.

What I built
  1. Evidence-based drug crosswalk

    Combined two peer-reviewed sources (an RCT meta-analysis and a pharmacovigilance study) into a 276-drug table, resolved to standard drug codes (RxNorm / ATC) so it could be matched against real prescribing data. Full dataset card →

  2. National claims pipeline

    Pulled and matched 8.79M Medicare Part D claim rows across all 50 states against the crosswalk, resolved 768K prescriber locations, and aggregated to the county and Hospital Referral Region (HRR) level.

  3. Heat exposure join

    Pulled NASA's public reanalysis data for every US county, computed the standard NWS heat index, and joined it to the prescribing burden data, population-normalized.

  4. A causal test, not just a correlation

    Built a 6-year daily panel (2019-2024) and ran a conditional Poisson case-crossover model with a 200-permutation placebo check, the standard rigor bar for claiming a heat-health effect is real rather than confounded.

  5. Deployed tool

    A Streamlit app for exploring any HRR's burden index, heat exposure, and national ranking.

What went wrong, and what I did about it

The value of this project is less the pipeline and more the debugging along the way. Each of these was a silent failure mode that would have shipped a wrong number if not caught.

Geographic attribution

An 8x inflation from hospital catchment areas

Small counties with regional hospitals (e.g. Winchester, VA) looked like extreme outliers (56,438 claims per 1,000 residents vs. a national median around 6,500) because a wide catchment area was being counted against one small home county. Fixed by re-aggregating to Hospital Referral Regions instead of patching the symptom; Winchester's number dropped to 6,535, right at the median. Full debug log →

Data source failure

Two blocked sources, diagnosed not assumed

CDC's mortality API refuses geographic grouping below the national level (a disclosure policy, confirmed by a live test request), and a second CDC source rate-limited every call without a token. Pivoted to NOAA's Storm Events data and documented the resulting undercount limitation honestly.

Model fit failure

Silent numerical failures in the causal model

A perfect-separation issue (78% of regions had zero recorded deaths across 6 years, correctly excluded rather than left to blow up the fit) and a memory limit requiring restriction to the warm season, after first checking that 98.6% of deaths already fell in that window before applying it.

Formula bug

A heat index formula applied outside its valid range

Producing 697°F values on winter days. Caught before it fed into the causal model, fixed, and the full 6.9M-row panel was rebuilt from scratch.

The result
Descriptive finding: real r = 0.325

p < 0.0001, n = 236 HRRs. A statistically significant correlation between heat-sensitizing prescription burden and summer heat exposure, with a plausible geographic pattern: hot Sunbelt regions at the top, cooler coastal regions at the bottom.

Causal finding: does not hold p = 0.17-0.47

Across outcomes and weighting schemes, a 200-permutation placebo check. The descriptive correlation does not survive a proper causal test.

The honest headline: a real, interesting descriptive pattern, and a properly-run causal check that doesn't confirm it. That's the harder, less flattering thing to report, and it's the right one.

Why this matters for the role

This project is a small model of what deployed, customer-facing technical work requires: taking an ambiguous problem with no off-the-shelf data, building the full pipeline to answer it, catching the failure modes that would otherwise ship a confidently-wrong number, and reporting a null result instead of the more impressive one.

That combination, engineering judgment plus the discipline to not overclaim, is the same bar a forward-deployed engineering role holds a delivered analysis to.