One report's journey

This site ranks drug → reaction pairs that are reported together more than expected

Doctors, patients, and drug companies send the FDA reports of side effects they think a drug caused. PharmaWatch reads every report filed since 2004 and asks one question per drug → reaction pair: does this reaction show up with this drug more often than it shows up with every other drug?

When the answer is a clear yes, that pair is a signal.

A signal is a hypothesis, not a finding. It says "look here," not "this drug causes this." Reports aren't verified, and nobody reports the times a drug worked fine.

Example pair (drug → reaction): hydrocodone/acetaminophen (Vicodin, Norco) → dependence. The combination of hydrocodone and acetaminophen is the main suspect in 40,443 cases. If dependence were unrelated to it, we would expect only about 108 of those cases to report that reaction. Instead, 20,775 do. See this pair's signal page →

↑ Contents

AEMS is the FDA's inbox for side-effect reports

AEMS (FDA Adverse Event Monitoring System, formerly FAERS) is the system behind the FDA's post-market drug safety work. Once a drug is approved and sold, this is how the FDA hears about problems clinical trials missed.

Every report contains who saw the event and who reported it to the FDA.

Who saw it (occp_cod)

Consumer / patient43.8%
Other health professional / pharmacist24.9%
Physician21.9%
Unknown6.8%
Lawyer2.6%

Who sent it (rept_cod)

Three limits that affect how trustworthy these statistics are

  1. Not verified. A report says someone suspected the drug.
  2. No denominator. AEMS doesn't know how many people took the drug, so you can't compute a rate. You can only compare a drug's reports against everyone else's reports.
  3. Reporting is uneven. News, recalls, and lawsuits cause reporting spikes.

To lower the risk of a false signal, PharmaWatch scores only the primary-suspect (PS) drugs of every case.

Below shows a real example of case 18957553, a 36-year-old man in the US, reported March of 2021.

DEMO · 1 row per version
primaryidcaseidcaseversionoccp_codrept_codmfr_sndr
189575531189575531CNPERALLERGAN
DRUG · 3 rows
primaryiddrug_seqrole_coddrugnameprod_ai
1895755311PSNORCOACETAMINOPHEN\HYDROCODONE BITARTRATE
1895755312SSCONTINE (THEOPHYLLINE)THEOPHYLLINE
1895755313SSOXYCODONEOXYCODONE
REAC · 3 rows
primaryidreaction_pt
189575531SUBSTANCE USE DISORDER
189575531OVERDOSE
189575531DRUG DEPENDENCE
OUTC · 1 row
primaryidoutc_cod
189575531OT (other serious)

↑ Contents

FDA publishes AEMS as quarterly ZIP files

There's no AEMS database you can connect to. The public ways in are the FDA's AEMS dashboard, the openFDA API, and the FDA's quarterly ZIP files, which is what this site uses.

Each ZIP holds 7 $-delimited text tables, linked by primaryid: the four shown before (DEMO, DRUG, REAC, OUTC) plus RPSR (report source), THER (therapy dates), and INDI (why the drug was taken).

The example case shown before as it looks in the raw DRUG file (trimmed to the columns that matter):

primaryid$drug_seq$role_cod$drugname$prod_ai
189575531$1$PS$NORCO$ACETAMINOPHEN\HYDROCODONE BITARTRATE
189575531$2$SS$CONTINE (THEOPHYLLINE)$THEOPHYLLINE
189575531$3$SS$OXYCODONE$OXYCODONE

How PharmaWatch ingests the data

Two records on one line
DRUG11Q2.TXT line 322,967
25 fields, 12-column header
A missing line break put two drug records into one line. The parser splits these oversized lines into header-sized chunks.
A quote that isn't a quote
drugname: "VITAMINS" (NOS)
The CSV reader took the " as the start of a quoted field. AEMS never escapes quotes, so quoting is turned off.

Why the quarterly files, not openFDA. openFDA is trustworthy, but its cleaning is a black box. Starting from the FDA's own release means every step a report goes through is documented and deterministic. The full pipeline can be walked through from start to finish.

↑ Contents

One case arrives many times

A case isn't filed once. When a manufacturer learns more, it sends a follow-up, which arrives as a new copy of the case, often in a later quarter.

DEMO · caseid 10003307, latest version
primaryidcaseidcaseversioninit_fda_dtfda_dt
1000330731000330732014-03-122015-08-12

