Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 2.06 KB

File metadata and controls

35 lines (26 loc) · 2.06 KB

FHIR FactGuard: Clinical zero-trust security 🛡️🩺

FHIR FactGuard is a zero-trust safety layer for the Prompt Opinion platform. It monitors and validates clinical decisions made by AI models by cross-referencing them with actual patient data (FHIR) and official medical standards (RxNorm) in real-time.

🚀 Why we built this

When LLMs are used in clinics, they sometimes make mistakes—like "hallucinating" treatments or missing critical details in a patient's history (allergies, past reactions, etc.). In a medical setting, a wrong prescription isn't just a bug; it's a serious risk. FactGuard was created to catch these errors before they reach a patient.

💡 How it works

FactGuard sits as a "guardrail" on the message bus where AI agents talk to each other. When an agent suggests a clinical action (like prescribing a drug), FactGuard jumps in:

  1. Intercepts the message immediately.
  2. Normalizes the medication name using the RxNorm API so there's no ambiguity.
  3. Validates the suggestion against the patient's FHIR record to check for allergies or conflicts.
  4. Scores the risk using our Clinical Grounding Index (CGI). If things look shaky, it sends a BLOCK signal to stop the action and generates an Audit ID for full traceability.

🏗️ Under the hood

The system is built with three main parts:

  • server.py: Our MCP server that handles the heavy lifting—like the validate_clinical_intent and get_clinical_provenance tools. We kept it light by using direct REST calls (httpx) to avoid bulky dependencies.
  • safety_agent.py: The brains of the operation. It uses po_adk.A2aListener to keep an eye on all clinical conversations.
  • clinical_agent_sim.py: A quick simulator we use to show what happens when the system catches a risky prescription.

🛠️ Getting started (demo)

# 1. Grab the dependencies
pip install -r requirements.txt

# 2. Fire up the MCP server
python server.py

# 3. Start the safety agent
python safety_agent.py

# 4. Run the simulation to see it in action
python clinical_agent_sim.py