Skip to content
ZukipanyPublic

About

AMI · the virtual interview patient: talk to a live 3D patient, take the history on the iPad, get it scored. hackaTUM 2026, Avelios challenge

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

hackaTUM 2026 × Avelios challenge VIP · AMI, Virtual Interview Patient

hackaTUM 2026 Avelios challenge iPadOS

AMI · Virtual Interview Patient

Take the history. Get it scored. A virtual patient medical students can actually talk to, an iPad app to take notes by hand, and feedback on every part of the history. Built at hackaTUM 2026 for the Avelios challenge VIP: Virtual Interview Patient.

The AMI website

Why it matters: the history alone leads to the diagnosis in about 76 to 83% of outpatients (Hampton, BMJ 1975; Peterson, West J Med 1992). Students practise it on paid actors: a handful of slots, nervous, rarely repeated. AMI is practice on demand, as often as you want, with no one watching.


What it does

A practice session is four steps, the same on the website and in the pitch.

Step What happens
1 Case Pick a patient. The website shows a session code; the iPad app joins it.
2 Interview Talk to Emma Clarke, 28, a junior lawyer with a headache and no patience. She answers live with her own voice, face and body, and only tells you what you ask.
3 Notes and scan Write your notes by hand in AMI on the iPad and tap Submit. The website scans the page, reads the handwriting and checks every part.
4 Evaluation A score, a learning curve across sessions and five parts: Attentiveness, Questioning, Documentation, Foresight, Empathy, with the critical misses named plainly.
Talk to Emma Notes on the iPad
Emma in the interview AMI notes app on the iPad
The scan The evaluation
The scanner reads the page Score, progress and the five parts

Emma is a real patient, not a chatbot

  • Selective disclosure. Every fact has a rule: volunteered, on a broad question, only when asked directly, or forgotten until cued. "Ibuprofen. Obviously." to any medication?; the pill only when asked; the smoking with a sheepish "I know, I know."
  • Her own theory. She is sure it is her sinuses and wants antibiotics, a realistic confounder.
  • Signs you have to see. She squints at the light until you dim it, rubs only her left temple, swallows when she feels sick. Patients give clues in about half of visits; doctors respond to few (Levinson, JAMA 2000).
  • Emotion. When the stroke risk comes up, her armour cracks. Only an empathic answer resolves it.
  • Lay language and real timing. "Pounding, like someone's hammering behind my eye", never "photophobia"; a median reply delay of 0.62 s, with deliberate hesitation before reluctant answers.

The evaluation is grounded in the case

A physician wrote every case file and the scoring rubric. The notes are compared with the expected history field by field, so feedback is specific: aura asked but not written down, red flags never asked. At 80 of 100 the next patient unlocks (Emma again, now exhausted: the same story, a harder personality).


Results

Every number reruns from this repository.

Benchmark slide

Evaluation Result Where
Judge vs physician: does the patient judge see leaks, inventions, contradictions and jargon like a physician? 46 answers, physician-labelled 43 of 46 (93%), Cohen's κ 0.85 (95% CI 0.70 to 0.97) bench/gold/
Latency: end of the student's speech to Emma's voice, measured live median 0.62 s, 90% within 1.72 s bench/latency/
Turn-taking: pauses, "mhm", self-corrections, topic changes 25 of 25 (with patches/matcher_turntaking.patch), 9 of 10 on new scenarios bench/turntaking/
Live scorer vs physician: the rule-based scorer against the physician's hand evaluation 15 of 15 fields src/vip/scoring.py
Beyond the script: 38 questions outside the demo, judged blind 37 of 38 bench/offscript/
Second patient: Mr. Miller (chest pain, sceptic), all 51 bank questions, judged blind 49 of 51 bench/miller/
How students really talk: 90 paraphrased or misheard lines 76% right reply, 3% wrong bench/matching/
Student scoring by a model: blind model run vs the physician on 3 history takings same ranking, every planted critical error found bench/scoring/

Run it

Needs macOS with Python 3.11+. The live patient is frontend/. Each command starts the server on port 8000, stopping whatever ran there, and opens the right window. Ctrl+C stops it.