primaryid = caseid + version digit. This case was first reported in March 2014 (init_fda_dt), and version 3 arrived 17 months later (fda_dt). Counting raw rows would count the same cases multiple times, inflating every pair they appear in.

The FDA also retracts cases (duplicates, reports filed in error) and, since 2019Q1, publishes a deleted-case list in each ZIP.

How PharmaWatch handles multiple case versions

  1. Retracted cases removed per quarter in clean.py, before merge and dedup. Retractions reach back 15+ years.
  2. Latest version wins (dedup.py). Per caseid, keep the row with the highest caseversion. This runs across all 90 quarters at once, since a follow-up often lands in a different quarter than its original.
  3. Ties broken deterministically. Some cases have multiple rows at their latest version. The winner is decided deterministically in this order: most child rows (drugs + reactions + outcomes …) → most non-null DEMO fields → lowest primaryid. Same input, same winner, every run.
  4. Child tables filtered to the surviving primaryids, with exact duplicate rows dropped: 100.5M drug rows → 75.1M.
Merged reports (after retractions)24,680,706
Rows at their case's latest version21,503,562
… cases with one row: kept19,992,545
… rows across 595,952 tied cases: 1 winner each1,511,017
… one primaryid won for two cases: fullest DEMO row wins−1,842
Final cases20,586,655

Engineering note: each step is a DuckDB temp table, not one long CTE chain. Each step is materialized and row-counted in the log. Minutes instead of hours on this volume.

↑ Contents

Vicodin, Norco, and "HYDROCODONE + APAP" are one drug

To score a drug, you first need to know which reports include it. The drugname column of the DRUG table doesn't help much; it's a free-text field, and can get messy fast. PharmaWatch uses multiple steps to normalize drug names, increasing signal detection. The running example is a Norco row reported as NORCO (UNKNOWN) (WATSON LABORATORIES).

StepTermWhat it isExample
1Reported name (drugname)Whatever the reporter typed: brand, generic, misspelling, manufacturer, dose.NORCO (UNKNOWN) (WATSON LABORATORIES)
2Cleaned name (drugname_clean)The reported name with the noise stripped: parentheticals, trailing dose form ("TABLETS"), trailing strength ("10 MG"). Kept beside the original.NORCO
3Active ingredient (prod_ai)The chemicals that do the medical work, as opposed to the brand or the filler. Norco, Vicodin, and generic "hydrocodone/APAP" contain the same two. The FDA fills this field itself; \ separates ingredients.ACETAMINOPHEN\HYDROCODONE BITARTRATE
4RxNorm / rxcuiRxNorm is the National Library of Medicine's standard drug dictionary. Every concept gets one ID, an rxcui. Salt forms point to their base ingredient: hydrocodone bitartrate → hydrocodone.ACETAMINOPHEN → 161
HYDROCODONE BITARTRATE → 5489
5identity_keyThe drug, as this site defines it: the sorted set of its ingredients' rxcuis.rxcui:161|rxcui:5489

This particular row has an empty prod_ai, so step 3 comes from the lookup described below: the FDA gave NORCO that ingredient string on 100% of the 57,176 rows where it did fill the field.

Why a set, not one ID

Two routes into step 3, depending on era

In the data, hydrocodone/acetaminophen arrives under 390 reported spellings (Vicodin, Norco, "HYDROCODONE + APAP", …) and collapses to one identity: 40,443 primary-suspect cases, 150 signals. See the drug page →

Real drugname normalization examples used in PharmaWatch

Pfizer and Moderna merged
TOZINAMERAN (Pfizer)  49,278 rows
ELASOMERAN (Moderna)  30,859 rows
→ one RxNorm ingredient
RxNorm maps both COVID vaccines to one ingredient. A dbt seed file points each to its own product-level rxcui instead.
One field, several drugs
prod_ai: "AZITHROMYCIN OR METHOTREXATE SODIUM"
81 strings, 9,638 rows
When a reported name is ambiguous, the FDA lists every candidate. These rows stay in the background counts but are never scored as any one drug.
Not in RxNorm
ETIZOLAM  9,613 rows
→ local:ETIZOLAM
RxNorm is US-centric, so drugs sold elsewhere (etizolam is a Japanese anti-anxiety drug) have no rxcui. They get a local: identity instead of being dropped. 161 drugs with a local: piece carry 1,990 signals between them.

