Inspiration

Emergency departments are overwhelmed because patients show up at the wrong level of care. A sprained ankle doesn't need the ER, but people go there anyway because nothing helps them figure out where to go before they leave home. We wanted to build something that triages patients before they arrive, routes them to the right facility, and gives medical staff a heads-up.

What really pushed us was learning how often serious conditions get missed. Women often present heart attacks with abdominal pain, not chest pain. Elderly patients show up confused and it turns out to be a life-threatening infection, not just old age. Diabetics have silent heart attacks with zero chest pain. We built our system to catch these patterns that even doctors sometimes miss.

What it does

Triage AI is a pre-arrival triage system. Patients describe their symptoms through a chat interface. The AI asks targeted clinical follow-up questions, detects emergencies in real-time, classifies severity into one of 6 tiers (Call 911, ER, Urgent Care, Primary Care, Telehealth, Self-Care), recommends nearby facilities filtered by capability and sorted by wait time, and generates a clinical summary that can be sent to the receiving facility before the patient arrives.

Key features:

  • Two-layer emergency detection (keyword + AI context analysis) with a "Why?" button that explains the reasoning
  • Atypical symptom awareness that catches patterns doctors miss: women presenting cardiac events as abdominal pain, elderly confusion caused by infection, diabetic painless heart attacks, young adult stroke dismissed as migraine, falls hiding underlying conditions
  • Hard care level floor so a serious case never gets routed to a lower tier just because the wait time is shorter
  • Pre-arrival patient summary written in clinical format with preliminary language. The system never diagnoses.

How we built it

Backend: Python + FastAPI with 5 endpoints. The AI layer uses Groq API with llama-3.3-70b-versatile for fast, free inference. Three specialized prompts handle the conversation, severity classification, and summary generation. Emergency detection runs through backend keyword matching first, then AI context analysis for the harder cases.

Frontend: React + Vite + Tailwind CSS + TypeScript. Chat interface with real-time emergency alerts, color-coded triage result cards, a facility list with wait times, and a clinical patient summary with a "Send to Facility" button.

Facility Routing: Mock data for Indianapolis-area facilities. The system filters by required medical capabilities, enforces tier floors, and sorts by wait time within eligible facilities.

Planning: We wrote a detailed phased plan before any code. Every feature was broken into numbered subtasks with dependencies mapped out. This kept a two-person team on track across a 2-day hackathon.

Challenges we ran into

  • "No chest pain" contains "chest pain," so our keyword detector flagged it as an emergency. We fixed this by removing the client-side keyword check and letting the AI handle context-aware detection instead.
  • The AI model sometimes returned markdown-wrapped JSON or empty responses. We added code fence stripping, retry logic, and Pydantic validation to handle it.
  • We needed the AI to ask about cardiac symptoms when a woman reports abdominal pain, but not flag an emergency unless she actually confirms chest tightness. Getting that balance right took several rounds of prompt tweaking.

Accomplishments that we're proud of

  • The atypical symptom detection. Our system asks a 55-year-old woman with abdominal pain about chest pressure because it knows women present heart attacks differently. Real triage systems and even doctors frequently miss this.
  • The emergency reasoning feature. When the system flags an emergency, patients can click "Why?" to see the reasoning and make an informed decision instead of just seeing a scary red screen.
  • The conservative approach. The system deliberately over-triages rather than under-triages. Sending someone to the ER unnecessarily is inconvenient. Missing a heart attack is fatal.
  • Building the whole thing in under 2 days with 2 people.

What we learned

  • Prompt engineering is the real product. The AI already knows medicine. The skill is writing instructions that make it act like a careful, conservative triage nurse.
  • Context matters more than keywords. Simple pattern matching creates dangerous false positives in medical applications.
  • Conservative triage is safer triage. Over-triaging is inconvenient. Under-triaging can be fatal.
  • Planning before coding saves time. Our phased task breakdown kept us focused and out of scope creep.

What's next for Triage AI

  • Real hospital wait time data integration
  • Google Places API for live facility search instead of mock data
  • Insurance network filtering so patients only see facilities their plan covers
  • EHR integration to send pre-arrival summaries directly into hospital systems
  • Predictive analytics to forecast when emergency departments will be busiest
  • Public health trend detection from aggregated anonymized symptom data

Built With

Share this project:

Updates