Kapsule
Kapsule is an EHR-embedded medication-intelligence backend that turns a patient's FHIR chart into a single, prioritized, evidence-grounded set of regimen recommendations — the interactions, duplicate therapies, unsafe do
Core trick
Pairs a deterministic interaction and duplicate-therapy engine with six routed LLM agents that add guideline-grounded rationale from a FHIR chart.
Description
Kapsule is an EHR-embedded medication-intelligence backend that turns a patient's FHIR chart into a single, prioritized, evidence-grounded set of regimen recommendations — the interactions, duplicate therapies, unsafe doses, and missing guideline-directed treatments a clinician would otherwise have to catch by hand.
README excerpt
# Kapsule — Medication Intelligence Backend
EHR-embedded medication reasoning for the Abridge × Anthropic hackathon.
Kapsule reviews a patient's diagnoses, medications, allergies, labs, and renal/
hepatic function and returns safer, evidence-grounded regimen recommendations. It
combines two complementary layers:
1. **A deterministic reasoning engine** — reproducible, rule-based findings
(drug interactions, cumulative burden, duplicate therapy, patient-specific
cautions, positive indications). Same inputs always produce the same output.
2. **Six specialized LLM agents** (Anthropic API) — guideline-grounded reasoning
that adds narrative rationale, taper plans, GDMT gaps, and monitoring plans.
A **router** dispatches only the relevant agents per event, a **conflict
resolver** reconciles contradictory recommendations safety-first, and a
**recommendation synthesizer** merges everything into one prioritized, clinician-
ready plan plus a patient-facing summary.
Grounded in the `synthetic-ambient-fhir-25` dataset (25 synthetic FHIR
R4 encounters). All patient data is synthetic.
## Architecture
```
┌──────────────── /patients/{id}/analyze ────────────────┐
│ │
FHIR record ─► normalize ─► calculators ──┬─► deterministic engine ──┤
(data.py) (fhir_utils) (calculators) │ (engine.py, 53 rules) │
│ ├─► conflict