Source-Grounded ICSR Drafting — the Model Proposes, a Human Approves

Draft an adverse-event narrative from structured case fields with SELECT GENERATE, then keep the human-in-the-loop review and the immutable audit that make it safe for a regulated safety workflow.

All recipes· pharmacovigilance· 8 minutesintermediatesql
Instance: localhost:8080

Opens your running SynapCores (Source-Grounded ICSR Drafting — the Model Proposes, a Human Approves will be staged for a preview — nothing runs until you click Run). No instance yet? Install free in ~30s.

Share

Objective

A generic LLM pointed at safety data is disqualified on day one: a single hallucinated causality or seriousness statement is a compliance event, not a bug. This recipe shows the safe shape — draft from the structured case fields, then run the draft through human review and a tamper-evident audit. The model proposes; a qualified reviewer decides.

Step 1: Draft from the case fields

SELECT GENERATE(...) runs the in-database model. The prompt hands it only the fields on file and instructs it to add nothing else.

SELECT GENERATE(
  'Draft a one-sentence adverse-event line using ONLY these fields. Do NOT invent age, sex,
   or any detail not listed. Fields: drug=Atorvastatin; event=bilateral leg myalgia;
   onset=14 days after start; outcome=ongoing.'
) AS draft;

A representative result:

draft
-----------------------------------------------------------------------------
A 52-year-old male patient developed bilateral leg myalgia 14 days after
starting atorvastatin therapy. The reaction was not resolved with dechallenge.

Read that carefully. The core clinical facts are correct and grounded — but the model inferred "52-year-old male," which was not in the source fields. That is precisely why a safety workflow can never let a model file on its own. Which brings us to the two controls that make this usable.

Step 2: Keep the human in the loop

In SynapCores you enforce this in the engine, not by policy: a drafting agent created with ALLOW_WRITES FALSE can propose a draft but can never commit it — a qualified reviewer must approve. (See CREATE AGENT for the agent form.) The reviewer confirms the grounded facts and strikes the unsupported ones.

Step 3: Record the draft, the model, and the human decision

Every draft and its review land on the tamper-evident ledger, so the trail shows what the model produced, which model version produced it, and who approved the final text:

INSERT INTO pv_audit VALUES (
    'US-2026-001',
    'pv_case_drafter',
    'qwen2.5-coder:7b',
    'Patient experienced bilateral leg myalgia 14 days after starting atorvastatin (age/sex not in source; struck on review).',
    'J. Smith QPPV',
    'edited'
);

(Build the ledger with the immutable audit recipe.)

Why it matters

Drafting speed is only useful if it is safe. The value here is not "the model writes the narrative" — it is propose → ground → review → prove: the model drafts from the source fields, a human approves, and an immutable record shows exactly what happened. That is the shape 2026 FDA/EMA guidance asks for — and the demographic slip above is the perfect argument for why the review and audit steps are not optional.

Tags

pharmacovigilancedrug-safetyicsrgeneratellmgroundinghallucinationhuman-in-the-loopaudit

Run this on your own machine

Install SynapCores Community Edition free, paste the SQL or Cypher above into the bundled web UI, and watch it run.

Download Free CE