The problem
A wrong number here isn't a bug. It's a data-integrity event.
Documents take weeks
Producing a regulatory study report pulls in medical writers, biostatisticians, and physicians for weeks — much of it spent assembling and cross-referencing, not writing.
Patient narratives are the worst of it
A single study can need hundreds of similar narratives, each reconciling demographics, history, medications, and a chronological event account from several source systems.
Source data is scattered
Structured clinical datasets, scanned forms, lab reports, and safety database extracts — no single queryable surface ties them together.
Inconsistency triggers rework
A figure in the summary that doesn't match the results table is a recurring finding that sends a whole document back through review.
The high-level solution
A five-layer, grounded generation architecture.
Nothing enters a generated document without a verifiable source reference. The output is a draft for a qualified human — never an auto-approved regulatory document. That framing is both scientifically and legally correct.
Evidence & retrieval
Every source — structured datasets, scanned documents, literature — is normalised into an evidence base where every atomic fact carries a provenance record back to its source.
Structured generation
Documents are generated section by section against a template that defines required content and constraints. The model writes prose; every number is injected from a deterministic calculation, never invented.
Verification & authorship
An automated pass checks every number against its source and every section against every other before a human ever sees the draft. The writer edits and signs off — the system never auto-approves.
Architecture
From scattered sources to a signed-off document.
Ingestion
Source systems (clinical, safety, scans, literature) → normalization & provenance tagging → unified evidence base. Every evidence record is immutable — corrections create a new version with a supersession link, never an overwrite.
Generation
Document template → evidence retrieval → deterministic aggregation → grounded generation → automated verification. Pass → writer review. Fail → regenerate with the verification feedback, then escalate with the raw evidence attached after two attempts.
Pipeline
How it got built.
Foundation
Secure storage with immutable retention, a clinical database, and role-based access control.
Evidence model
Provenance-tracked, immutable evidence records — the schema every later stage depends on.
Structured ingestion
Clinical datasets loaded and validated against their declared standard before anything reads from them.
Deterministic aggregation
Every statistic — counts, percentages, incidence rates — computed in code as a named, versioned, unit-tested function. Built before generation, not after.
Verification service
Numeric grounding and cross-section consistency, also built before generation — it defines the contract generation has to satisfy.
Templates & generation
Section-by-section generation contracts, with mandatory citation tokens on every factual claim.
Writer workbench
Citation-linked review, track-changes editing, and a formal sign-off workflow.
Literature surveillance
A scheduled pipeline that screens and summarises new literature for periodic safety reporting.
Outcomes
What moved.
Figures are illustrative engineering targets for this solution pattern, based on comparable production systems — not a guaranteed result for any specific deployment.
Patient narrative authoring time
Before: 45–90 min → Target: 8–15 min (review + edit)
Document first-draft cycle time
Before: 8–14 weeks → Target: 3–5 weeks
Numeric errors reaching medical review
Before: ~2.4 / document → Target: <0.2 / document
Cross-section inconsistencies at QC
Before: ~6 / document → Target: <1 / document
Literature screening time per cycle
Before: 60–80 hours → Target: 12–18 hours
Components
This engagement ran AWS-native, matched to the client's existing cloud estate — the same pattern deploys equally well on Azure or GCP.
Where the platform fits
Every pattern here has an action boundary — a block, an approval, a reply. That is exactly where Nikash's gate sits: claims checked deterministically before the action, and real outcomes fed back afterwards.
See the platform →