
CTRL Freaks
HealthGrid – Real-Time Hospital Capacity & Cost Intelligence Platform
Submitted
May 22, 2026, 8:37 AM
Last Updated
May 22, 2026, 8:37 AM
Project Links
Problem Statement
In medical emergencies, survival is measured in minutes. Yet, our current response infrastructure relies on fragmented, static data, forcing first responders and families into a chaotic trial-and-error process to find care. The system suffers from three fatal bottlenecks: Blind Routing: Ambulances are directed to the nearest hospital, not the most capable. Patients often arrive at full-capacity facilities, forcing dangerous delays and secondary transfers. Static Data Silos: Hospitals do not share real-time resource availability. Without a centralized grid tracking ICU beds and oxygen, predictive forecasting and proactive rerouting are impossible. Search Friction: During emergencies, people search using panicked natural language (e.g., "cheap ICU near Howrah"). Traditional directories cannot parse this semantic intent to instantly match patients with the right facility.
Solution & AI Usage
HealthGrid is a Next.js Progressive Web App (PWA) optimized for low-bandwidth emergencies. We integrated React-Leaflet for real-time geospatial tracking and deployed on Vercel for instant mobile access. AI Usage: Multi-Agent System (MAS) We didn't build a chatbot; we built a MAS using the Google Gemini API alongside deterministic code to eliminate AI hallucinations. NLP Triage Agent (Gemini): Intercepts panicked natural language ("cheap ICU near Howrah") and converts it to strict JSON ({need: "ICU", loc: "Howrah"}). Why Gemini? Elite semantic parsing and reliable JSON output. Geospatial Router (Node.js): Maps Gemini’s JSON against our verified database for precise GPS plotting. Why? LLMs struggle with exact mapping; local code guarantees 100% routing accuracy. Predictive Forecaster (Gemini): Analyzes bed/oxygen data to predict capacity bottlenecks and preemptively reroute ambulances. Failsafe Protocol: A local fallback layer ensures 100% uptime even if network/A
Full Description
The Problem: Blind Routing in Medical Emergencies
In medical emergencies, survival is measured in minutes. Current response infrastructure relies on fragmented, static data, forcing a chaotic trial-and-error process. The system suffers from fatal bottlenecks: ambulances are directed to the nearest hospital rather than the most capable, real-time resource availability (ICU beds, oxygen) is siloed, and panicked natural language searches cannot be accurately parsed by traditional directories. The Solution: HealthGrid
HealthGrid is a real-time, capacity-aware emergency routing platform. It is a Progressive Web App (PWA) designed to translate natural language panic into precise, geospatial emergency routing, ensuring patients are sent to facilities with guaranteed capacity. Core Features
NLP Triage Search: Users type unstructured queries (e.g., "cheap ICU near Howrah").
Live Command Map: Real-time geospatial tracking of hospital capacity and ambulance routing.
Predictive Resource Forecasting: AI-driven analysis of bed and oxygen burn rates to preemptively reroute traffic.
Offline-Ready PWA: Installable to mobile home screens for low-bandwidth access.
Architecture: The Multi-Agent System (MAS)
I orchestrated a Multi-Agent System using the Google Gemini API alongside deterministic Next.js code to eliminate AI hallucinations.
NLP Triage Agent: Gemini intercepts natural language and converts it into strict JSON parameters (Location, Need, Constraint).
Geospatial Router: Since LLMs struggle with mapping, I built a deterministic Node.js fallback that maps Gemini’s JSON against a verified database for 100% accurate GPS plotting via Leaflet.
Predictive Forecaster: A specialized Gemini agent analyzes live telemetry to forecast capacity bottlenecks.
Failsafe Protocol: A local fallback layer ensures 100% uptime despite API latency.
Challenges I Ran Into
Hallucinations in Healthcare: Early AI iterations guessed hospital coordinates. I decoupled NLP from mapping, using Gemini strictly as a semantic parser and feeding its output into a deterministic geocoding engine.
Tailwind vs. Leaflet Collision: Integrating React-Leaflet into a Tailwind dashboard caused global resets to collapse map tiles. I engineered a CSS firewall to protect the Leaflet container.
Turbopack vs. PWA Workers: Configuring offline Service Workers (next-pwa) caused catastrophic build failures with Next.js 16's Turbopack. I bypassed this by dynamically overriding Vercel's environment to force standard Webpack compilation.
What I Learned
I learned how to architect a Multi-Agent System where LLMs and deterministic code cover each other's blind spots. I also mastered high-pressure deployment workflows, specifically managing Next.js build pipelines and complex dependency resolutions in Vercel.


