Inspiration
Medical students need low-stakes, repeatable practice interviewing patients, taking histories, and handling nuanced or guarded clinical stories before high-stakes exams or real rotations. Digital patients make that practice accessible on demand, while keeping room for structured clinical reasoning and human clinical oversight.
What it does
Virtual Interview Patient simulates a conversational patient encounter where learners interview a persona with a defined chief complaint, mood, communication style, and conditional facts that unlock based on rapport and topics explored. It pairs natural layperson dialogue with deterministic session state tracking so the patient stays consistent across turns without diagnosing itself or breaking character.
How we built it
We built a FastAPI backend paired with a React + TypeScript + Vite frontend and a SQLite store for session state, transcripts, and LLM token/cost tracking. Patient personas are defined as structured JSON cases (including progressive disclosure triggers, speech patterns, and emotional arcs) with LLM-assisted case generation from free-form text via OpenAI, Whisper transcription, optional local Kokoro ONNX emotion-paced TTS, and webcam emotion tracking via DeepFace.
Challenges we ran into
Keeping LLM roleplay strictly in character, avoiding premature history dumps, and updating trust, anxiety, and conviction smoothly across turns required careful prompt assembly and output clamping. We also had to decouple voice, TTS, and UI state cleanly so audio playback, microphone turn-taking, and optional local models degrade gracefully when hardware or ONNX files are absent.
Accomplishments that we're proud of
We shipped an end-to-end interview loop featuring voice and text turns, dynamic patient emotion and state shifts, on-the-fly patient creation from clinical notes, session scoring with missed-fact feedback, and real-time token/budget telemetry.
What we learned
Prompt guardrails alone work best when paired with explicit session state, schema-validated JSON responses, and clear boundaries between clinical simulation and post-interview evaluation. Measuring full turn-taking latency and token costs early also makes voice-driven demos much easier to tune.
What's next for Virtual Interview Patient
We plan to add formal state-gated fact unlock tracking, automated consistency checks over longer interviews, richer avatar animation hooks, and production hardening (auth, rate limiting, PostgreSQL, and clinician case review)[cite: 1].