Inspiration

Hospital automation systems are tested against known scenarios. But what about the risks nobody thought to test?

A patient on Warfarin gets prescribed Clopidogrel. The automation approves it. Nobody wrote a test for that interaction. The patient bleeds.

A 2-year-old with high fever gets Vancomycin and Ceftriaxone together. The automation approves it. Nobody tested that combination in pediatric patients. The child suffers kidney damage.

These are not edge cases. These are real risks that standard testing misses because you can only test what you know to test. We wanted to build something that finds the unknown unknowns before they reach a patient.

What it does

ShadowGate is an AI-powered testing platform that validates hospital automation workflows before they go live.

It tests four critical hospital automations:

  • ARIA (Adaptive Risk Intelligence Analyser): generates best, moderate and worst case treatment scenarios for each patient, then uses Claude AI via UiPath AI Fabric to discover unknown risks nobody thought to test
  • SAFE (Smart Allergy and Formula Engine): validates every scenario for drug interactions, allergy violations and dosage limits
  • GUARDIAN (General Unit Assignment and Resource Director): assigns doctors by experience level, sending P1 critical patients to senior doctors and giving junior doctors learning opportunities with minor cases
  • CARA (Continuous Aftercare and Recovery Advisor): validates discharge criteria before a patient can go home

ShadowGate runs each automation through an 8-stage testing pipeline, achieving a 95/100 confidence score with a GREEN deployment signal, while discovering an average of 9 unknown risks per run that were never part of the original test suite.

For critical patients, ShadowGate keeps a human in the loop. A confidential email goes to the Head of Department with the full clinical picture and four options: approve best case, approve moderate case, approve worst case, or request a meeting with the Chief Doctor. The treating doctor is notified by Slack only after the Head approves. If there's no response within 5 minutes, a reminder fires automatically. After 10 minutes the system escalates with a CC to senior management.

How we built it

We built ShadowGate as a Coded Agent on UiPath Automation Cloud, with the orchestration layer in Python. The four hospital automations each run independently and feed their results into a central pipeline that scores them and decides on a deployment signal.

For the AI layer we used Claude via UiPath's AI Fabric for the highest value task: discovering unknown risks. We deliberately did not use AI for things like triage priority, which instead uses fixed clinical rules, because hospitals already have proven triage protocols and AI guessing at something this safety critical is the wrong tool for the job. AI is powerful for creative discovery, not for replacing established medical procedure.

The alert system uses Gmail SMTP for confidential emails to the Head of Department and Slack webhooks for fast doctor notifications, with separate channels for clinical alerts and IT or deployment alerts.

The dashboard is a single HTML file with live polling against a Flask API, showing the deployment signal, automation health scores, the patient queue, discovered risks, and a full patient journey timeline from admission to discharge.

Challenges we ran into

Getting the priority logic right was harder than expected. Our first instinct was to let AI decide triage priority entirely, but that produced inconsistent results. A healthy 25 year old with a mild fever was sometimes flagged as critical. We learned that AI should be used where it adds unique value, such as discovering risks nobody specified, rather than replacing deterministic, well understood logic like clinical triage rules that already exist and work.

We also hit a PrepareEnvironmentError when running our Coded Agent on UiPath's serverless environment, related to Python package installation. The agent runs flawlessly locally and is fully published to UiPath Automation Cloud. We are continuing to work with UiPath on resolving the serverless package installation step.

What we learned

  • AI is not a hammer for every nail. Using it specifically for unknown risk discovery, and keeping deterministic rules for safety critical decisions like triage, produced a far more trustworthy system
  • Human in the loop design matters more in healthcare than almost any other domain. Every critical decision needs a real person with full context before action is taken
  • Building reliable notification chains such as reminders, escalations and double approval prevention takes far more edge case thinking than the happy path suggests

What's next for ShadowGate

  • Resolve the UiPath serverless package installation issue with UiPath support
  • Expand ARIA's risk discovery to pull from a continuously updated drug interaction database
  • Add a fifth automation for medication administration timing and missed dose detection
  • Build out the Agent Score and structured evaluation sets so ShadowGate's own AI behavior is continuously tested, the same way it tests hospital automations

Built With

Share this project:

Updates