CIPHER-EHR

Trial protocols to recruitment lists and target-trial emulations – agents do the work, the platform checks it, a clinician signs off every step.
Step 1 · Start a project

Upload the trial protocol

Drop in the protocol PDF (or a text file). It is parsed on your own server – only protocol text is ever sent to a model, never patient data.

CIPHER-EHR · New project
Project name
Protocol
⇪ Drop the protocol PDF here, or browse
PDF
EMPA-HF_protocol_v3.pdf2.4 MB · 46 pages
Synopsis & objectives
Treatment strategies
Eligibility criteria · p. 14–15
Outcomes & follow-up
Read on your server
46pages
14,210words
4sections found
Protocol amendments
Upload version 4 later and see exactly which criteria changed – and which definitions need another look.
Nothing leaves without you
Patient-level data never reach a model. Agents only see the protocol text and aggregate counts.
Step 2 · Read the protocol

An agent finds every criterion and quotes it verbatim

Each criterion keeps a link to the page it came from. A clinician reviews the list – and can edit, merge or add – before anything is built on it.

EMPA-HF · Protocol v3Page 14
5. Study population
5.1 Inclusion criteria
1. Age 40 years or older at time zero.
2. Type 2 diabetes mellitus.
3. HbA1c between 6.5% and 11.0% within the 12 months before time zero.
5.2 Exclusion criteria
1. Type 1 diabetes.
2. End-stage kidney disease, dialysis or kidney transplant.
3. eGFR below 30 mL/min/1.73 m² at screening.
4. Use of a GLP-1 receptor agonist within 90 days before time zero.
5. Pregnancy or breastfeeding.
6. Unable to provide informed consent.
5.3 Rationale
Patients with severely reduced kidney function were excluded because the efficacy of SGLT2 inhibition on glycaemic control is attenuated …
EX
Eligibility Extractorreading 46 pages …
I1Age 40 years or older at time zerop.14 §5.1
I2Type 2 diabetes mellitusp.14 §5.1
I3HbA1c 6.5–11.0% within 12 months before time zerop.14 §5.1
E1Type 1 diabetesp.14 §5.2
E2End-stage kidney disease, dialysis or kidney transplantp.14 §5.2
E3eGFR below 30 mL/min/1.73 m² at screeningp.14 §5.2
E4GLP-1 receptor agonist within 90 daysp.14 §5.2
E5Pregnancy or breastfeedingp.15 §5.2
E6Unable to provide informed consentp.15 §5.2
Approved by the study clinician · 3 inclusion, 6 exclusion · edits tracked
Step 3 · Break it down

Compound criteria become atomic, testable pieces

The Atomizer splits each criterion into single concepts and keeps the logic that joins them – each piece is defined and tested on its own.

E2 · Exclusion
“End-stage kidney disease, dialysis or kidney transplant.”
AT
Atomizersplitting …
ANY OF
E2a

End-stage kidney disease

Diagnosis any time before time zero

E2b

Current dialysis

Dialysis procedure or status code in the 90 days before time zero

E2c

Kidney transplant

Transplant procedure or transplant status, any time before

I3 HbA1c 6.5–11.0% within 12 months
Stays one atom – the value, the window and “most recent” belong together.
E6 Unable to provide informed consent
Not in structured data – marked hand-screened and listed on every worksheet.
Step 4 · Find the codes

The right codes from ICD-10, ICD-9, LOINC and RxNorm

The agent searches each terminology with tools, adds ICD-9 via the CMS crosswalk and links every code to your EHR’s local names.

QB
Query Builder agenttool calls
→ search_terminology("end-stage kidney disease")
ICD-10-CM N18.6 · Z99.2 · Z94.0 · Z49.*
→ map_icd(ICD-10 → ICD-9, CMS GEMs)
ICD-9-CM 585.6 · V45.11 · V42.0 · V56.*
→ get_standard_lab("egfr")
LOINC 98979-8, 62238-1 · 6 local lab names
→ search_terminology("GLP-1 RA", RXNORM)
4 ingredients · 11 local drug names
→ test_spec(E2a)
✓ 1,906 patients · 6/6 boundary cases pass
Every code list is shown to the clinician with its patient counts – edit it, or upload your own value set.
ICD-10-CMdiagnoses