Command What it is
Test ./run/test.sh The scripted demo: Emma's lines on the arrow keys, prepared evaluation. No iPad needed.
Product ./run/product.sh The real thing: talk to Emma, take notes in AMI on the iPad, Submit, get scored from those notes.
Pitch ./run/pitch.sh The presentation around the live product, full screen in the AMI Pitch app (Space, a clicker or the iPad's slide buttons). Microphone and sound are pre-allowed; the evaluation and the iPad pairing are prepared, so it runs the same every time.
Record ./run/record.sh The whole pitch plays by itself for a screen recording: press Space once, nobody speaks. Emma's conversation runs with the doctor's questions as captions. About 4 minutes.

The iPad app: open ipad/Anamnese.xcodeproj in Xcode, pick your iPad and Run. In the app, Settings → server address = the address the server prints (for example http://192.168.1.23:8000). Details in ipad/README.md.

Benchmarks and tests

uv run --with pytest pytest                          # patient tests and scorer
python3 scripts/judge_agreement.py                   # rule-based judge vs physician labels -> bench/gold/report.md
python3 scripts/llm_judge_agreement.py               # language-model judge vs physician labels
python3 scripts/latency_report.py bench/latency/run*.json
node scripts/bench_matching.mjs --frontend frontend  # matcher on paraphrased and misheard lines
node scripts/bench_turntaking.mjs --frontend frontend

Secrets (ElevenLabs, OpenAI keys) go in .env, never in git.


How it works

flowchart LR
  subgraph Mac["Mac (browser)"]
    Site["Website<br/>web/site"]
    Emma["Emma, live patient<br/>frontend/ (TalkingHead, Three.js)"]
  end
  iPad["AMI on the iPad<br/>ipad/ (SwiftUI, Pencil)"]
  Server["Stage server<br/>scripts/stage_server.py"]
  Score["Scorer<br/>src/vip/scoring.py"]
  Cases[("Case files<br/>cases/*.toml")]

  Site --- Emma
  iPad -- "notes + handwritten page<br/>POST /api/anamnesis" --> Server
  Site <-- "session, submission,<br/>evaluation" --> Server
  Server --> Score
  Cases --> Score
  Cases --> Emma
Loading
  • Cases as data. cases/*.toml: facts with disclosure rules, lay wording per persona, signs with timing, emotions with empathic and non-empathic responses, red-flag negatives, ICE and the expected history with its critical items. A physician authored and reviewed every fact.
  • The live patient. A 3D avatar (TalkingHead, Three.js) with procedural hand and body animations and facial reactions per line, designed along validated pain action units. Her voice is ElevenLabs in three emotional registers with character-level timestamps for lip sync. The browser's speech recognition listens; a matcher with stemming and signal words picks her line, and a language-model backup answers questions outside the script from the case file.
  • AMI on the iPad. A SwiftUI app: questions prepared before the talk, answers in Apple Pencil handwriting or on-device dictation. Submit sends the structured notes and a picture of the page (docs/anamnesis_format.md).
  • The stage server. Python standard library only. It pairs the iPad with the website by a 4-digit session code, receives the notes, scores them in the background and drives the pitch remote.
  • Scoring. Rule-based and deterministic: the notes and the conversation's events against the case file (src/vip/scoring.py), plus a learner model per student that remembers what keeps getting missed (src/vip/learner.py).

Repository

Folder What is in it
cases/ The case files, the source of truth: migraine.toml (Emma), miller.toml (Mr. Miller), physician review sheets
web/site/ The website: practice flow, live patient, scanner and evaluation
web/present/ The pitch deck around the live product, recording mode (?rec=1), run sheet
web/hud/ Earlier stage screens and the data files the website reads (web/hud/data/)
ipad/ AMI, the anamnesis app for the iPad (SwiftUI)
frontend/ Emma, the live patient: avatar, voice, lip sync, speech matching (Unreal MetaHuman stream optional, ?ue=1)
src/vip/ Scoring, learner model, prompt builder, patient tests
scripts/ The stage server and the benchmark scripts
bench/ Question bank, scripted students, physician-labelled gold sets and every benchmark report
prompts/ Persona prompts, timing and voice settings per patient
demo/ The scripted live demo (demo_lines.toml) and the cold open
pitch/ Pitch script and the Devpost text
docs/ How things work: live demo, evaluation, data format, references (index)
run/ The four launchers above
tools/pitch-app/ The AMI Pitch app: the deck full screen with microphone and sound allowed
tests/, patches/ Tests; the turn-taking patch for the matcher

Research basis

Full list with verification status: docs/references.md.

  • History: the history alone led to the diagnosis in about 76 to 83% of outpatients (Hampton, BMJ 1975; Peterson, West J Med 1992).
  • Migraine: ICHD-3 criteria (Cephalalgia 2018); migraine with aura rules out the combined pill (US MEC 2024, MMWR).
  • Non-verbal communication: clinical judgements rest largely on non-verbal cues (Schmid Mast, Patient Educ Couns 2007); patients give clues in about half of visits, doctors respond to few (Levinson, JAMA 2000).
  • Timing: gaps between turns are about 200 ms (Levinson & Torreira 2015; Stivers et al., PNAS 2009); pauses of 700 ms or more go with reluctant answers (Kendrick & Torreira 2015).
  • Pain face: Prkachin and Solomon Pain Intensity action units (Pain 2008).
  • Empathy: empathic opportunities (Suchman, JAMA 1997), NURSE responses (Back et al. 2005).

Team board: https://github.com/users/Schleglti/projects/1 · Submission text: pitch/devpost.md

Secrets (ElevenLabs, OpenAI keys) go in .env, never in git.

Fact gating server (custom LLM for the ElevenLabs agent, #14)

Per student turn: router (small model, structured output) labels asked fact IDs, topics and flags → deterministic state (vip.gating) → turn prompt with only the eligible facts plus memory → generator streams back. Router slower than 600 ms or failing → the full prompt (vip.prompt, same as prompts/). Log per session: logs/<session>.jsonl.

cp .env.example .env                                        # fill in the keys
uv run --env-file .env python -m vip.server --port 8000     # or: uv run python -m vip.server --fake (offline)
cloudflared tunnel --url http://localhost:8000              # public HTTPS (or: ngrok http 8000)
uv run pytest                                               # offline tests
uv run python -m vip.replay                                 # scripted run, 4 personas, median router time (--live: real LLM)

ElevenLabs agent → LLM → Custom LLM: server URL https://<tunnel>/<case>/<persona>/v1 (e.g. /miller/downplayer/v1, /migraine/exhausted/v1), API key = VIP_SERVER_KEY. Pass conversation_id in the custom LLM extra body to keep parallel conversations apart. Benchmark: vip.server.Session("miller", "downplayer").respond(history) returns the gated reply.

Change log

Version (CET) What changed
2026-11-29 03:10 README rewritten as a product overview: what it does, screenshots, results, the ways to run it, how it works, repository map. Planning documents moved to docs/archive/, docs index added
2026-11-29 02:50 Recording mode (run/record.sh): the whole pitch plays by itself
2026-11-28 21:48 Mr. Miller reported as 49 of 51 (the 51 of 51 rerun came after a rubric change and is kept in the report as post hoc)
2026-11-28 21:26 Learner model per student (no login) src/vip/learner.py: skill mastery, fields to practise until mastered, recommended next patient
2026-11-28 21:23 Mr. Miller benchmark (49 of 51); live scorer src/vip/scoring.py runs in the background on every Send
2026-11-28 20:47 Off-script backup benchmark (37 of 38); matcher patch for turn-taking (25 of 25, 9 of 10 held-out)
2026-11-28 20:09 Latency: system delay (0.62 s) and acted hesitation reported apart
2026-11-28 19:52 Language-model patient judge with physician tolerances: 43 of 46 (93%)
2026-11-28 17:27 First README outline of the project

About

AMI · the virtual interview patient: talk to a live 3D patient, take the history on the iPad, get it scored. hackaTUM 2026, Avelios challenge

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages