An Inspection-Ready, Tamper-Evident Audit Ledger for AI-Assisted PV

Record every AI-assisted drafting and coding decision — source, model version, reviewer, outcome — in a cryptographically hash-chained, encrypted-at-rest immutable table an FDA/EMA inspector can verify.

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

Opens your running SynapCores (An Inspection-Ready, Tamper-Evident Audit Ledger for AI-Assisted PV will be staged for a preview — nothing runs until you click Run). No instance yet? Install free in ~30s.

Share

Objective

2026 FDA and EMA expectations for AI in safety-critical workflows are explicit: the trail must be explainable, validated, and inspection-ready — you must be able to reconstruct what the algorithm knew and produced at the moment a case was assessed, and prove the record was not altered afterward. This recipe builds exactly that: a hash-chained, encrypted-at-rest immutable table that captures every AI-assisted decision, with a one-query integrity proof.

Step 1: Create the encrypted immutable ledger

IMMUTABLE makes the table append-only and hash-chains every row (tamper-evident by construction). WITH (ENCRYPTION = 'AES256GCM') encrypts it at rest.

CREATE IMMUTABLE TABLE pv_audit (
    case_id       TEXT,
    drafted_by    TEXT,     -- which agent / process produced the draft
    model_version TEXT,     -- exactly which model + version
    draft         TEXT,     -- what it proposed
    reviewed_by   TEXT,     -- the qualified human who approved
    decision      TEXT      -- approved / edited / rejected
) WITH (ENCRYPTION = 'AES256GCM');

The engine refuses ENCRYPTION unless AIDB_IMMUTABLE_MASTER_KEY is set (a hex key of 64+ chars) — there is no random per-process fallback, because that would make the table undecryptable after a restart. Drop the WITH (...) clause for a plain immutable table, which is still append-only and still hash-chained.

Step 2: Record a decision

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.',
    'J. Smith QPPV',
    'approved'
);

Step 3: Prove the trail was never altered

VERIFY TABLE pv_audit;

Result:

is_valid | message
---------+-----------------------------------------------------------------------
true     | chain verified: 1 record(s) across 1 block(s) (1 open), checksum
         | SHA3_256; per-record lineage anchored (tamper-evident); 1 row(s) in
         | storage; ...

Why it matters

VERIFY TABLE gives you a cryptographic yes/no on integrity — not a policy promise. Every draft, the model that produced it, and the human who approved it are anchored in an append-only chain and encrypted at rest. When an inspector asks "show me how this case was assessed and prove nobody changed it," the answer is a single query. This is the audit layer under source-grounded drafting and duplicate detection.

Tags

pharmacovigilancedrug-safetyaudit-trailimmutableencryptioncompliancefdaematraceabilityverify

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