Inspiration
When a paramedic is working a call, they're doing two jobs at once: keeping the patient alive and remembering everything that happens. Then they hit the hospital doors and have to hand the whole story to a team that has never seen the patient, while that team is scrambling to take over.
There are gaps on both sides of that handoff. Before the patient arrives, the hospital often has almost nothing to prep with. After the call, the medic has to rebuild the chart from memory, and exact times, doses, and changes in the patient's condition are the first things to slip.
The stakes are high. In the U.S., more than 356,000 people have an out-of-hospital cardiac arrest every year, nearly 1,000 a day, and only about 10% survive to hospital discharge (Sudden Cardiac Arrest Foundation, summarizing American Heart Association statistics).
The handoff itself leaks information. In one study of trauma handovers, only 329 of the 473 data points EMS spoke aloud (about 70%) made it into the hospital's chart (Carter et al., Prehospital Emergency Care). A heads-up helps: when cath labs got at least 10 minutes of notice before heart attack patients arrived, treatment started a median of 12 minutes sooner, yet EMS gave that much notice only 41% of the time (summary of a JACC: Cardiovascular Interventions study).
So we built Handoff. It listens for care events, gives the medic spoken reminders, and shares a live record with the hospital. The medic stays focused on the patient, and the receiving team gets a head start.
What it does
Handoff is a real-time system with three parts: a chest-worn bodycam that streams audio and video and measures compression rate, a Raspberry Pi 4 vitals relay with a MAX30101 finger sensor, and a hospital dashboard. All three read and write one live incident record in SpacetimeDB. Nemotron agents handle speech, vision, and hospital routing, while fixed code runs the timers, dose-range checks, and allergy checks.
| Moment on the call | What Handoff does |
|---|---|
| CPR starts | Coaches rate and pauses out loud from the bodycam's motion sensor |
| Medic says a medication | Reads it back, checks dose range and allergies, asks "Log it?" |
| ID card in view | Reads name and birth date, pulls the mock EHR record |
| Cardiac arrest | Picks a hospital with a cath lab and posts a pre-arrival alert |
| Arrival | Generates a MIST report where every line cites a fact in the record |
Helping the paramedic
The bodycam sits on the chest. Its mic feeds the voice agent, and its motion sensor measures how fast the rescuer is doing compressions.
Handoff can:
- Coach CPR rate and pauses out loud once CPR starts.
- Remind the crew about rhythm checks and medication delivery timers.
- Read back a spoken medication, dose, and route, then check the dose against fixed ranges and the patient's record for allergies.
- Log spoken care events, findings, and status changes on a timeline.
- Read a synthetic patient ID card, or search the mock health record from a spoken name and date of birth.
- Answer questions like, "Handoff, what have we given so far?"
When the medic does something like give a med, Handoff asks, "Log it?" The event shows up in the record right away, and the medic can confirm or cancel it. If the dose or allergy check raises a warning, Handoff flags the event for review.
The camera also picks out things like airway devices and AED pads. Detecting medication administration on camera is a stretch feature.
Relaying vitals
A Raspberry Pi relay takes readings from a MAX30101 finger sensor and sends heart rate and an experimental oxygen saturation reading to the shared record. It also has a display and a MARK button that drops a marker on the timeline.
Preparing the hospital
The dashboard shows the live camera feed, patient status, vitals, patient record, and event timeline, plus short updates on what the agents are doing.
When an incident goes into cardiac arrest, a workflow agent picks a destination from a list of fictional hospitals and posts a pre-arrival alert. For an arrest, the prototype requires the hospital to have a cath lab.
Hit Generate Handoff and it builds a MIST report (Mechanism, Injuries, Signs, Treatment) from the shared record, with source references. Checks drop any line that has no valid reference or fails our fact checks.
How we built it
One shared record with SpacetimeDB
Handoff's whole backend is one SpacetimeDB module written in TypeScript and published to Maincloud as handoff-hackutd26. There's no separate API server, message broker, or cron job. The tables, the business logic, and the scheduler all live in the database.

- 18 tables, one incident. The incident, vitals, waveform, CPR state, transcript, timeline events, timers, callouts, ER messages, agent trace, patient record, and handoff report are all tables in the module. Two private tables hold rule bookkeeping and the tick schedule. Everything else is public so clients can subscribe to it.
- Every device writes through reducers. About 30 reducers are the only way to change data, and each one runs as a transaction. Reducers also check input: e.g. a vitals message without a simulated flag is rejected.
- Mixed clients. The Raspberry Pi relay has no SDK. It calls push_vitals once a second and push_waveform every 200 ms over SpacetimeDB's HTTP reducer endpoint. The bodycam, the hospital dashboard, and both Node agents use the TypeScript SDK over WebSocket.
- Subscriptions instead of polling. The voice agent and the workflow agent subscribe to the tables at startup, and the React dashboard uses the useTable hooks. A medication read back on the bodycam shows up on the hospital screen as soon as the reducer commits, with no extra code.
- Logic runs inside the database. tick_rules is a scheduled reducer that fires every second. Each tick, it:
- runs the callout rules: push faster or slow down from the CPR rate, a two-minute rhythm check, medication-due reminders, heart rate under 50 or over 150, SpO₂ under 90, and a finger sensor that came off
- limits callouts to one every 4 s, most urgent first, and never queues the same words twice
- prunes old data: waveform after 30 s, vitals after 30 min, WebRTC handshakes after 10 min, and unspoken callouts after 20 s, so nobody ever hears stale advice

