Case Study · Toolkit / Zig, TypeScript · 2026

open

icsr

An E2B(R3) toolkit for individual case safety reports,
now running inside the PV agent.

Scroll
<ichicsr lang="en"> zig build test expect(port(msg)).toEqual(oracle(msg))
01

The Problem.

The Individual Case Safety Report is the atomic unit of pharmacovigilance: one patient, one drug, one reaction. Reports travel as E2B(R3) XML, an ICH standard specified across hundreds of pages of PDF, with EMA business rules on top. The tooling to read and validate them is mostly proprietary. Without it, an agent can talk about aggregate counts but cannot open the case file a user drops in.

02

The Solution.

A toolkit that parses and validates E2B(R3) messages. The reference engine is written in Zig and tested against a conformance corpus built from EMA material. The rules come straight from the ICH specifications, extracted with a purpose-built PDF parser. A TypeScript port was then proven against the Zig engine, used as an oracle: same input, same output, or the port is wrong. That port is integrated into the PV Safety Agent, which can now read deposited case files and reason on real reports.

From the standard to the agent.
01 ICH specs Rules extracted from the PDF standard
02 Zig engine Reference parser and validator
03 Conformance Corpus built from EMA material
04 TypeScript port Proven against the Zig oracle
05 PV agent Reads the case files users drop in
2 Implementations Zig engine and TypeScript port
R3 E2B standard ICH, with EMA business rules
1 Oracle The port must match the reference
The Stack.
01 Zig Reference engine
02 TypeScript Port embedded in the PV agent
03 E2B(R3) ICH standard for case reports
04 Conformance corpus Built from EMA material
05 Custom PDF parser To read the specifications
← Back to works Next: Safety Data MCPs →