Match rate. 97.8% of the 20.9M primary-suspect drug rows resolve fully to RxNorm. Counted by distinct drug instead of by row, the rate is much lower: 8,440 of 11,954 drugs (70.6%) are all-RxNorm. The other 3,514 are a long tail of rare names, averaging to only ~8 reports each.

PharmaWatch's drugname normalization techniques are not perfect. For example, salt forms are lost in RxNorm matching. PharmaWatch also uses normalized-string matching in the RxNorm search, which has a small chance to falsely combine similarly-named drugs.

↑ Contents

Signal = observed vs expected, discounted for small counts

AEMS has no denominator, so it's impossible to know what percentage of people on a certain drug get a certain reaction. The question instead is disproportionality: is this reaction a bigger share of this drug's reports than of every other drug?

As an example, 0.27% of all cases report dependence. 51.4% of hydrocodone/APAP cases do. This creates a massive signal for this pair.

Step 1: the 2×2. For one drug → reaction pair, every case lands in one of four boxes.

dependenceother reactionstotal
hydrocodone/APAPa20,775b19,66840,443
every other drugc34,035d20,510,241
total54,810N20,584,719

N counts cases with a primary-suspect drug and at least one reaction: 1,936 fewer than chapter 3's 20,586,655 final cases.

Step 2: three quantities.

  1. Expected cases if no signal
    E = (a+b)(a+c) / N = 40,443 × 54,810 / 20,584,719 = 107.7
  2. IC (Information Component): observed vs expected, in doublings
    IC = log₂((a+0.5) / (E+0.5)) = log₂(20,775.5 / 108.2) = 7.585
  3. IC025: the pessimistic IC, bottom of the 95% credibility interval
    IC025 = IC − 3.3(a+0.5)−1/2 − 2(a+0.5)−3/2 = 7.585 − 0.023 = 7.562

The penalty, by case count

Max IC is the IC a pair would get if its expected count were zero: log₂((a+0.5) / 0.5) = log₂(2a+1). It's the ceiling for that many cases. If the ceiling minus the penalty is still ≤ 0, that case count can never be a signal.

Cases (a)Max IC, log₂(2a+1)PenaltyBest possible IC025 (max IC − penalty)
11.583.78−2.20never a signal
22.322.59−0.27never a signal
32.812.070.74smallest count that can be a signal. Hylan G-F 20 (below) hits this ceiling.
305.930.615.32
3009.230.199.04

Where the formula comes from. This is the shrinkage IC that the WHO Uppsala Monitoring Centre uses on VigiBase, the global equivalent of AEMS. The closed-form IC025 is from Norén, Hopstadius & Bate (2013), and the IC itself from Bate et al. (1998).

Why rank by IC025, not PRR

PRR (proportional reporting ratio) is the classic measure: PRR = (a/(a+b)) / (c/(c+d)), this drug's reaction share ÷ everyone else's. It has no shrinkage, so tiny counts explode it.

PairCasesPRRIC025
Hylan G-F 20 → injection site joint effusion 3 1,715,392
0.74
Hydrocodone/APAP → dependence 20,775 310
7.56

Ranked by PRR, a 3-case pair beats one of the best-known signals in AEMS by 5,500×. Ranked by IC025, they're in the right order. Hylan's 0.74 is the penalty table at work: max IC 2.81 − penalty 2.07.

Of the 2,849,232 pairs scored by PharmaWatch, 426,239 (15.0%) have an IC025 > 0.

How PharmaWatch calculates IC025

↑ Contents

Lawyers can inflate counts, so reports are flagged, not dropped

Since anyone can report claims and manufacturers must forward what they hear, lawyers can submit thousands of claims to manufacturers that must be submitted to AEMS. In a mass lawsuit, these claims can inflate signal. Fortunately, these claims are typically filed with reporter occupation LW (lawyer).

These reports are usually real people who took the drug and had the reaction. The problem is stimulated reporting: the count reflects whoever was recruited into the lawsuit, not how often the reaction happens. Signal detection assumes reporting is roughly even over time and across drugs, and a lawsuit breaks that assumption.