- One speech queue. The rules and the Nemotron voice agent both write to the callout table. The speaker picks the lowest priority number first and calls callout_spoken when it finishes. That gives us one queue, one spacing policy, and one audit trail for everything the system says aloud.
- Merging in the module. If two sources report the same kind of event within 60 s, the module adds the second as another source on the first event. That's how a spoken medication and the camera reading its label become one timeline entry with two evidence chips.

- Live video handshake. The bodycam and the dashboard trade WebRTC offers, answers, and ICE candidates through the rtc_signal table, so we didn't need a separate signaling server.
- Demo scenarios are database rows. The /controls page calls demo_control. The arrest, return of pulse (ROSC), seizure, and normal-vitals scenarios each put a row in vitals_override. While that row exists, tick_rules writes the scenario's vitals each second and the real relay data isn't stored, so screens never flicker between real and simulated numbers.
NVIDIA Nemotron for language, vision, and speech
Every model call goes to NVIDIA's hosted API with one API key. Nothing is self-hosted. We picked each model by how much time its job has:
| Job | Model | Time budget |
|---|---|---|
| Voice agent, tool calling, keep/drop | nvidia/nemotron-3.5-lightning-30b-a3b | 6 s per turn |
| Vision on bodycam frames | nvidia/nemotron-3-nano-omni-30b-a3b-reasoning | about 1 frame/s, 1.4 s each |
| Hospital pick and ER alert | nvidia/nemotron-3-ultra-550b-a55b | 14 s |
| MIST handoff report | nvidia/nemotron-3-ultra-550b-a55b | 27 s |
| Speech recognition | Riva Parakeet CTC 1.1B via Pipecat | streaming |
The voice agent runs with tool calling (tool_choice: auto) and thinking turned off for speed. It falls back to nemotron-3-ultra-550b-a55b if that model isn't available.
- Prompt. Each turn gets a 200–300 token state summary rebuilt from SpacetimeDB: status, patient record, vitals, a trend line, what the camera sees, CPR stats, timers, recent events, and the transcript.
- Tools. get_timeline, get_recent_transcript, log_event, set_status, check_dose_range, check_allergy, search_ehr, and pull_record, which pulls the record from a mock EHR over FHIR R4. A speak tool adds a callout to the shared queue.
- Keep or drop. For every line it hears, Nemotron first decides whether the line is about this patient or meant for Handoff. We never store the room talk it drops.
- Deadline. A turn gets 6 s. If it runs out, the agent stays silent and the fixed-code guardrails stay on as the safety net.
- Proactive advisories. Every 10 s, if the state changed, Nemotron decides whether one short advisory would help, such as SpO₂ falling while heart rate climbs. Advisories cap at 15 words and one every 15 s, and we throw out any advisory that names a fact the record doesn't hold.

Vision. nvidia/nemotron-3-nano-omni-30b-a3b-reasoning gets about one frame per second from the bodycam's WebRTC video, at roughly 1.4 s per frame. It:
- reads ID cards (name and birth date), which starts the EHR lookup
- spots a medication being given, AED pads, an airway device, or an IV/IO line
- writes a one-sentence scene description that the voice agent uses as context
A sighting only counts at confidence 0.7 or higher. If the camera sees a medication that no one said out loud, we flag it until the medic confirms it.
Speech recognition uses NVIDIA Riva's hosted Parakeet CTC 1.1B through Pipecat, with clinical words like medication names boosted.
Workflow agent. It runs on nvidia/nemotron-3-ultra-550b-a55b.
- W1. When an arrest starts or transport begins, it picks a hospital (an arrest needs a cath lab and free beds) and drafts the pre-arrival alert to the ER.
- W4. It drafts the MIST handoff report. Every line has to cite fact IDs taken from the tables.
- Self-check. Code drops any drafted line with no source, a number its cited facts don't contain, or an unsupported claim (such as sex, shocks, or intubation).
- Fallback. If the model fails or misses its deadline (14 s for the alert, 27 s for the report), the template fills in what's missing.

