Trial-Termination Early-Warning

A visual, runnable guide to the 3-tier risk console

Run / share / read / build - pick your mode. This page shows the console (diagrams + a live roll-up), the Run & build the Shiny app lets you run it and set a what-if, the dashboard is a shareable snapshot, and the run-and-build page shows how it is made. Synthetic, no PHI, no participant records.

The rule. The AI flags, aggregates, and drafts the alert. The SRC / DSMB / medical monitor make every DLT and safety call; the PM owns the study; the account lead owns the client signal. Reported safety numbers come from the validated safety database, never from a model.

Three tiers, one roll-up

%%{init: {'theme':'base','themeVariables':{'primaryColor':'#28344f','primaryTextColor':'#eef2fb','primaryBorderColor':'#7d9bd6','lineColor':'#aab8d6','clusterBkg':'#161d33','clusterBorder':'#3a476a','tertiaryColor':'#20406a','tertiaryTextColor':'#eef2fb','tertiaryBorderColor':'#7d9bd6','secondaryColor':'#20406a','secondaryTextColor':'#eef2fb'}}}%%
flowchart LR
  SRC["Data sources<br/>EDC · safety DB · labs<br/>IXRS · CTMS · finance"] --> RT{"Route by<br/>sensitivity"}
  RT -->|"safety / PK /<br/>unblinded"| LOC["On-device model<br/>zero egress"]
  RT -->|"non-sensitive<br/>ops"| CLD["Cloud Claude<br/>API + BAA"]
  LOC --> ADV["Advanced engine<br/>OT + Active Inference"]
  CLD --> ADV
  ADV --> SC["Severity-weighted<br/>roll-up to tier RAG"]
  SC --> ESC["Alert +<br/>escalation"]

The scoring is transparent - each signal has a level (green/amber/red) and a weight; a tier is the weighted blend, and the overall index weights the tiers (participant safety heaviest).

The live console - computed from the signal feed

Everything below is computed from one file, the signal feed: signals.csv (in the shiny/data/ folder). Edit that CSV (or run the app) and the roll-up, the tiers, and the feed all move.

35 · AMBER
Overall termination risk
38 · AMBER
Participant tier
24 · GREEN
Study tier
44 · AMBER
Client tier
Client · AR-60 Accounts-receivable aging > 60 days
payment-aging KRI breached
Participant · S-1042 Candidate Hy’s-Law / DILI
ALT 3.4x ULN + total bili 2.1x ULN (DLT window, day 9)
Client · COMMS Sponsor comms cadence ADV
-40% month-on-month - behavior drift, relationship watch
Client · SCOPE-CO Scope-reduction change-orders
2 this quarter
Participant · S-1042-ai Free-energy surprise rising ADV
active-inference EFE recommends an unscheduled LFT since day 7
Participant · S-1039 QTcF prolongation +48 ms
watch >30 ms, alert >60 ms
Participant · COH4-AE Within-participant AE cluster
cohort 4 trending Grade 2 to Grade 3
Study · SF-RATE Screen-failure rate
38% vs 25% plan - enrollment KRI breached
Study · LFT-DRIFT Cohort-4 LFT distribution drift ADV
Wasserstein tail mass moving up vs the pooled barycenter
Study · ENROLL Enrollment rate vs plan
-22% vs plan
Study · QRY-AGE Open-query aging
backlog rising ahead of database lock
Tier ID Signal Category Engine Level Weight
Participant S-1042 Candidate Hy’s-Law / DILI Safety On-device red 10
Participant S-1042-ai Free-energy surprise rising Safety On-device amber 6
Participant S-1039 QTcF prolongation +48 ms Safety On-device amber 7
Participant COH4-AE Within-participant AE cluster Safety On-device amber 6
Participant PK-EXP PK exposure vs predicted Cmax PK On-device green 5
Participant DLT-TALLY Cohort DLT tally Safety On-device green 8
Participant SAE-NEW New unexpected SAE Safety On-device green 9
Study SF-RATE Screen-failure rate Enrollment Cloud amber 7
Study LFT-DRIFT Cohort-4 LFT distribution drift Safety On-device amber 6
Study ESC-33 Cohort-4 escalation (3+3) Dose-escalation Cloud green 8
Study QTL-SAE Safety QTL (SAE rate) Safety Cloud green 8
Study ENROLL Enrollment rate vs plan Enrollment Cloud amber 5
Study QRY-AGE Open-query aging Data Cloud amber 4
Study PROTDEV Protocol-deviation rate Compliance Cloud green 5
Study SITE-ACT Site-activation lag Operations Cloud green 3
Client AR-60 Accounts-receivable aging > 60 days Finance Cloud red 9
Client COMMS Sponsor comms cadence Relationship Cloud amber 5
Client SCOPE-CO Scope-reduction change-orders Commercial Cloud amber 6
Client RENEWAL Contract-renewal signal Commercial Cloud green 5
Client FILINGS Public-filings sentiment Commercial Cloud green 4
Client SATIS Sponsor-satisfaction pulse Relationship Cloud green 4

Run it - and change it

shiny::runApp("risk_monitor/shiny")
# needs: install.packages(c("shiny","bslib","DT"))

Select a signal, set its level, and watch the tier and overall risk re-colour. The run-and-build page shows how the console is built from R/logic.R.

Going live: the feed file signals.csv is a representative subset of the 65-signal catalog. Replace it with your KRI / stopping-rule feed (same columns) and the roll-up is yours. Participant-tier signals are de-identified states, never records.

The other formats

Mode Artifact
Run Run & build the Shiny app
Share (no R) Dashboard
Build Run-and-build walkthrough

Synthetic, no PHI. The AI flags; the SRC / DSMB / PM / account lead decide.