Skip to content
chilldanilPublic

About

Voice-first virtual patient simulator for medical students with move-by-move review and counterfactual replay.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

BodyBuddy — Your virtual patient. Your real learning buddy.

CI Tests Python React License: MIT


Why BodyBuddy

"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.

Product Tour

Live voice consultation with real-time Arcade Mode feedback

Move-by-Move Game Review Counterfactual Replay & Interview Graph
Move-by-move feedback Side-by-side retry comparison
Every turn is graded from Brilliant (!!) to Blunder (??) with trust impact, live DDXPlus Naive-Bayes differential, and stronger alternatives. Every student move checkpoints both patient and clinical engines — branch from any exact moment and compare decisions side by side.
Targeted Voice Puzzles Longitudinal Skill Profile
Interactive voice puzzle OSCE skill profile
Short 2–3 move voice drills (including puzzles built from your own mistakes) targeting red flags, half-truths, and escalation. Tracks competency trends across consultations, surfaces recurring blind spots, and suggests targeted next cases.

Clinical Engine & Game Review

BodyBuddy move classification scale and deterministic formula V = 2P + I + C + N - R
  • 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 at 45.
  • 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.

Architecture

System architecture

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.

Running Locally

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 build
Configuration, 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

Endpoints (OpenAPI at /docs)

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

Cost per consultation (Nov 2026 list prices)

  • 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

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.

License

MIT

About

Voice-first virtual patient simulator for medical students with move-by-move review and counterfactual replay.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages