Skip to content
  • Professional work
  • Deployed internally
  • 2026

Agentic Double Programming for Clinical TLGs

An agentic workflow that independently re-creates the analysis results behind clinical tables, listings and graphs (TLGs), then reconciles them with the production outputs: an automated second check.

My role
End-to-end owner.
Key result
An independent, reproducible second check for TLG numbers.
Technologies
  • R (cards, cardx)
  • CDISC ADaM
  • LLM agents (planner and programmer)
  • Hooks
  • MCP

What I owned

  1. Problem framing
  2. Data preparation
  3. Modeling
  4. Evaluation
  5. Application/API

Built at ZS for internal use. Described in simplified form; no client data, code or internal links are shown.

In [1]:Problem and constraints

In clinical reporting, each TLG is double-programmed: a second programmer independently re-creates the numbers to catch errors. It's essential, but slow and repetitive.

In [2]:Data and preparation

The mock shell (the planned layout of each table) and the ADaM analysis datasets. Study data is never shown.

In [3]:Baseline and evaluation design

Every generated analysis results dataset (ARD) is read back and validated automatically, then reconciled against the mock shell and the first-line production outputs.

In [4]:Architecture and modeling decisions

  • A planner agent drafts a plan from the mock shell, and the user approves it.
  • A programmer agent writes R with cards and cardx to build the ARDs, with a fixed limit on self-correction.
  • The results are built from the shell and the data, never from the production code, so the check stays independent.

In [5]:Implementation and integration

  • Hook-based guardrails keep metadata read-only, validate data sources and limit permissions to each flow.
  • An MCP data-inspection tool lets the agents look at the data before computing, which prevents silent zero-count outputs.

In [6]:Deployment and operation

Status: Deployed internally

Used internally at ZS.

Out[6]:Results and evidence

  • An independent, reproducible second check for TLG numbers.
  • Differences from production surface automatically for review.
  • Zero-count outputs are caught instead of passing silently.

In [7]:Limitations, failures, and lessons

  • Every plan needs a person's approval, and unusual custom tables may still need a programmer.