Inspiration

When someone feels unwell, the first decision is the hardest: ER, urgent care, telehealth, pharmacy, or home? People often guess wrong. Some overuse emergency rooms, and some delay care they urgently need. In Nigeria, where our team is based, most care is also paid out of pocket and up front, so a wrong guess costs money, and "pay first, then we'll see you" can cost lives.

Symptom checkers stop at advice: none close the loop to paying for the right care, and almost none publish how often they're wrong. We wanted an assistant that answers the question responsibly and removes the financial friction, without ever letting money stand between a patient and an emergency.

What it does

CareRoute's goal: get the patient to the right level of care, and pay for it safely.

  • Triage: the patient describes their symptoms, and an AI agent classifies the case as emergency, urgent, routine or self-care. Every decision cites public NHS, NICE or WHO guidelines.
  • Route: it recommends the right service (pharmacist, telehealth GP or same-day clinic) with the price up front.
  • Pay safely with PayPal:
    • The payment is authorized (held), not captured, and is captured only when the provider confirms the consultation happened.
    • If a clinician lowers the triage level, CareRoute captures less or partially refunds. If they escalate to emergency, the hold is released or the payment refunded.
    • Providers are paid instantly through PayPal Payouts, minus a 5% platform fee.
  • Emergencies never see a payment screen. Deterministic red-flag rules send the patient straight to the ER, and the API refuses to create an order for an emergency.
  • Escalates when unsure: low-confidence or ungrounded cases go to a human clinician, and payment can't be captured until a clinician signs off.
  • Explains itself: the patient view, clinic console and trust dashboard show every pipeline step, guardrail check, cited guideline, PayPal event and money flow.

How we built it

A six-stage agent pipeline (guardrails are tested code, not prompt text):

  1. Input guardrails: clinical scope check, prompt-injection detection, personal-data redaction.
  2. 14 deterministic red-flag rules (cardiac, stroke, breathing, bleeding, self-harm, infant fever, pregnancy…), run before the AI.
  3. BM25 retrieval over a curated NHS, NICE and WHO guideline knowledge base.
  4. Google Gemini (gemini-3.5-flash, via the google-genai SDK) returns a structured JSON decision that may only cite retrieved guidelines. It also writes patient advice and an SBAR handoff note for the clinician. If one Gemini model is busy, the agent automatically tries another, and if Gemini is unavailable a deterministic engine answers.
  5. Output guardrails: a red-flag floor the AI can never override, grounding checks, confidence-based escalation to a human, and removal of drug doses and diagnosis language.
  6. Routing to providers.

PayPal: Orders v2 with intent: AUTHORIZE and the JS SDK buttons, then authorize, full or partial capture, void, refund, Payouts, and webhooks with signature verification. Every money-moving call carries a PayPal-Request-Id idempotency key, and every state change goes to an audit log.

Stack: Python and FastAPI, SQLite, React + TypeScript + Tailwind CSS, Docker, Render, and GitHub Actions CI (lint, 53 tests, a safety gate, frontend build and Docker build).

Challenges we ran into

  • A safety bug our own evaluation caught. "I want to kill myself" was being blocked as off-topic by the scope filter. Red-flag language now always overrides the scope check, and a regression test guards it. That bug is why we publish our numbers.
  • Making emergencies a hard bypass. The emergency path sits outside the payment flow, enforced in the agent, the payment service and the UI, so a model error can't route an emergency to checkout.
  • Payment state across human decisions. Authorize, capture, refund, void and payout depend on a provider or clinician acting, so we built a state machine that handles no-shows, down-triage and escalation without leaving money in limbo.
  • AI availability. During the build our first Gemini model was retired and the next was overloaded. We added model failover, retries, time limits and a deterministic fallback, so the patient always gets a safe answer.

Accomplishments that we're proud of

  • 100% emergency recall and 0% under-triage on 61 labelled scenarios, enforced in CI on every commit.
  • 100% of ambiguous cases escalated to a human instead of guessed, 100% of off-topic requests refused, and 100% of decisions grounded in a cited guideline.
  • Patients are charged only for care that actually happens, at the level of care they actually needed.
  • An emergency flow with zero payment friction.

What we learned

  • In health tech, the critical decisions sit around the model: guardrails, escalation and payment rules matter as much as the model itself.
  • Showing the AI's reasoning to the humans who can overrule it builds more trust than a point of extra accuracy.
  • PayPal's authorize-then-capture is a natural fit for services whose delivery depends on someone else confirming it.

What's next for CareRoute

  • Validate triage with clinicians on a larger test set.
  • Multi-turn symptom intake (OPQRST) and patient history via FHIR/EHR, from our original multi-agent design.
  • Onboard real Lagos providers, and add Yoruba, Igbo, Hausa and Pidgin intake.
  • A full privacy and compliance review before any real patient use.

CareRoute is decision support for routing, not a diagnosis. In an emergency, call your local emergency number.

Built With

Share this project:

Updates

Submission history