End-stage kidney disease · dialysis

N18.6End-stage renal disease
Z99.2Dependence on renal dialysis
Z94.0Kidney transplant status
Z49.*Encounter for dialysis care
patient counts shown for every code
ICD-9-CMadded automatically

Equivalents via CMS GEMs

585.6End stage renal disease
V45.11Renal dialysis status
V42.0Kidney replaced by transplant
V56.*Encounter for dialysis
covers records before October 2015
LOINClabs

eGFR and HbA1c

98979-8eGFR, CKD-EPI 2021
62238-1eGFR, CKD-EPI
4548-4Hemoglobin A1c
17856-6Hemoglobin A1c, HPLC
→ 9 local lab names · units checked
RxNormmedications

GLP-1 receptor agonists

1991302semaglutide
475968liraglutide
1551291dulaglutide
60548exenatide
→ 11 local drug names in orders
Step 5 · Connect your EHR

Any extract format, one harmonized schema

Delimited text, CSV or FHIR: CIPHER profiles the files, maps the columns to a standard schema and builds a read-only copy.

TXT
Clarity extract · pipe-delimitedY_Patients.txt · Y_Encounters.txt …
CSV
Laboratory feedlabs_2008_2024.csv
FHIR
FHIR R4 · NDJSON bundlesPatient · Condition · Observation …
NOTE
Clinical notesprogress notes · echo reports
DP
Data preparation
Harmonized schema · read-only copyprofiling …
cipher_patientsdemographics, death, record span0
cipher_encountersvisits, admissions, settings0
cipher_diagnosesICD-10 and ICD-9, primary flag0
cipher_labsresults, units, reference ranges0
cipher_medicationsorders, ingredients, classes0
cipher_notestext, with facts extracted locally0
PAT_MRN_ID → PAT_ID
Observation.code LOINC 98979-8 → standard lab “eGFR”
MedicationRequest.authoredOn → ORDER_DATE
HbA1c 64 mmol/mol → 8.0 % (unit inferred)
Profile: 182,400 patients · records 2008–2024 · lab units and note facts prepared once, reused by every project. Source files are never modified.
Step 6 · Define and run

From criterion to SQL – and to patients

The agent writes a structured definition; the platform compiles read-only SQL, runs it on the EHR copy and reports met, unknown and not met.

E3 · Exclusion
“eGFR below 30 mL/min/1.73 m² at screening.”
Most recent eGFR < 30 in the 12 months before the index date
Structured definition
{
  "domain": "lab",
  "lab": "egfr",
  "use": "latest",
  "value": { "op": "<", "value": 30 },
  "window": { "from": { "n": -12, "unit": "months" } }
}
compiled SQL · SELECT onlySQLite · read-only connection
▶ Run on EHRready
Met 0Unknown 0Not met 0
Step 7 · Explore

Try the cohort in the playground

Combine definitions with AND / OR / NOT, switch criteria off, move thresholds – counts and demographics update instantly.

Cohort logic
ALL OFinclusion
I1Age ≥ 40 at the index date
I2Type 2 diabetes (validated phenotype)
I3Most recent HbA1c 6.5–11 % in 12 months
NONE OFexclusion
E1Type 1 diabetes
E2ESKD, dialysis or transplant
E3Most recent eGFR <30
E4GLP-1 receptor agonist in 90 days
E5Pregnancy or breastfeeding
Patients in this cohort
3,420
protocol as written
Who is in it
Female47%
Age ≥ 6544%
Black race18%
Save as a versionExport patient listCompare with protocol

From trial protocol to patients – and to evidence

Agents read the protocol, define every criterion in your EHR, check their own work, and a clinician signs off each step.
Recruitment

Who is eligible now?

Eligible and possibly-eligible patients, screening worksheets with the evidence, refresh alerts and outcome rates for sample-size planning.

Trial emulation

What would the trial have shown?

Time zero at treatment start, eligibility at time zero, outcomes followed over time, propensity-weighted comparisons and balance.

Protocol & study design

Criteria, strategies and outcomes – read in one pass

The Eligibility Extractor copies the criteria verbatim; the Study Design agent finds the arms, time zero, outcomes and follow-up.

EMPA-HF · target trial protocol
2. Treatment strategies
3. Eligibility criteria
4. Outcomes
5. Follow-up
EX
Eligibility Extractor
SD
Study Design agent