What the model never decides. Medication read-back, dose ranges, and allergy checks run in fixed-code guardrails, and the agent speaks their fixed wording. The model can't log a medication or a shock itself, and the speak tool rejects any number that isn't in the record.
Visible reasoning, not hidden reasoning. Every model decision goes to SpacetimeDB's agent_step table, and the hospital dashboard shows it as a live decision log labelled "Nemotron". Judges can watch each tool call happen.
Hardware and dashboard
We built three physical components: a chest-mounted bodycam, a Raspberry Pi vitals relay, and a ModRetro Chromatic handheld display. We also designed and 3D-printed the bodycam mount, the relay enclosure, and a finger clip.
Chest-mounted bodycam. A smartphone runs the bodycam page in Chrome. Its rear camera and microphone send video and audio to the voice worker over WebRTC, and the worker sends spoken read-backs and reminders back for playback. The bodycam also sends camera frames to the Pi hub, which relays them to the hospital dashboard. The dashboard marks the feed as stale when frames stop.
CPR motion detector. It reads the bodycam's acceleration data, filters the signal, and detects repeated motion peaks. It estimates compressions per minute from the median time between recent peaks and tracks pauses. The detector is connected to the bodycam page.
Finger sensor and signal processing. The relay uses a Raspberry Pi 4 and a MAX30101 optical sensor connected over I²C. The sensor shines red and infrared light through a fingertip and measures changes in the received signal. We sample at 400 samples per second and average every four samples, which gives 100 readings per second.
The Pi processes about four seconds of infrared data at a time. It filters the signal, estimates heart rate from detected beats, and checks that estimate against the strongest frequency in the signal. The code withholds heart rate when the signal is saturated, settling, or too noisy.
For the experimental oxygen saturation estimate, the code compares the red and infrared pulse signals, checks signal quality, and waits for three estimates to agree before it shows a value.
Relay to the shared record. A Python service sends the sensor state to a hub on the Pi. A separate bridge forwards fresh heart rate and oxygen saturation readings to SpacetimeDB about once per second. If the hub stops updating for three seconds, the bridge stops forwarding instead of repeating old readings. The bridge also supports a physical MARK button that adds a timestamp to the incident timeline. We tested the forwarding path locally.
Handheld vitals display. A ModRetro Chromatic handheld works as a separate vitals display. The Pi sends heart rate data to it over Bluetooth, so the crew gets a local view of the reading while the hospital dashboard receives data through SpacetimeDB.
In a test with the real Pi, heart rate readings reached the cloud record. The sensor also produced experimental oxygen saturation values after the signal settled.
The hospital dashboard and operator controls are React, TypeScript, and Vite. The health record is a mock FHIR R4 server with five synthetic patients.
Challenges we ran into
Medication names in a noisy room
Speech recognition kept mixing up short medication names and routes. We added custom clinical vocabulary, mapped the common mistakes, and made the agent ask for clarification when it can't tell which medication it heard.
Medication details arrive in pieces
Medics don't always say the medication and dose in one sentence. We built a short-lived collector that combines medication, dose, and route across several statements, and asks for whatever's missing.
Too much speech
Early on, the agent kept replying to room conversation and talking when nobody needed it to. We changed the speech policy: Handoff only speaks model-generated replies when the medic addresses it. Fixed reminders, read-backs, and warnings still follow their own rules.
We also hold back lower-priority callouts after a question, so the medic has time to answer.
Network limits
The venue network made device-to-device video really hard. For the demo, the dashboard gets a live frame feed through the Pi hub instead. It marks the feed as stale when frames stop coming.
Model rate limits
A reconnect bug left old vision tasks running, which caused duplicate model requests and rate-limit errors. We fixed the cleanup and added backoff and request limits.
Accomplishments that we're proud of
- You can put on the bodycam harness, mime CPR, and hear rate coaching.
- In a live audio test, our deterministic medication read-back started about 0.2–0.4 seconds after the speaker stopped talking.
- A real finger sensor sent heart rate readings through the Pi into the shared record.
- The vision model read a synthetic ID card, which kicked off a search of the mock health record.
- The dashboard showed the shared incident live, and the report generator produced MIST lines with source references.
- Time-based rules run separately from the language models.
What we learned
A good voice agent has to know when to stay quiet. In our tests, timing and restraint mattered as much as what it said. We fine-tuned a lot of settings to balance being helpful with not being disruptive.
We also learned to keep time-sensitive rules and medication checks in fixed-code guardrails. The model interprets language and picks tools, and the guardrails run on explicit inputs and rules.
Last, testing with a real bodycam and a real mic caught problems we never saw in text-only tests. Background noise, interruptions, network delays, and repeat connections all changed how the system behaved.
What's next for Handoff
- Test CPR rate measurement and medication read-back with EMS instructors and training manikins.
- Improve camera detection and test it on real frames of medication administration.
- Connect to a real health information exchange through FHIR, with the required access and privacy controls.
- Export the chart in a NEMSIS-compatible format.
- Add a channel for the receiving hospital to ask the crew questions.
- Add direct bodycam video to the hospital and a tested offline mode.
- Explore agency bodycams and a smart medication kit.
Built With
- aiohttp
- elevenlabs
- fastapi
- fhir
- html5
- max30102
- node.js
- nvidia-nemotron
- nvidia-nim
- nvidia-riva
- parakeet
- pipecat
- python
- raspberry-pi
- react
- silero-vad
- spacetimedb
- systemd
- tailscale
- three.js
- typescript
- vite
- webrtc
- websockets

