-
A voice-first simulator where medical students practise real conversations with AI patients who have their own feelings, secrets and lies.
-
Under the hood: moods and body-language tells (gaze-avert, blinks, a real cough) driven live by the patient's emotional state.
-
Choose your patient. 13 patients, each with their own case and personality.The card in focus loads a live 3D avatar that follows your cursor
Patiently: the patient who doesn't make it easy
Before writing any code, we interviewed five medical students and a patient actor. The same three problems kept coming up. Patiently answers each one.
| What we heard | Why it matters | What Patiently does |
|---|---|---|
| "Patients dismiss you as just a student, or because of your gender or background." | Students meet disrespect and doubted authority on the ward, but no training prepares them for it | Patients who doubt the student, hold back and lie, and open up only once the student earns their trust |
| "Feedback is rare, vague or missing." | Students can't tell what to change | Instant Calgary-Cambridge feedback when you hang up, read aloud by a teacher avatar |
| "Actors are rare, and your peers are watching." | Few attempts, and no room to fail in private | Unlimited one-to-one voice practice, any time |
Try it: https://patiently-hackatum-avelios.fly.dev (access code on request)
What it does
A patient you talk to, face to face. The student speaks and the patient answers in real time. A 3D avatar lip-syncs to the voice and shows pain, fear, sadness or irritation as the consultation unfolds.
A patient with an inner life. Seven variables (trust, connection, understanding, compliance, anxiety, pain and irritation) change with every turn. Empathy and plain language build connection. Jargon and interruptions cost trust. The patient's tone of voice and facial expression follow the state.
Lies and tells. Cases carry authored lies, each with an admission gate. The patient denies the drinking, the missed tablets or the affair until the student has earned the truth. Lies show on the face as a glance away, so an attentive student can read them.
Feedback the moment you hang up. A Coach grades the transcript against the Calgary-Cambridge model, with specific strengths, specific fixes and one phrase to try next time. On the review page the patient's face changes role and the same avatar, now the teacher, reads the feedback aloud.
Twelve cases, thirteen patients. Cases are built from NICE and NHS guidance, with a patient configurator to choose who you meet.
How it works
BROWSER OPENAI REALTIME SERVER
+----------------------+ +-----------------+ +------------------+
| Student mic ------ | ----> | | | |
| | audio | Patient voice | <---> | Patient engine |
| 3D avatar + lip-sync | <---- | (speech model) | side | state, lies, |
| | voice | | band | events, tells |
| Mood + tells <--- | ----------------------------------- mood + tells |
+----------------------+ +-----------------+ +------------------+
|
| hang-up
v
+----------------+ +------------------+
| Teacher avatar | <-- | Coach review |
| reads feedback | | Calgary-Cambridge|
+----------------+ +------------------+
Audio goes straight from the browser to OpenAI over WebRTC, which keeps replies fast. The server listens on a sideband channel, runs the patient engine on every turn and updates the patient's instructions. The browser only receives a mood label and the tells, never the patient's state or secrets, so students can't read the answers from the page.
Inside the patient engine
Student turn
|
v
+------------------------------------------------+
| Tracker labels |
| empathy, jargon, open question, delivers-news |
+------------------------------------------------+
|
v
+------------------------------------------------+
| State deltas + case events | ---> Tells
+------------------------------------------------+ gaze aversion,
| cough, crying
v
+------------------------------------------------+
| Seven state variables (low / mid / high) |
| trust, connection, understanding, compliance, |
| anxiety, pain, irritation |
+------------------------------------------------+
| | |
v v v
Voice tone Facial mood Admission gates
|
v unlocked
Patient can confess
Say the student breaks bad news. The tracker labels that turn as delivering news, which fires a case event. The event drives the patient's anxiety up, so the face turns fearful and the voice changes. The same event can also unlock a confession the patient has been holding back. Every step is logged with its cause, so the whole chain can be replayed afterwards.
Reading the student's face
Much of bedside manner is non-verbal, so in the face lab the patient also reads the student's face. The whole vision pipeline runs in the browser, so face images never leave the student's device.
1. A 68-dimensional face vector, five times a second. MediaPipe Face Landmarker gives 52 blendshapes and the head pose. HSEmotion (enet_b0_8_va_mtl, an EfficientNet-B0 run with ONNX on WebGPU) reads a 224 × 224 face crop and returns 8 emotion probabilities plus valence and arousal. A 5-second calibration on the student's resting face sets the zero point.
e_t = [ blendshapes (52) | head pose (6) | softmax(emotions) (8) | valence, arousal ] ∈ ℝ⁶⁸
z_t = (e_t − μ_neutral) / σ μ_neutral = mean of e_t over the 5 s calibration
2. Learning how one face moves another. To learn which expressions actually matter, we trained on Meta's Seamless Interaction dataset: about 20 GB of filmed two-person conversations with both faces on camera. We treat the listener's facial response as a proxy for their inner emotional state, and fit linear maps from one person's face to the change in their partner's. A learned 68 → 34 bridge projects our features onto Meta's face dimensions. From 82 conversations we keep a variable only if it beats chance, measured against a shuffled-partner baseline: the same face paired with someone else's conversation partner.
Δŝ_partner = W · z_student + b fit on 1-second means
keep v ⇔ R²_cv(v) > 0 and R²_cv(v) > max R²(shuffled partners)
3. Did your face fit the moment? For each patient line, a language model predicts the face a caring listener would show (valence, arousal, happiness, sadness, surprise). We score the student's actual face against it:
a = cos(f̂_expected, f_student) = ⟨f̂, f⟩ / (‖f̂‖ · ‖f‖) ∈ [−1, 1]
4. From markers to the patient's state, grounded in psychology. Our literature research on how one conversation partner's face shapes the other's emotional state gave us three kinds of signal. We reduce the face to interpretable markers m, each a z-score against the student's own calibration, clipped to ±3, and weight each kind differently:
| Kind | Markers | How it counts |
|---|---|---|
| Always positive | Nodding while the patient speaks, eye contact | Always builds the state. Nodding is measured against the rate expected at that moment, a curve fitted on the Seamless conversations |
| Depends on the moment | Smile, Duchenne smile, positive valence, concern | Gated by the fit a. A smile helps when the patient shares something positive, and costs trust when they are frightened (a < 0) |
| Always negative | Dominance, hostility | Always lowers the state, whatever the context |
The Duchenne marker is the cheek raise (AU6) that the mouth smile does not explain, which separates a felt smile from a polite one. Weights come from the literature by default, with a data-fitted set as an alternative.
Δv = clip( g · ( a · Σ_{k ∈ context} W_vk · m_k + Σ_{k ∈ positive ∪ negative} W_vk · m_k + w_v · a ), ±cap )
W_vk > 0 for nodding and eye contact, W_vk < 0 for dominance and hostility
The move enters the patient engine like any other input. It is clamped to the patient's bounds, and it can open an admission gate or fire a case event. So the student's face, and not just their words, decides whether the patient opens up.
How we built it
| Layer | Technology |
|---|---|
| Web | React 19, Vite, TanStack Router |
| Voice | OpenAI Realtime over WebRTC with a server sideband |
| Avatar | TalkingHead (three.js) with audio-driven lip-sync and custom moods |
| Face reading | MediaPipe Face Landmarker, HSEmotion via onnxruntime-web (WebGPU), maps fitted on Meta's Seamless Interaction dataset |
| Server and engine | Node, Hono, TypeScript packages for the engine, cases, debrief and avatar |
| Hosting | Fly.io |
We worked spec first: every feature started as a short spec and a set of tickets, and every phase ended in a review and a fix round. The codebase has over 2,000 automated tests, and an evaluation harness plays live sessions to catch the patient leaking secrets, inventing facts or breaking character.
Challenges we ran into
Making the patient feel live. Round-tripping audio through our server added latency. We kept audio peer-to-peer with OpenAI and drove the avatar's mouth from that same audio stream, so lip-sync costs no extra round trip.
Emotion that isn't a keyword match. Our first crying reaction fired on phrases, so the patient cried at "I'm afraid this might feel cold." We moved bad news into the engine itself: a tracker label, a case event and a state change, the same path every other emotion takes.
A lie that is believable and breakable. If the patient confesses too easily, there's nothing to practise. If the patient never confesses, the student can't succeed. Admission gates tied to rapport, or to a moment in the case such as hearing bad news, give the student a fair path to the truth.
What we learned
Realism comes from consequences more than graphics. A plain avatar that reacts to how it's treated feels more alive than a perfect face reading a script. We also learned that a patient with hidden state needs strict separation: the student's browser gets the face, never the numbers.
What's next
- Photoreal and full-body avatars, matched to each patient's age and background
- The patient's own feedback in the debrief: how the consultation felt from the other chair
- The face lab: reading the student's own expressions to see whether their face matched their words
- Progress tracking across sessions, and more cases written with clinical educators