Codes by Shrey

NBME · Clinical AI · 2025

Clinical Roleplay Simulator

A virtual standardized patient system for practicing clinical conversations, surfacing communication patterns, and making patient-centered competence observable through repeatable AI roleplay.

At a Glance

  • Lead Product Engineer
  • React, TypeScript, RAG, ASR / TTS
  • Shipped MVP and live demo
  • 15 clinician tests
  • 3 feedback perspectives

Product

OSCE-style clinical roleplay simulator

Role

Lead Product Engineer

Methods

User testing, evaluation design

Outcome

Question-quality shift

People

The system serves medical learners, educators, and clinicians who need low-friction ways to rehearse patient communication without requiring live standardized patients every time.

Product

The product is an OSCE-style simulator with scenario-specific patient personas, text and voice interaction, transcript-aware dialogue, and structured formative feedback.

Problem

Clinical communication failures often happen inside the interaction: rushed pacing, missed emotion, jargon density, weak follow-up questions, and lack of repair when patients stop following.

Process

I moved from domain research to product scoping, scenario design, state architecture, LLM behavior control, clinician testing, and feedback-system iteration.

Not a chatbot. A behavioral simulation.

The goal was not simply to simulate a patient. It was to create a structured environment where communication patterns could become visible, discussable, and improvable.

Clinical communication is not a soft skill in this framing. It is observable clinical behavior under constraint: how a learner asks, listens, repairs, explains, manages uncertainty, and preserves patient autonomy while still gathering enough information to reason clinically.

Roleplay loop

Learner selects a scenario, enters a text or voice encounter, and practices under realistic patient constraints.

Patient behavior

Personas vary by emotional state, cooperation, disclosure behavior, tone, and response style.

Feedback output

Evaluation turns transcript behavior into developmental language, not just a score.

Communication Breakdown

In clinical environments, providers are trained to diagnose. They are not always trained to notice when the patient has stopped following the conversation, when discharge language is functionally unreadable, or when the interaction has become about throughput rather than understanding.

This was the lived problem that shaped the product: communication failure is often a predictable output of systems that reward speed, certainty, and documentation over trust, disclosure, and reflection.

Clinician

Clinical language, rushed pacing, dense explanation, or unacknowledged uncertainty.

The intent may be competent, but the interaction fails.

Patient

Confusion, anxiety, guarded disclosure, low adherence, or emotional shutdown.

The outcome depends on what was understood, not only what was said.

Training Gap

Learners need a rehearsal environment for the interaction itself, not only another knowledge check.

OSCE-style simulation makes behavior visible.

My Role

I worked across product, research, design, and engineering: defining the simulation loop, building the functional prototype, testing with clinicians, and using those findings to adjust scenario fidelity, persona behavior, architecture, and feedback usefulness.

UX Research

15 clinician user tests, persona validation, scenario complexity calibration, and feedback usability review.

Product

0-to-1 lifecycle ownership, MVP scoping, feature prioritization, and feasibility testing.

Technical

State architecture, RAG implementation, LLM behavior control, and ASR / STT / TTS workflows.

System design / architecture details

The system only became reliable once scenario, patient, conversation, and evaluator states were separated. Without that separation, the model's default helpfulness caused the patient persona to drift into advice-giving or clinician-like behavior.

Scenario

Defines the clinical prompt, task frame, OSCE-style requirements, patient overview, and encounter setup.

Independent from persona behavior.

Patient

Maintains emotion, cooperation, disclosure pattern, tone, and role fidelity throughout the encounter.

No evaluator rubric access.

Conversation

Stores visible turn-taking, transcript context, learner messages, patient responses, and voice/text interaction state.

Transcript-aware dialogue.

Evaluator

Assesses the full session after the encounter using clinical, communication, and professionalism criteria.

Post-session formative feedback.

The key architecture insight: helpfulness and role-persistence are in tension. Training simulation needs explicit boundaries around what each model state knows and when it is allowed to act.

Behavior Model