Inclusion

Exclusion

Study design · suggested: trial emulation

A · Start an SGLT2 inhibitorB · Start a DPP-4 inhibitor
Primary: hospitalization for heart failureAll-cause deathMI hospitalization3-year follow-up
Computable definitions

Validated definitions, not guessed code lists

Agents pick from a phenotype library and standard labs; the platform compiles the SQL, adds ICD-9 equivalents and converts units.

I2 · Inclusion
“Type 2 diabetes mellitus.”
Type 2 diabetes – validated phenotype, any time up to the index date
  • 1 hospital diagnosis, or 2 outpatient diagnoses on different days
  • or an active problem-list entry
  • or a diagnosis confirmed by glucose-lowering medication or HbA1c ≥ 6.5%
ICD-10 E11.*+ 40 ICD-9 codes · CMS GEMs
0patients meet it
0unknown · short record
I3 · Inclusion
“HbA1c between 6.5% and 11.0% within the 12 months before time zero.”
Most recent HbA1c between 6.5 and 11 % in the 12 months before the index date
  • Standard lab “HbA1c” – 3 local lab names, one unit (%)
  • mmol/mol results converted; implausible values dropped
  • No measurement in the window → unknown, never silently “no”
BKR HEMOGLOBIN A1CHEMOGLOBIN A1CHEMOGLOBIN A1C, POC
0patients meet it
0unknown · not measured
Built-in verification

Every definition is tested before anyone relies on it

Synthetic boundary patients, a blind second builder, an independent reviewer – and the judgement calls laid out with their patient counts.

Boundary tests · “eGFR < 30, most recent in 12 months”

Synthetic patientExpectedPlatform
eGFR 27 eight months agomet✓ met
eGFR 33 eight months agonot met✓ not met
eGFR exactly 30not met✓ not met
eGFR 27 – but 13 months agounknown✓ unknown
older 27, most recent 33not met✓ not met
never measuredunknown✓ unknown

Two builders, blind to each other · “Current smoker”

93%
patient-level agreement
71 in both · 0 only first · 5 only second
− first: CODE = 'F17.2'
+ second: CODE_NODOT LIKE 'F172%' (all F17.2x codes)
Definition Reviewer: the first misses most smokers – adopt the second.

Decision to sign off · window for “HbA1c at screening”

Most recent value in 12 months (protocol)538 metSigned off
Most recent value in 6 months412 metSwitch
Any value in 12 months611 metSwitch
Honest about missing data

Every patient gets one of three answers per criterion

“No record” is not treated as “does not have it” unless the record covers the window. Unknowns become checks, not silent exclusions.

Met – the data show itUnknown – the data cannot tellNot met – the data rule it out
No eGFR in 12 months?
Unknown for “eGFR < 30” – the patient becomes possibly eligible with a check: order or find the lab.
Only 4 months of records?
Absence of a prior stroke is not evidence – unknown until the history is confirmed.
Consent, life expectancy, investigator judgement?
Screened by hand – listed on every worksheet, with an expected pass rate to project enrolment.
Recruitment

Eligible now – and who could be, after a check

Confirmed patients, possibly eligible patients with the exact checks they need, and what changed since the last data refresh.

✓ Eligible
0
every criterion confirmed by the data
⚠ Possibly eligible
0
nothing rules them out · checks pending
Projected enrolment
0
after hand-screened criteria (consent 60%)
Since last refresh
+0
newly eligible · 12 checks resolved

Who remains after each criterion · solid confirmed, hatched pending checks

Checks to do

I3 HbA1c not measured in 12 months1,240
E3 eGFR not measured in 12 months690
E1 record < 12 months: prior stroke?388
E5 pregnancy status not documented114
Recruitment

One worksheet per patient, with the evidence

Shown to the study team only – patient data never reach a model.

