Clinical-trial data review agent

An agent that finds impossible or inconsistent patient data in a clinical trial and drafts the query sent to the site.

Active · join meAI Engineering

5 of 10 tasks done

1 · Purpose

In a clinical trial, a data manager reads patient records looking for things that cannot be true: a visit before consent, a lab value out of range, a serious adverse event with no matching entry. Fixed rules catch many of these; the rest need someone to read across one patient's whole record and use judgement. This agent does that reading and drafts the question to send to the trial site. A person approves every query; the agent never sends one itself. It uses the public CDISC pilot study data, so no real patient or employer data is involved.

For: Clinical data managers, pharma data engineers, anyone learning how an agent fits a regulated data job.

2 · Business benefits

Less reading, same careThe agent reads the whole record and proposes only the queries worth sending.
Rules first, model secondDeterministic checks run before any model call, so the model sees only what rules cannot decide.
A person sends every queryDrafts wait for approval, so nothing reaches a site unreviewed.
Measured, not claimedA planted trial with known problems gives recall and cost per patient from real runs.
Safe with hostile textA hidden instruction planted in the data is tested, and was resisted in both runs.

3 · Status and how to join

Active · join me. Under way: pick a task below, or tell me what you'd like to learn and I'll suggest one. Lead: Basant Choudhary.

Good first tasks this week:

  • Review a sample of draft queries and say which you would send
  • Propose one more planted problem and its expected finding

The code is not public yet; joiners get access.

4 · Requirements

What it must do

How well it must do it

5 · Architecture, very high level

Trial systemHolds the study data andreceives approved queries.Data layerLays the study data out instandard clinical tables.Edit checksRules that catch the problemsrules can catch.AgentReads across a patient's recordand drafts queries.ModelJudges whether a finding isworth sending.Reviewer deskWhere a data manager approvesor rejects drafts.EvaluationScores recall, checks and costagainst a planted trial.study datatablesjudgement call
Components and what each is responsible for, with no tool names: the tools come in the next section.

Also: Data layer → Agent: read tools · Edit checks → Reviewer desk: findings · Agent → Reviewer desk: draft queries · Reviewer desk → Trial system: approved query · Agent → Evaluation: run record

6 · Tech stack, per platform

ComponentOpen stackDatabricksAzure
Trial systemOpenClinica Community 3.x, public CDISC pilot data (set up)——
Data layerSDTM-aligned tables, local files ✓Delta tables in Unity Catalog (designed, not built)—
Edit checksPython rules, 202 of 202 checks pass ✓——
AgentClaude tool-use loop, in-process tools ✓tools as Unity Catalog functions (designed, not built)not built
ModelClaude ✓——
Reviewer deskfiles for the data manager to mark ✓——
Evaluationplanted trial, scorer, batch runner ✓MLflow evaluation (designed, not built)—

Bold with ✓ = built and running today. Everything else is the planned or possible binding: the components stay the same, only the tools change.

7 · What needs to be done

Version 1 5 of 5 done

TaskStatusSizeSkill
Planted trial: 24 problems of 12 kinds, 16 clean patientsdoneMClinical data
Deterministic edit checks (202 of 202 pass)doneMPython
Agent loop with read tools, scored: recall 21 of 24 (87.5%), $0.21 per patientdoneMAgents
Injection test: hidden instruction resisted 2 of 2doneSSecurity
First reviewer labels: 5 of 5 drafts worth sendingdoneSClinical data review

Version 2 0 of 3 done

TaskStatusSizeSkill
Visit-window and age rulestodoMClinical data
Study notes for study-wide blankstodoMAgents
The worth-sending gatetodoMAI testing

On a lakehouse 0 of 2 done

TaskStatusSizeSkill
Ingest the pilot data into Delta tables with clinical-standard layerstodoLData engineering
Write approved queries back to the trial system as discrepancy notestodoMIntegration

Size: S = an evening or two, M = about a week part-time, L = a few weeks.

8 · Roles

RoleHow manyHours / weekWhat they do
Clinical data reviewer11-2 hours/weekLabels drafts, says which queries are worth sending.
Data engineer13-5 hours/weekOwns the data layer and the edit checks.
Agent engineer13-5 hours/weekOwns the agent loop, tools and evaluation.

9 · What you'll learn

Level-up questions

10 · Links