Each patient persona is defined by emotional state and cooperation level. Those variables are not decorative traits; they control disclosure, response length, resistance, tone, and whether the clinician has to earn the information needed for diagnosis.

A low cooperation score does not mean the session is impossible. It means the clinician's communication quality becomes the variable that unlocks the encounter.

Emotional State

Anxious, fearful, annoyed, frustrated, demotivated, blunt, or otherwise distressed in ways that affect dialogue.

Cooperation

A continuous behavioral scale that changes how easily the patient discloses information and stays on task.

Voice + Tone

Behavioral realism shows up through pacing, resistance, short answers, venting, and spoken delivery, not just text content.

Role drift and model behavior lesson

The original build surfaced a core AI design problem: the model's helpfulness can become a simulation vulnerability. When patient and evaluator context were not separated, the faux patient began optimizing toward resolution, clarifying too much, or advising the clinician.

Early build: state contamination

Patient accumulates evaluator context, model optimizes toward helpful resolution, and the patient persona begins behaving like a clinician. The simulation collapses because the test starts helping the learner pass.

Corrected build: state separation

Patient receives only the patient-relevant context, stays within persona, forces the clinician to adapt, and leaves evaluation to a separate post-session state.

Any AI system where role fidelity matters needs explicit architectural separation between what the model knows and what role it is currently playing.

Core Design Tradeoff

More realism does not automatically create a better training system. If everything varies, evaluation becomes inconsistent and feedback loses meaning. The system chose evaluability as the constraint and realism as the target within it.

Realism

Variation, emotional nuance, unpredictable patient behavior, and clinical conversation texture.

Evaluability

Controlled variation, stable rubric language, comparable sessions, and feedback that remains useful across users.

Evaluation Model

Evaluation uses a hierarchy: clinical competency functions as the hard constraint, communication behavior is assessed as observable interaction quality, and dialogue quality captures tone, pacing, sequencing, and repair.

Scenario-based

Given this patient and context, what should the clinician have noticed, asked, or repaired?

Dialogue-based

In this specific transcript moment, what alternative response would improve the interaction?

User-specific

Across a session, what communication pattern is emerging and what should the learner practice next?

Competency Model

The reflections from the simulated patient and evaluator pointed toward a more mature product artifact: a shared language for what good communication means in a simulated encounter.

Listening

Reflects, summarizes, asks clarifying questions. Failure mode: premature advice.

Epistemic Humility

Acknowledges uncertainty without losing clinical authority. Failure mode: false certainty.

Autonomy

Offers choice, asks permission, frames change collaboratively. Failure mode: compliance pressure.

Attunement

Names emotion and validates fear, frustration, or resistance. Failure mode: efficiency theater.

Explanation

Uses plain language, paces information, checks understanding. Failure mode: jargon dump.

Self-Regulation

Notices bias, fatigue, defensiveness, and premature closure. Failure mode: performative professionalism.

Agent reflections and assessment philosophy

After the system had played both standardized patient and conversational evaluator, the reflections became a useful qualitative artifact. They named the latent dimensions the simulator was already trying to assess.

Communication is clinical behavior

Patient satisfaction, adherence, disclosure, and trust depend on how clinicians listen, reflect, and explain, not only what they prescribe.

Systems shape clinicians

When communication is treated as an early-course checkbox, empathy decays. When it becomes a formal competency, behavior can improve.

OSCE as compressed moral laboratory

Under time pressure, learners reveal what has been internalized: curiosity or checklist thinking, empathy or efficiency theater.

Motivational interviewing

Autonomy before compliance, meaning before metrics. The simulator can make that difference observable in transcript behavior.

The deeper claim: if medicine wants fewer unheard patients, the answer is not only more content. It is better conversations, rigorously taught and repeatedly practiced.

Outcome

The MVP shipped as a working simulator and was tested with 15 clinicians. The most important shift was not a prettier scorecard; it was a change in how clinicians structured questions, paced information, repaired confusion, and turned feedback into practice language.

Product

Shipped a live clinical roleplay loop with scenario selection, transcript behavior, and formative feedback.

Research

Used clinician sessions to evaluate realism, feedback usefulness, scenario fidelity, and role behavior.

