"It's 11 p.m. Tomorrow, you meet a real patient. You've read the textbooks, studied the symptoms and memorised the theory. But who can you practise with?"
Simulated-patient actors are expensive and hard to schedule, leaving medical students with only a few practice slots. BodyBuddy (built for HackaTUM 2026 — Avelios challenge) turns clinical history-taking into an on-demand voice simulation with structured feedback, move-by-move review, and counterfactual replay.
- Deterministic scoring (
V = 2P + I + C + N − R): combines expert priority (P: SOCRATES, Calgary–Cambridge, ICE), expected information gain (I) over a tempered Naive-Bayes DDXPlus differential, context (C), novelty (N), and repetition (R). - Four-state safety gate (
pass/concern/unverified/fail) — premature reassurance or unaddressed red flags fail the gate and cap the OSCE composite at45. - Verified facts & knowledge firewall: facts only count once actually voiced by the patient; hidden diagnoses and private patient state never leak before scoring.
See docs/clinical-engine.md and docs/RUBRIC.md.
| Layer | Responsibility |
|---|---|
| Patient engine | DDXPlus (720 cases, 12 conditions) + curated GP cases + longitudinal record + rapport state machine + knowledge firewall. |
| Voice | ElevenLabs Conversational AI & TTS for speech, interruptions, and call limits; transcript reconciled against saved turns before scoring. |
| Clinical engine | Clause-level semantic parser (auto / llm / rules) + deterministic policy evaluator streaming live coaching over SSE. |
| Assessment & replay | OSCE composite, safety gate, Game Review, /fork checkpoints, and personalised puzzles. |
| Frontend | React 19, Vite, TypeScript, Tailwind CSS v4, Zustand, React Router — includes an offline demo fallback when no backend is running. |
Requires Python 3.14+, Node.js 22+, OPENAI_API_KEY, and optionally ELEVENLABS_API_KEY (runs in text mode without it).
# Backend (http://127.0.0.1:8000)
cd backend
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
cp .env.example .env
sh run.sh# Frontend (http://localhost:5174)
cd frontend
npm install
npm run dev# Single-container Docker build
docker build -t bodybuddy .
docker run -p 8000:8000 --env-file backend/.env -e ACCESS_PASSWORD=choose-a-password bodybuddy# Tests & build
cd backend && .venv/bin/pytest -v # 211 offline tests
cd frontend && npm run buildConfiguration, API overview & cost estimate
Environment variables (backend/.env, see .env.example)
| Variable | Default | Purpose |
|---|---|---|
OPENAI_API_KEY |
— | Live patients, semantic parsing, judging |
ELEVENLABS_API_KEY |
— | Voice consultations and puzzles |
OPENAI_PATIENT_MODEL |
gpt-5.6-luna |
Patient reply generation |
OPENAI_CLASSIFIER_MODEL |
gpt-5.4-mini |
Turn classification |
OPENAI_JUDGE_MODEL |
gpt-5.6-luna |
Final scoring |
GAME_PARSER |
auto |
auto, llm, or rules |
VOICE_MAX_DURATION_SECONDS |
900 |
Call cap (60–7200s) |
SESSION_STORE_DIR |
data/sessions |
Saved session JSONs |
ACCESS_PASSWORD |
empty | Optional HTTP Basic gate |
FRONTEND_DIST |
empty | Serve built frontend from FastAPI |
| Endpoint | Purpose |
|---|---|
GET /api/v1/conditions |
Available cases |
POST /api/v1/sessions/stream |
Build patient with streamed progress |
POST /api/v1/sessions/{id}/turn |
Send doctor turn, get patient reply |
POST /api/v1/sessions/{id}/voice-token |
Start ElevenLabs voice session |
POST /api/v1/sessions/{id}/finish |
Reconcile transcript & score |
GET /api/v1/sessions/{id}/game |
Game Review (live via /game/stream) |
POST /api/v1/sessions/{id}/fork |
Retry from a chosen move |
GET /api/v1/profile |
Skill profile & recommended cases |
GET /api/v1/puzzles |
Puzzles from past consultations |
GET /api/v1/metrics |
Move-evaluation p50/p95 latency |
- Voice call: ~$0.08/min platform + ~$0.01/min voice model
- Scoring & Game Review: ~$0.04 per consultation
- Custom patient generation: ~$0.001
- ~$0.50 for a 5-minute voice consultation.
- docs/clinical-engine.md · docs/RUBRIC.md · docs/testing-guide.md
- docs/hackathon-story.md · docs/challenge-pitch.md · docs/pitch/ · BACKLOG.md
Note
All patients are synthetic and voices are AI-generated. Feedback is formative training output from a demonstration policy — not a validated exam grade and not medical advice.





