ClinicalGuard AI
Inspiration
I watched a YouTube video describing how corporate healthcare forces doctors to see far more patients than is safely possible. Physicians are scheduling 30–40 patients per shift, leaving under 10 minutes per person.
The result is not negligence — it is cognitive overload at scale.
A doctor managing a patient on 11 medications with CKD, heart failure, and multiple allergies cannot simultaneously recall every drug interaction, renal dosing threshold, and overdue screening — for the 30th patient of the day.
That video planted one question:
What if the cognitive load of medication safety, care gaps, and discharge readiness could be offloaded to an AI agent — one that reads the actual patient record and delivers a structured clinical brief in under 10 seconds?
That question became ClinicalGuard AI.
What I Learned
The AI factor here is not magic. It is parallel synthesis across dimensions that humans handle sequentially under time pressure. A single patient can have a contraindicated NSAID, a nephrotoxic agent, an overdue liver function test, and an allergy conflict — all simultaneously, all individually catchable if you have time.
On the technical side, I learned that A2A interoperability is genuinely hard in practice. I debugged method name mismatches, role enum incompatibilities, FHIR context propagation across async middleware, Windows asyncio conflicts, and A2A v1 spec compliance — one cryptic error at a time.
How I Built It
Four specialist agents built on Google ADK, deployed on Prompt Opinion via A2A:
- Orchestrator — routes queries, synthesises responses
- Medication Safety Agent — DDI, allergy conflicts, renal/hepatic dosing
- Care Gap Agent — overdue labs, preventive screenings, follow-up gaps
- Discharge Readiness Agent — domain scorecard, blocking issue identification
Patient data flows via SMART-on-FHIR. Prompt Opinion injects the FHIR server URL, bearer token, and patient ID automatically. The agent fetches live medications, conditions, allergies, and observations in real time.
A custom ASGI middleware layer handles all A2A compatibility rewrites between Prompt Opinion's v1 client and the ADK's v0.3 implementation.
Challenges
Protocol gap — Prompt Opinion sends SendMessage, ROLE_USER, and expects
protocolBinding: JSONRPC. ADK expects different values. Every mismatch required
a targeted fix discovered one error at a time.
Timeout — The original multi-agent chain produced four sequential Gemini calls totalling 49 seconds. Prompt Opinion times out at ~30 seconds. Solution: collapse to a single-call orchestrator reasoning directly from message context.
FHIR token expiry — PO session tokens expire between requests. Agents gracefully fall back to reasoning from clinical context already in the message.
Windows asyncio — The GenAI SDK's aiohttp requires SelectorEventLoop but
Windows defaults to ProactorEventLoop. Fixed by patching DefaultResolver to
ThreadedResolver before any imports.
Built With
- a2a-protocol
- fhir-r4
- googleadk(agentdevelopmentkit)
- httpx
- ngrok
- python-3.12
- reportlab
- uvicorn
Log in or sign up for Devpost to join the conversation.