Possibly eligiblePatient Z4820117 · index date 2024-03-31 · 1 check pending
I1Age ≥ 40 at the index date✓ Met
age 63
I2Type 2 diabetes (validated phenotype)✓ Met
2019-05-02 E11.9 (outpatient) · 2019-08-14 E11.65 (outpatient)
I3Most recent HbA1c 6.5–11 % in 12 months⚠ Unknown
last HbA1c 2022-11-08 (8.1 %) – outside the window · order HbA1c
E1Type 1 diabetes✕ Not met
no record in 9 years of history
E3Most recent eGFR < 30✕ Not met
2024-01-19 eGFR 71 (BKR EGFR, CREATININE (CKD-EPI 2021))
Screening list export
Eligible and possibly eligible patients with their pending checks, ready for the coordinators' worklist.
Refresh alerts
Re-run on each data refresh: +37 newly eligible since last month, 12 possibly eligible confirmed.
Hand-screened items
Consent · ability to comply · investigator judgement – listed on every worksheet.
Recruitment · planning

How often do patients like these have the outcome?

The same eligibility applied three years before the data cut-off – then followed forward. Event rates drive event-driven sample sizes.

OutcomeEventsRate / 1,000 py1-year risk
Hospitalization for heart failure primary41241.33.8%
All-cause death29829.62.7%
MI hospitalization12111.81.1%
To observe 100 primary events in one year of follow-up you would need about
0
patients – 0% of today's eligible and possibly eligible pool.
Cumulative incidence · HF hospitalization · eligible 3 years ago
Trial emulation

Time zero at treatment start – eligibility checked there

New users only (12-month washout), 12 months of baseline records, enrolment 2015–2022, follow-up to the outcome, death, end of records or 3 years.

Patient on arm A
Patient on arm B
12-month washout: no SGLT2i
t₀ · empagliflozin
eligibility at t₀ ✓
HF hospitalization
12-month washout: no DPP-4i
t₀ · sitagliptin
eligibility at t₀ ✓
censored · end of records
AStart an SGLT2 inhibitor
Started in the enrolment period4,120
≥ 12 months of records before t₀3,270
Eligible at time zero2,086
BStart a DPP-4 inhibitor
Started in the enrolment period5,384
≥ 12 months of records before t₀4,410
Eligible at time zero2,951
Trial emulation

Outcomes over time, weighted for confounding

Kaplan–Meier cumulative incidence by strategy, propensity-score weights, robust hazard ratios, balance diagnostics and an E-value.

Hospitalization for heart failure · weighted A · SGLT2 inhibitorB · DPP-4 inhibitor
Hazard ratio, A vs B · propensity-weighted
1.00
95% CI 0.55–0.84 · unadjusted 0.61 · E-value 2.30
3-year risk
4.9%
A · 101 events
7.1%
B · 214 events
−2.2
risk difference, pts
Covariate balance · |SMD| before → after weighting
Design insight

Who the criteria leave out – and how the trial compares

Baseline characteristics from ClinicalTrials.gov (only the NCT number is sent), and the demographic footprint of every criterion.

Published trial vs EHR cohort
CharacteristicTrialEHRΔ
Age, mean63.165.4+2.3
Female38.2%47.9%+9.7
Black race5.1%17.8%+12.7
HbA1c, mean8.17.9−0.2
Heart failure10.0%14.6%+4.6
Who each criterion removes
CriterionRemovesFemaleBlack≥ 65
I3 HbA1c 6.5–11%3,41051% vs 4615% vs 1848% vs 44
E3 eGFR < 3041255% vs 4731% vs 1771% vs 45
E5 Pregnancy38100% vs 4721% vs 180% vs 46
Highlighted: a shift of ≥ 10 points in who can take part.

Foolproof by design, explainable at every step

Agents do the work; the platform checks it; a clinician signs it off.
Criterion languageAgents write definitions, the platform compiles SQL – read-only, nothing written to the EHR
Validated phenotypesCCW / eMERGE-style rules instead of single codes; ICD-9 added via CMS GEMs
Clinical dictionaryStandard labs across every local name, unit inference, note facts (LVEF, NYHA, smoking)
Met · unknown · not metMissing data become checks, not silent exclusions
Boundary testsSynthetic edge-case patients for every rule
Blind second builderPatient-level agreement and the exact differences, adjudicated by a reviewer
Signed decisionsEvery judgement call with alternatives and their patient counts
Recruitment & emulationWorksheets and refresh alerts · time zero, Kaplan–Meier, weighted HRs, balance
Illustrative numbers · CIPHER-EHR walkthrough · choose a tour · ← → or space to navigate · Esc for the tour menu