Inspiration

Emergency physicians apply decision rules ~30x per shift (HEART, Wells PE, qSOFA, NIHSS). Misapplication drives unnecessary CT/admit and — worse — unsafe discharge. No MCP server exists that lets an AI agent apply these validated rules to a FHIR Bundle.

What it does

  • 100 validated ED decision rules exposed as an MCP Superpower
  • LLM Reasoner picks which rules apply, runs them in parallel, reconciles conflicts
  • Returns a CDS Hooks 1.0 card that Epic/Cerner can render natively
  • Refuses to recommend when no rule fits ("physician review required")
  • 26-complaint / 9-organ / 3-age-band coverage matrix routes free-text complaints

How we built it

  • Engine: 98 additive + 2 non-additive rules (MELD-Na regression, Tokyo Guidelines categorical), pluggable scoring-strategy registry
  • FHIR variable extractor with PHI scrubbing before any LLM call
  • SHARP envelope helpers propagate contextId / correlationId / bundleSha256
  • Property-based testing caught 5 real data defects during development
  • 19,600 randomized fuzz evaluations per run, 100% pass

Challenges we ran into

  • Distinguishing additive from regression rules — solved with a strategy registry
  • Avoiding "fake conflicts" when extractor lacks data — solved with insufficient-data guard
  • Score-range gaps in published rule definitions — caught by property tests, fixed

Accomplishments we're proud of

  • 100-rule library with deterministic versioning (SHA-256 per rule)
  • Baseline comparison: 4/4 disposition correct vs naive LLM 3/4; 4/4 rule cited vs 0/4
  • 219 tests, 0 regressions across 18 commits

What we learned

  • Rule-data defects are common; property-based testing catches them where curated tests don't
  • "AI Factor" is in the reasoner, not the scoring — rules stay deterministic

What's next

  • Engine extension for true logistic-regression rules (GRACE with intercept + sigmoid)
  • More rules (~30 high-value additions documented as gaps)
  • SMART-on-FHIR OAuth2 launch-context handling

Built With

  • a2a
  • fhir-r4
  • hl7-cds-hooks-1.0
  • mcp
  • pytest
  • python-3.11
  • pyyaml
  • ruff
  • smart-on-fhir-(r4.smarthealthit.org)
Share this project:

Updates