Technical

Designed state separation, RAG-supported context, voice/text workflows, and evaluator isolation.

Process + Progress

The project matured through a product loop: domain research, architecture decisions, prototype delivery, clinician testing, and a roadmap for longitudinal skill growth.

Research

Literature and domain review established the gap between clinical knowledge assessment and patient-centered communication practice.

Communication training gap.

Architecture

Scenario, patient, conversation, and evaluator states were separated to prevent role drift and evaluation leakage.

State separation.

Prototype

Built the roleplay loop with persona behavior, transcript-aware dialogue, RAG-supported context, and structured feedback.

Shipped MVP.

Testing

Clinician sessions focused on realism, feedback usefulness, scenario fidelity, and communication behavior changes.

15 clinician tests.

Roadmap

Next iteration: profiles, saved evaluations, shared rubric language, deeper clinical complexity, and challenge scenarios.

Longitudinal progress.

What Comes Next

Profile Tracking

Track clinician improvement across personas over time so growth becomes visible rather than session-by-session.

Shared Rubric Language

Create stable competency language across handoffs, coaching, and repeated encounters.

Clinical Complexity

Increase diagnostic nuance without sacrificing evaluation consistency or turning the simulator into an unreliable assessment environment.

Clinical Roleplay Simulator PRD details

Product Summary

The simulator gives learners a low-friction way to practice patient communication without live standardized patients. Learners choose a patient scenario, interact through text or voice, and receive structured formative feedback at the end of the session.

The product direction keeps the original generic virtual-standardized-patient concept, then extends it with stronger case structure, transcript memory, optional voice workflows, prompt customization, and evaluation reporting.

Problem

OSCE-style practice is expensive, scheduled, and difficult to repeat. Basic chat demos are easier to access, but they often lack scenario fidelity, patient consistency, and useful evaluation. The product bridges those gaps with a lightweight simulation environment.

Core Requirements

  • Expose a list of public scenarios from the backend.
  • Allow the learner to select either Generic VSP Mode or a structured patient scenario.
  • Initialize each conversation with a scenario-specific patient statement.
  • Display patient overview data during the encounter.
  • Append learner and patient messages to a visible transcript.
  • Preserve transcript history so patient responses stay coherent across turns.
  • Support typed messages, microphone input, browser-native speech recognition where available, and optional audio playback.
  • Generate structured evaluation JSON from the transcript and selected scenario.
  • Render evaluation feedback in a readable report.

Scenario Library

The MVP includes fixed scenarios with patient demographics, chief complaint, communication focus, description, allergies, medical history, medications, vital signs, and avatar image.

Scenario design should preserve role fidelity while allowing enough emotional and conversational variation for realistic practice.

Evaluation Categories

Evaluation covers history taking, communication skills, rapport building, clinical reasoning, and professionalism, with overall score, grade, strengths, priority improvements, and specific recommendations.

The evaluation is formative, not credentialing. It should make patterns observable and give learners language they can practice against.

Product Principles

  • Keep the entry point simple enough for repeated practice.
  • Preserve backward compatibility with generic VSP workflows.
  • Make patients specific enough to support believable roleplay.
  • Expose prompt experimentation for builders and educators.
  • Treat AI evaluation as formative learning rather than formal assessment.
  • Separate scenario, patient persona, conversation state, and evaluator behavior so the model does not collapse roles.

Success Metrics

  • Scenario load success rate
  • Text and voice conversation completion rates
  • Evaluation completion rate
  • Average learner turns per session
  • User-rated scenario realism and evaluation usefulness
  • Prompt override usage by builders or educators
  • Role-fidelity and evaluator-consistency review against expert expectations

Next Release Priorities

  • Authentication and learner profiles
  • Saved session history, transcripts, and evaluations
  • Educator review dashboards
  • Scenario authoring and reusable rubric libraries
  • Rubric QA against human-rated samples
  • Progress tracking across sessions and persona types
  • Stronger accessibility behavior and voice fallback states
  • Side-by-side prompt experimentation tools