Inspiration
“When you hear hoofbeats, think horses, not zebras.” Rare diseases are often diagnosed late because each condition is uncommon and the evidence is scattered across ontologies, registries, labels, papers, and case reports. At the same time, medical students get limited practice with standardized patients, especially patients with subtle or unusual presentations.
We built Zebras as a synthetic, low-stakes environment for two workflows that usually sit apart: evidence-driven rare-disease decision support and realistic history-taking practice. Our goal is not to replace clinicians or educators, but to reduce the administrative and information burden of rare-disease diagnosis, allowing clinicians to focus more on patients than paperwork. At the same time, Zebras gives medical trainees the opportunity to interview realistic, believable patients repeatedly, explore different presentations, and develop their clinical reasoning and history-taking skills through practice.
PDF creation is a vital part of that goal. Clinicians often lose valuable time translating findings into insurer paperwork and searching across fragmented sources for possible treatments and clinical trials. Zebras brings those steps into one workflow so doctors can spend less time on administration and more time doing their actual job: caring for and saving patients.
What it does
Zebras has two workspaces:
Doctor mode starts from a synthetic chart. The user records findings, searches HPO terms, optionally extracts terms from free text, and gets an explainable differential. Each candidate disease shows supporting and contradicting evidence, a relative likelihood, and why the ranking changed. The doctor can review phenotype gaps, ACR/EULAR-style classification checklists, disease information, treatments, trials, literature, licensed figures, and draft German insurer paperwork. The paperwork pipeline turns reviewed findings into a real demo PDF draft, reducing the need to manually copy information into forms. All generated drafts are clearly marked as demo drafts and leave identity fields blank or read-only.
Trainee mode is a voice-first virtual patient. The user chooses one of three synthetic cases and one of two distinct patient personas per case. The patient speaks first. Trainees can use push-to-talk, hands-free input, text input, and interrupt the patient mid-reply. Replies are buffered as full audio clips and played with text at Slow, Normal, or Fast speed. After the interview, the trainee commits a differential, selects tests, gives a final diagnosis, and receives scored feedback on diagnosis, critical history items, tests, and communication.
How we built it
We built a TypeScript monorepo with shared contracts, a Fastify API, a React/Vite frontend, and Vitest tests. The knowledge base is generated locally from public HPO and Orphadata releases, plus curated synthetic cases, guideline checklists, and structured source metadata.
The ranking engine treats each finding as evidence for or against a disease. A finding contributes a reliability-weighted log-likelihood ratio, plus a prevalence prior:
$$ S(d) = \log P(d) + \sum_{f \in F} w_f \log \frac{P(f \mid d)}{P(f \mid \neg d)} $$
The displayed percentage comes from a softmax over the candidates considered:
$$ p(d) = \frac{e^{S(d)}}{\sum_{j \in D} e^{S(j)}} $$
We label it clearly as relative likelihood, not a calibrated probability. Each candidate also exposes the contributing findings and their signed evidence weights so the user can see why the rank moved.
The trainee score combines diagnosis match, critical facts elicited from the patient, and essential tests ordered:
$$ T = 40C + 35\frac{|F_{\text{critical}} \cap F_{\text{elicited}}|}{|F_{\text{critical}}|} + 25\frac{|R_{\text{essential}} \cap R_{\text{ordered}}|}{|R_{\text{essential}}|} $$
Here, (C) is whether the final diagnosis matches an accepted synonym list, (F) is the set of history items, and (R) is the set of recommended tests. Communication feedback is rule-based and cites the turns it refers to.
The standardized patient is an AI role-play actor, not a hardcoded question-and-answer tree. Each persona has a full brief covering identity, speech style, life context, clinical facts, and what the person tends to hold back. The model receives the conversation as real chat turns and returns a natural reply, emotion, and structured tags for facts that were actually disclosed. Those tags drive the history panel and feedback. Free-text doctor extraction uses OpenAI only when explicitly enabled for a request; model-proposed HPO labels are grounded back to local HPO identifiers.
Challenges we ran into
The hardest data challenge was annotation coverage. HPO is powerful, but rare-disease sources do not express every criterion cleanly, and fuzzy lookup can map a lay phrase to the wrong term. We addressed this by grounding labels locally, showing the matched term and original text, and marking criteria that cannot be verified as unknown rather than guessing.
The hardest product challenge was making the patient feel natural without leaking the diagnosis. A strict disclosure gate produced brittle conversations, while a fully open model could volunteer too much. We moved to a persona-brief actor and measured disclosure behavior with scripted dialogue evaluations. The result is more natural role-play, with documented imperfections we can keep improving.
Voice introduced several practical issues: microphone permissions, barge-in, interrupted audio, autoplay restrictions, and sentence-by-sentence synchronization with a buffered MP3. We added explicit microphone activation, playback fallback to text, and selectable playback speeds.
We also had to keep the demo honest. Live treatment and literature sources can change, so the UI distinguishes curated records from live registry records and preserves regulator status, source links, and dates. Synthetic data, privacy notices, explicit AI-transfer opt-in, and clear uncertainty labels became part of the product rather than footnotes.
Accomplishments we are proud of
- A complete doctor workflow from synthetic chart to evidence, explainable differential, treatments, trials, sources, and draft paperwork.
- A paperwork pipeline that produces a real demo PDF, reducing administrative friction and helping clinicians spend less time on forms and more time with patients.
- A trainee workflow with three diseases, two personas each, AI-driven dialogue, voice input, interruption, synchronized speech, and scored feedback.
- A ranking UI that explains evidence instead of presenting an uncalibrated number as a diagnosis.
- A workflow that reduces friction in finding possible treatments and clinical trials by bringing source records, regulator status, citations, and dates into the same decision-support view.
- A local-first architecture where doctor mode, ranking, HPO lookup, criteria, and tests work without keys.
- Scripted voice-patient evaluation across 72 text turns, with results and limitations published in the repository.
What we learned
We learned that explainability is a design problem as much as a modeling problem. A number becomes useful only when the user can see the evidence, uncertainty, and provenance behind it.
We learned that synthetic data is a feature in a demo like this. It allows open testing, reproducible evaluation, and honest discussion without putting real patient information into the app or into provider requests.
We learned that evaluating a conversational agent is harder than evaluating a classifier. Correct facts are not enough; timing, persona consistency, open-question behavior, tag accuracy, and diagnosis leakage all matter.
We also learned to treat source provenance as part of the interface. Registry status can change, and two products with the same generic name are not the same record. Keeping stable source references visible prevented false certainty.
Finally, we learned that constraints help the product. Keeping the UI minimal, the cases synthetic, and the claims conservative made the demo faster to build and safer to show.
What's next for Zebras
The next step is a teacher-facing case and persona creator, so educators can author new synthetic patients without editing code or prompts. We would also like to add a results dashboard that shows class-level trends while keeping individual performance private.
For the doctor workflow, we want to add more insurer and country templates, improve source freshness checks, and calibrate the ranking against larger expert-reviewed datasets. We also want to make treatment and clinical-trial discovery even faster by keeping source records, eligibility signals, and citations closer to the point of care. Replacing synthetic charts with a real SMART-on-FHIR connection would require a GDPR Article 9 basis, a DPIA, and a separate clinical validation pathway.
For the trainee workflow, we want broader persona and disease coverage, better automatic tagging, optional visual presence, and structured evaluation with medical educators.
Built With
- clinicaltrials.gov-api-v2
- ctis
- ema-json-reports
- europe-pmc
- fhir-r4
- ga4gh-phenopackets
- gpt-4o-mini-tts
- gpt-4o-transcribe
- gpt-5-mini
- gpt-realtime
- medlineplus-genetics
- ncbi-api
- ncbi-pmc
- node.js-26
- openai-api
- openai-sdk-7
- openfda-drug-labels
- orphadata
- orphanet
- pubmed-e-utilities
- react-19
- typescript-7
- wikimedia-commons-api