Small overall, concentrated where it lands. Lawyer-reported cases number 540,155, only 2.6% of the 20.6M, but they were 11.1% of cases first received in 2021. The drug ranitidine alone makes up 34.9% of all lawyer-reported cases, with oxycodone at 12.8%, and ranitidine plus opioids make up ~90% of 2021–22 LW cases.

Example: ranitidine (Zantac). On September 13, 2019 the FDA announced it had found NDMA, a probable human carcinogen, in ranitidine. The federal cancer litigation was consolidated as MDL 2924 on February 6, 2020, and on April 1, 2020 the FDA asked for all ranitidine products to be pulled from the market. The reports followed.

Ranitidine hydrochloride → prostate cancer, cases per quarter

Other reporters   Lawyer-reported

2004 Q12026 Q2

How PharmaWatch handles lawyer-inflated reports

Flag, don't drop. Dropping LW cases would throw away real reports. Instead, every pair is scored twice in the same pass (chapter 5's int_contingency), and three columns travel with every signal:

ColumnMeaning
pct_lwshare of this pair's cases that are lawyer-reported
peak_quarter_shareshare of its cases that landed in its single busiest quarter: a burst detector that doesn't depend on the LW code
ic025_nolwIC025 recomputed as if LW reports didn't exist

Three pairs, two outcomes

PairCases% LWPeak quarterIC025 → without LWReading
ranitidine hydrochloride → prostate cancer60,35649%2021 Q3 (31.2%)5.22 → 5.75Holds up. Even stronger without lawyers.
ranitidine hydrochloride → incorrect dose administered9,37280%2022 Q1 (46.0%)1.04 → −0.43Vanishes. A litigation artifact.
docetaxel → hair disorder5,64599.9%2018 Q2 (18.5%)8.07 → −1.89Vanishes. Almost entirely litigation. Caused by the Taxotere permanent hair-loss suits, consolidated as MDL 2740 in October 2016.

How many signals depend on lawyers: 1,934 of 426,239 (0.45%). A signal counts as lawyer-dependent only if all three hold: IC025 > 0 with LW reports, IC025 ≤ 0 without them, and at least 50% of its cases are LW.

The limit of voluntary reporting. The LW code only catches lawyers who file as lawyers. For ranitidine → prostate cancer, 30,915 of the 60,356 cases are not LW, yet the burst is obvious in the chart above.

↑ Contents

Every number on a signal page traces back to the methods shown above

The site has three levels:

Search, by active ingredient → drug page, one row per reaction → signal page, one drug → reaction pair.

Reading tip: the drug page is ranked by IC025 (top 50). Glance down the Lawyer-reported column; if you see a high IC025 with a high lawyer share, open the signal page before believing it.

The signal page adds the IC itself, IC025 without lawyer reports, the cases-per-quarter chart (lawyer vs other, as in chapter 6), and a short "Before drawing conclusions" list.

Under the hood

Serving schema (not every column shown). Joined on identity_key, the RxNorm ingredient set from chapter 4.

erDiagram
  srv_drug ||--o{ srv_signals : "identity_key"
  srv_signals ||--|{ srv_pair_quarters : "identity_key, reaction_pt"

  srv_drug {
    varchar drug_key PK "surrogate"
    varchar identity_key UK "sorted RxNorm ingredients"
    varchar drug_label "most-reported ingredient string"
    bigint n_signals "pairs with ic025 > 0"
  }
  srv_signals {
    varchar identity_key PK, FK
    varchar reaction_pt PK "MedDRA term"
    bigint a "2x2 counts a, b, c, d"
    double ic025 "rank score"
    double ic025_nolw "without lawyer reports"
    double pct_lw "lawyer-reported share"
    date peak_quarter
  }
  srv_pair_quarters {
    varchar identity_key PK, FK
    varchar reaction_pt PK, FK
    date report_quarter PK
    bigint n_cases
    bigint n_cases_nolw
  }
  

Stack & stats

24.7M AEMS reports 20.6M unique cases after dedup
2004–2026 years covered 90 quarterly files
8,440 drugs resolved to RxNorm 70.6% match rate after cleaning
2,947 drugs with a signal IC025 > 0 on at least one reaction
2.85M drug → reaction pairs scored 426K signals (IC025 > 0)
0.38 GB serving database from a 10.9 GB warehouse

Stack: Python + DuckDB ingest → Parquet on R2 → dbt → DuckDB file → FastAPI on Hetzner.

↑ Contents