Inspiration

The most important decision in a nursing home often happens on a phone call at 2 AM. A night nurse calls an on-call physician who has never met the resident and has no chart open. The physician has to decide: send to the hospital, or treat here.

I am a physician and have taken these calls across 40+ skilled nursing facilities. The same thing happens again and again: the facts that matter most go unsaid. The resident is on a blood thinner. Her baseline is fully oriented, so "a little confused" is new. He has a Do Not Hospitalize order. She was discharged from the hospital six days ago. Missing context drives avoidable transfers, which are costly and harmful for frail residents, and delayed transfers for residents who truly need the emergency department.

On top of that, outside on-call groups rarely have API access to each facility's EHR. Getting the chart at 2 AM means a slow web portal login, if it happens at all.

What it does

The 2 AM Call is an AI co-pilot that listens to the nurse and physician call and shows the doctor, in real time:

  • Heard on call: vitals, symptoms, and events, each linked to the nurse's exact words.
  • Not yet mentioned: critical chart context the nurse has not said (anticoagulant, code status and MOLST, baseline mental status, recent hospitalization, goals of care, prior night calls, a glucose check for residents on insulin), each with its source. Items move to "Covered on call" when the nurse says them.
  • Red flags from deterministic clinical rules, NEWS2, and tonight's vitals against the resident's own 14 day baseline.
  • Facility capability tonight: what this building can and cannot do overnight (no CT tonight, IV antibiotics yes, labs back by 6 AM).
  • Remembered from prior night calls: "3rd call this week for this resident."
  • The chart, pulled live from the facility EHR: when the nurse says the resident's name or room, an Anchor agent signs into the facility's web EHR portal and reads the chart in about 10 seconds, shown in a live picture-in-picture view.
  • Ask the chart: "trend her creatinine over 3 months", answered by model-written code that runs in a disposable sandbox.
  • The physician decides. Transfer or Treat in place. The closing line is spoken to the nurse, a draft note is generated from the call record, the physician edits and signs, and Anchor posts the note into the facility EHR.

The demo moment: the nurse says Dorothy is "just more tired, BP a little low." It is 88/52 with a heart rate of 112. The rules fire anyway: hypotension, and possible sepsis, because 37.9 C meets the long-term care fever definition even though it is below the hospital cutoff. Nobody mentioned her discharge six days ago, or a glucose check while she is on insulin.

The AI never makes the decision. It makes sure the doctor knows.

How we built it

  • Frontend: React + TypeScript (Vite). The dashboard updates live over Server-Sent Events.
  • Backend: Node.js + Express + TypeScript. Each burst of speech runs a pipeline: extraction, then deterministic checks.
  • Claude on AWS Bedrock (Converse API, tool use) does three jobs: extract facts with verbatim quotes, write chart-query code from the schema only, and draft the note from the call record only. It never produces a red flag or a disposition.
  • ElevenLabs: Scribe v2 Realtime transcribes the live call in the browser with a server-minted single-use token. Text to Speech voices recorded calls (nurse and physician) and the physician's closing line.
  • Anchor Browser: cloud browser sessions with an embedded live view, driven over CDP with Playwright, sign into a synthetic facility web EHR portal, read every chart section, and post the signed note back. Posting is verified against the portal's own records.
  • Daytona: "Ask the chart" code runs only in a fresh, isolated sandbox holding one resident's chart, deleted afterwards. The physician can see the exact code that ran.
  • SurrealDB Agent Memory: resident-scoped memory of prior night calls, recalled at call start and written back when a note is signed.
  • Arize AX: OpenTelemetry and OpenInference tracing. Each call is a session; spans cover Bedrock calls, quote validation, fired rules, Ask-the-chart code, and Anchor runs. Eval results are logged as evaluator spans.
  • Safety layer in plain TypeScript: safety/rules.ts, reviewed by a physician, with guideline citations inline. These include the IDSA long-term care fever definition, NICE NG232 head injury guidance, qSOFA, RCP NEWS2, delirium superimposed on dementia, and beta-blocker and donepezil context on heart rate flags.

All data is synthetic.

Challenges we ran into

  • Making LLM output trustworthy enough for clinical use. Every extracted fact must carry a verbatim quote. Code drops anything whose quote is not in the transcript, any vital whose number is not in its own quote, and any claim of "mentioned" that cannot be verified, so the chart fact still surfaces.
  • Our eval caught a real bug. On a routine call, the nurse said "No fall," and the model recorded a fall event, which fired a false "fall on anticoagulant" flag. Events now carry an occurred field and denied events are dropped in code.
  • Hospital thresholds are wrong for nursing homes. Fever is absent in more than half of serious infections in long-term care residents. A rule using 38.0 C missed Dorothy's sepsis pattern at 37.9 C. We moved to the long-term care fever definition and added a temperature-independent qSOFA flag.
  • Ambiguous units. The nurse said "38.0" with no unit. The model left it out rather than guess. Units are now decided in code, not by the model.
  • Making the EHR agent fast and visible. An AI agent typing a long note took about 100 seconds. Driving the cloud browser directly over CDP cut posting to about 15 seconds and chart reading to about 10. Live view frames were black at first, so we open and warm the session before the call starts.
  • Honesty in the demo. The agent only searches the EHR once the nurse has actually said the resident's name or room on the call.

Accomplishments that we're proud of

  • 27 of 27 eval runs pass: 9 scripted cases, 3 runs each, including a nurse who downplays shock, a clean call with no false alarms, Fahrenheit conversion, and "I'm not sure if she's on a blood thinner."
  • A safety design enforced in code, not in a prompt. The LLM cannot add, remove, or soften a red flag, and goals of care never hide one.
  • Reading and writing a facility EHR with no API, visible to the physician as it happens.
  • Every sponsor tool doing a real job in the clinical workflow.

What we learned

  • In clinical AI, the most valuable thing the model does is narrow and verifiable. Pairing LLM extraction with deterministic rules and quote validation earns trust that a chat interface cannot.
  • Older adults present atypically. Building rules for skilled nursing means using long-term care definitions, the resident's own baseline, and medication context, not hospital defaults.
  • Evals pay for themselves within the same day.

What's next for The 2 AM Call

  • Pilot with an on-call physician group across a few facilities: measure transfer rate, 72 hour return-to-hospital for treat-in-place residents, time to decision, and physician-rated missed information.
  • Real EHR connections: FHIR or vendor APIs where available, and authorized portal access through Anchor where not, with credentials in a vault.
  • Speaker separation on live calls, and a spoken pre-decision brief for physicians on the phone.
  • HIPAA-eligible deployment (Bedrock under a BAA, no audio retention by default), clinical validation, and review under FDA clinical decision support guidance.

Built With

Share this project:

Updates

Submission history