Case Study

Adverse Event Case Intake

Turning a scanned, handwritten, or freeform adverse event report into a structured, schema-compliant safety case — with a confidence score on every field, not one guess for the whole document.

MSD International — AI Engineer
extraction and schema mapping validated — Veeva Safety intake integration demoed

The problem

An adverse event case starts life as whatever a vendor or business partner happened to submit — a typed PDF, a scanned and handwritten intake form, a different regional template entirely, sometimes just free text in an email. Today, a person reads that document and manually re-keys every field — patient details, suspect drug, reaction, seriousness, dates — into a Veeva Safety inbox item by hand.

That's slow precisely because the input refuses to be standardized. A rules-based form parser only works if the form matches the template it was built for; the moment a vendor sends something handwritten, scanned at an angle, or laid out differently, it breaks — which is why this had stayed a manual job.

Why this needs a model, not a template parser

The form itself isn't one fixed thing. The same case type shows up as a typed digital form, a handwritten scan, or a locally-adapted layout — the globally standard CIOMS suspect adverse reaction report is one shape it can take, but far from the only one. A coordinate-based parser breaks the moment the layout shifts; a model reading the page like a person would doesn't care which shape it's looking at.

Typed / digital PDF Handwritten & scanned Free text Regional template variants (e.g. CIOMS)

The workflow

Upload → extract with confidence → map to schema → reviewer edits → submit to Veeva.

01
Upload
A document or pasted free text goes in, in whatever format it arrived.
02
Extract, with confidence
A GenAI prompt pulls out every field and checkbox, each with its own confidence score.
03
Map to schema
Extracted fields get mapped into the target safety schema's exact field names and controlled vocabulary.
04
Reviewer edits
Low-confidence fields are flagged for a human to check before anything is submitted.
05
Submit
One action creates the inbox item and attaches the original document in Veeva Safety.

Step 1: extraction

The extraction prompt pulls every field label and value off the page — typed or handwritten — plus every checkbox and which option is selected, each with its own confidence score rather than one score for the whole document. Text fields and checkboxes fail differently, so each gets its own confidence rubric: a smudged signature and an ambiguous tick mark aren't the same kind of uncertain.

# illustrative — simplified from the real extraction contract { "fullText": "string", "extractedFields": [ { "label": "string", "value": "string", "confidence": 0.97 } ], "checkboxes": [ { "label": "string", "options": ["option1", "option2"], "selected": ["option2"], "confidence": 0.92 } ] }

Step 2: mapping to schema

A second, separate prompt takes that extracted JSON and maps it onto the safety schema's exact field names and controlled vocabulary — matching on both label and field description, inferring a field from context when it isn't constrained to a single section, but only ever from evidence actually present in the extraction. Every mapped value carries three confidence numbers, not one.

# illustrative — a mapped field carries both halves of the journey { "value": "...", "extraction confidence": 0.90, # how clearly it was read "mapping confidence": 0.85, # how sure it's the right field "average confidence": 0.875 }
Why split it into two steps: a reviewer needs to tell "the handwriting was clear but this might be the wrong field" apart from "I genuinely can't read this." Blending reading and classifying into one confidence number would hide exactly that distinction.

Getting it into Veeva

Once a case clears review, the app authenticates against Veeva Vault Safety, transforms the mapped output into the structure Veeva expects, and calls an intake endpoint that creates a single inbox item with the original document attached — so a case arrives ready for review instead of needing to be retyped in by hand.

Stack

GenAI extraction Multi-model comparison Confidence scoring Schema mapping Veeva Vault Safety API OCR Automation