Inspiration
Medical students learn history-taking with actors who play patients. There are never enough of them, slots are short and you only get a few tries, so you go in nervous. We wanted a patient you can practise with whenever you want, as often as you want, that still behaves like a real person: one who downplays things, rambles, gets worried, and only tells you the important stuff if you ask the right way.
What it does
You pick a rotation (cardiology, neurology, ENT, ... 21 in total) or let it bring you a random patient, and you talk to them by voice or text. Each patient has a full story, a personality and an accent, and an avatar that reacts while they talk.
The patient doesn't hand you the case. Things come out in stages: some on an open question, some only if you ask specifically, some first as a vague answer ("now and then") and the truth only if you follow up, and the private worries only once the patient trusts you. Rapport goes up with open questions and empathy and down with jargon. If you interrupt, the patient stops and only what they actually said stays in the chat.
In the advanced level you can also examine the patient: listen to the heart and lungs (sounds at the patient's real rate), check vitals, palpate the belly, record an ECG, do a neuro exam or look at a skin lesion. If something hurts, like a tender belly, the patient reacts with real pain.
At the end you get feedback like in an OSCE station: the three things to work on next, a checklist specific to that patient, communication criteria that are the same for every patient (based on the Calgary-Cambridge guide and the Kalamazoo consensus statement), and what you uncovered and missed, red flags included. The point is the history, so guessing the diagnosis is optional; if you do, it tells you whether you were right and which clue pointed to it. If you want, your sessions are saved in your browser so you can see what keeps going wrong and what got better.
Teachers get a Patient Constructor: pick a rotation and a diagnosis (or describe a patient in a few lines), and it writes the whole case (staged facts, how the patient says things, red flags, exam findings, diagnosis, checklist, voice, look). You can change the personality, voice or life story of the same case, and three robot students interview the new patient before you save it, to check it doesn't leak or make things up.
How we built it
The patient talks through OpenAI's realtime voice model over WebRTC, so it answers right away instead of going speech-to-text, LLM, text-to-speech one after the other. A second model, the Director, checks every reply after it's said: what was revealed, whether something leaked, was invented or contradicted, which emotion the patient showed, and how trust changes. When something goes wrong it sends the patient a short private correction. Private facts aren't even in the patient's prompt until trust is high enough, so they can't slip out.
Backend is FastAPI in Python, frontend is plain HTML/CSS/JS. The avatar is drawn in SVG from the case data and reacts to trust, the Director's emotion and the audio level. Heart and lung sounds are made with WebAudio, the ECG is drawn live on a canvas. Feedback is graded by GPT-4.1 against a fixed rubric and the case checklist.
To show the patient behaves well beyond one lucky demo, we built a "Patient CI": robot students (thorough, lazy, jargon-heavy, adversarial) interview the patients and we measure recall, leaks, inventions and contradictions. We used it to compare four ways of supervising the patient and kept the Director because it was fast and honest enough.
Challenges we ran into
Keeping the patient from telling everything at once. Our first versions either overshared or, when a private fact was hidden, flat out denied it ("no, nothing in the family"), which then contradicted itself later. Now locked topics get deflected instead of denied.
The realtime model sends the text much faster than it speaks, so when you interrupted, the full paragraph still showed up. We now show the text in sync with the voice and tell the model exactly how much the student heard.
Latency versus control: checking every reply before it's said is safer but too slow for voice, so we check right after and correct on the next turn.
Accomplishments that we're proud of
51 patients across 21 departments, two or three per rotation, each with a different personality and background. The same disease can feel completely different depending on who the patient is. And a way to measure the patient's quality instead of just hoping.
What we learned
Most of the work isn't the voice, it's keeping a story consistent over 15 minutes while the student steers. And small things like the patient's first sentence matter a lot: if it says too much, the exercise is over.
What's next
Have doctors review the cases (they are generated and need a medical check), let the patient's voice follow the emotion the Director detects, more examination tools, and saving progress across devices.
New in the latest version
- Breaking bad news practice: 8 patients come back for their results. SPIKES steps tick live as you go, and the feedback follows SPIKES.
- OSCE timer and Hint in the interview: a 5, 8 or 12 minute countdown, and a hint that only names a topic you have not covered yet.
- Present your patient: after the interview you present the case as on a ward round, typed or dictated. It is graded only against what the patient actually said.
Built With
- claude
- fastapi
- javascript
- openai
- python
- svg
- webrtc
