signal-detection¶
Screen a drug-event pair in FAERS with openFDA 2x2 counts and PRR, ROR and IC with intervals, and write a signal report that states the limits of spontaneous reports. Use for a first disproportionality look, not for causality or incidence.
| Stage | Safety |
| Tier | 1 (deterministic tool) |
| Standards | EU GVP Module IX, CIOMS Working Group VIII, Evans 2001 PRR criteria, Bate 1998 IC |
Minimum pharmaskills |
0.3.0 |
| Inputs | drug name, event terms, date range, user supplied counts |
| Outputs | signal report md, counts csv, disproportionality json |
| Verified by | connectors openfda search, stats disproportionality |
Draft for qualified review. Not a validated system and not 21 CFR Part 11 compliant.
Install only this skill: pharmaskills skills install --agent claude-code --skill signal-detection (see Install).
Purpose¶
Give a safety scientist a reproducible first look at whether a drug-event pair is reported disproportionately in FAERS: the 2x2 counts from openFDA, PRR with chi-square, ROR with a 95 percent confidence interval, and the information component (IC) with a credibility interval, plus plain statements of what the numbers cannot tell. The output is a draft for qualified review. Outputs do not replace the user's regulatory reporting obligations and timelines.
When to use / when not to use¶
Use for a first quantitative screen of a named drug and one or more event terms, or to recompute disproportionality on counts the user supplies.
Do not use to estimate incidence or risk, to conclude causality, to decide on regulatory
action, or for individual case assessment (use icsr-e2b). Do not use to compare reporting
rates between drugs as if they were exposure-adjusted. Do not code terms to MedDRA.
Inputs¶
Required: drug name (generic or brand) and at least one event term as a MedDRA preferred term string. Optional: a date range (the connector queries the whole openFDA database; say so and filter by supplying your own counts if a window is needed) and counts the user already has.
Ask once for anything missing, then proceed with the stated assumption and [DATA NEEDED: ...]
placeholders. Never invent counts, report numbers or case identifiers.
Region assumed: US FAERS data; EU GVP Module IX concepts used for interpretation. State this.
If the network is down or pharmaskills is not installed, tell the user to run
uv tool install pharmaskills or supply the four counts, and produce the report template with
placeholders marked unverified.
Workflow¶
- Fetch counts.
pharmaskills connectors openfda search <drug> --param endpoint=event --param "event=<term>" --json. The table is a (drug and event), b (drug, no event), c (event, other drugs), d (neither). Save the raw JSON as evidence and notelast_updatedand the retrieval time. The connector caches responses. - Write
counts.csvwith a, b, c, d, N, source URL, data last updated and retrieval time. Never edit counts by hand. - Compute.
pharmaskills stats disproportionality --a A --b B --c C --d D --out disproportionality.json. Zero cells: the tool adds 0.5 to every cell and flags it; repeat that in the report and call the interval unstable when a cell is small. - Apply the thresholds (
references/thresholds.md): Evans 2001 PRR at least 2 with chi-square at least 4 and at least 3 cases; ROR lower bound above 1; IC025 above 0. - Write
signal_report.mdfromtemplates/signal-report.md: summary, question and data, 2x2 table, results table, thresholds, limitations, next steps. - Insert the draft banner and a provenance block
(
pharmaskills docs banner --apply signal_report.md).
Output contract¶
| File | Content |
|---|---|
signal_report.md |
Summary, 2x2 table, PRR, ROR, IC with intervals, thresholds, limitations |
counts.csv |
a, b, c, d, N, source URL, data last updated, retrieval time |
disproportionality.json |
Raw tool output |
The report must say in words: FAERS data are spontaneous reports, unverified, subject to
duplication and under-reporting; no incidence or risk can be derived; a statistical flag is a
hypothesis, not causality. Quote only numbers present in disproportionality.json and
counts.csv.
Verification¶
Run and report: connectors openfda search exit code, stats disproportionality exit code and
whether a continuity correction was applied. Recompute one value by hand (PRR is
(a/(a+b))/(c/(c+d))) and state that it matches to three decimals. Check that a+b+c+d equals the
reported total from the connector. If the connector returns no counts, report that and do not
substitute estimates.
Guardrails¶
- Insert the draft banner in every generated document.
- Never fabricate counts, PMIDs, NCT ids, case numbers or study data; unknowns are
[DATA NEEDED: ...]. - Never state or imply incidence, relative risk, causality or that a product is unsafe.
- Always include the FAERS limitations paragraph, even for a negative result.
- Do not publish drug-event findings externally: they need qualified medical review.
- State the region assumed and the date the data were last updated.
References¶
references/thresholds.md- the three screening criteria, formulas, zero-cell handlingreferences/faers-limitations.md- what spontaneous reporting can and cannot support- Public sources: EU GVP Module IX (EMA), CIOMS Working Group VIII report, openFDA drug adverse event API documentation.
Template: templates/signal-report.md. Script: scripts/run_signal.sh.
Examples¶
Worked example with a recorded openFDA response and a hand check:
examples/safety/signal-detection/. Fixtures: skills/signal-detection/evals/fixtures/.
Worked example¶
Committed example with inputs and outputs: examples/safety/signal-detection/.
Disproportionality screening of metformin and LACTIC ACIDOSIS in FAERS.
- Source: openFDA
drug/eventendpoint (https://api.fda.gov/drug/event.json), counts retrieved once on 2026-10-14 withpharmaskills connectors openfda search metformin --param endpoint=event --param "event=lactic acidosis" --json; openFDA data last updated 2026-07-30. The trimmed response is committed atskills/signal-detection/evals/fixtures/openfda_2x2_metformin_lactic_acidosis.json, so evals and this example never need the network. The single event term is a MedDRA preferred term as indexed by FAERS and was supplied by the user; no dictionary content is committed. disproportionality.json,handcheck_disproportionality.jsonandzero_cell_disproportionality.jsonwere produced bypharmaskills stats disproportionality.- Hand check (
fixtures/synthetic_2x2_handcheck.csv, a=20 b=80 c=100 d=9800, N=10000): PRR = (20/100)/(100/9900) = 19.800; ROR = 209800/(80100) = 24.500; expected count E = 100*120/10000 = 1.2; IC = log2(20.5/1.7) = 3.592. The tool agrees to 3 decimals. - Zero cell (
fixtures/synthetic_2x2_zero_cell.csv, a=3 b=0 c=40 d=5000): 0.5 added to every cell and flagged. signal_report.mdandcounts.csvare the deliverables;refusal_*.mdare responses to the adversarial prompts.
Skill source: skills/signal-detection/SKILL.md