# MediLink AI — From Marienga to Nairobi: A Healthcare Story Built in Code
> "In Kenya, the ambulance doesn't always come. Sometimes, all you have is your phone."
> — Edward Adoyo, Builder of MediLink AI
## 🌍 Inspiration
I grew up in Marienga, a small village tucked away in Migori County, Kenya. Healthcare there isn't a guarantee — it's a journey. The nearest clinic could be hours away on a rough road, and for many families, waiting too long was the difference between life and death.
When I moved to Nairobi, I thought the city would be different. It was — but not always in the right ways. I met a friend who had developed a skin rash. He was afraid to see a doctor. "It's probably nothing," he kept saying. He searched symptoms online and got scared by worst-case articles. The rash spread. Weeks passed. By the time he finally walked into a hospital, what could have been caught early had become a serious problem requiring urgent treatment.
That moment hit me differently. Here was a man surrounded by hospitals, pharmacies, and doctors — and yet he couldn't access care. Not because there was none. But because the bridge between him and that care didn't exist.
Then I started thinking bigger. In Nairobi's chaotic traffic, emergency vehicles routinely get stuck. People call 112 and wait. Sometimes help arrives in time. Sometimes it doesn't. I read stories of people dying in accidents or from heart attacks — not in remote villages, but at city roundabouts, three minutes from a hospital.
That's when MediLink AI was born — not from a whiteboard, but from real pain I had witnessed.
## 🧠 What I Learned
Building MediLink AI taught me that technology without empathy is just engineering. But technology with empathy can save lives.
On the technical side, I learned:
- How to build a multi-layer geolocation system that falls back gracefully from GPS → browser geolocation → IP-based detection, so it works even in low-connectivity environments.
- That traffic-aware routing — sorting hospitals by actual travel time, not straight-line distance — can be the difference between a 5-minute and a 40-minute ambulance ride in a city like Nairobi.
- How Google Gemini's vision capabilities can analyze a photo of a skin rash or an X-ray and return structured medical insight in seconds — the kind of first-opinion my friend never got.
- How to design for trust: users sharing their health data need to feel safe, so Row Level Security, encrypted storage, and role-based access weren't optional features — they were the foundation.
On the human side, I learned that the hardest part of solving a healthcare crisis isn't writing code. It's understanding why people don't seek help — fear, stigma, cost, distance, and the simple absence of a system that meets them where they are.
## 🔨 How I Built It
MediLink AI (v9.0 — Location Intelligence Release) is a full-stack global healthcare platform. Here's how it comes together:
### The Stack
| Layer | Technology |
|---------------|-----------------------------------------------------------|
| Frontend | React 18 + TypeScript + Vite + Tailwind CSS |
| Backend | Supabase (PostgreSQL + Auth + Edge Functions) |
| AI Engine | Google Gemini (symptom analysis + image interpretation) |
| Maps & Routing| Google Maps JS API v2 + OpenStreetMap fallback |
| Payments | Stripe |
| Real-time | Supabase live subscriptions |
### Key Features I Built
#### 🚨 Emergency SOS with Live Ambulance Tracking
One tap. That's all it takes. The patient hits the SOS button, the system calculates their GPS location, dispatches the nearest ambulance, and an animated marker begins moving toward them on a live map — with a real-time ETA countdown in seconds. A visual timeline shows every step: Request Received → Ambulance Dispatched → En Route → Arriving. No more wondering if help is coming.
#### 🗺️ Traffic-Aware Hospital Ranking
The platform ranks hospitals not by how far they are, but by how long it actually takes to reach them in current traffic conditions. In Nairobi rush hour, the hospital 2km away might take longer than one 5km away. MediLink AI knows the difference. The math behind it uses the Google Directions API with live traffic, falling back to haversine distance estimation
d = 2r arcsin(√(sin²(Δφ/2) + cos φ₁ cos φ₂ sin²(Δλ/2)))
when the API is unavailable.
#### 🤖 AI Symptom Analysis & Image Diagnosis
Patients describe their symptoms in plain language. Gemini responds with urgency scoring (low / medium / high / critical), specialist recommendations, and follow-up questions. Users can also upload photos — a rash, a wound, an X-ray — and receive AI-powered preliminary analysis with confidence scores and severity levels. My friend's story was the prototype for this feature.
#### 👨⚕️ Doctor & Hospital Finder
A searchable directory of doctors filterable by specialty, availability, rating, and consultation fee. Hospitals display on a live interactive map with color-coded traffic overlays. One click opens navigation from the user's current location.
#### 📹 Video Consultations
WebRTC-based video rooms with integrated chat, medical record access, and session timers — enabling remote care for patients who can't travel, whether they're in Nairobi traffic or back in a village like Marienga.
#### 💳 Payments
Stripe-integrated checkout covering consultation bookings, emergency services, and subscriptions — because access to care must also mean transparent, trustworthy payment.
The platform serves four user roles — Patient, Doctor, Hospital Admin, and System Admin — each with their own dedicated portal, dashboard, and permissions enforced through Supabase's Row Level Security.
## 😓 Challenges I Faced
1. **Maps That Work Everywhere**
Getting geolocation to work reliably across different devices, browsers, and network conditions in Kenya was genuinely hard. I built a three-layer fallback system — GPS first, then browser geolocation, then IP-based detection — and had to handle edge cases where all three disagreed with each other.
2. **Real-Time Without Burning Money**
Live ambulance tracking and ETA countdowns require real-time data. I used Supabase's live subscription system to push updates without polling APIs on a timer, keeping infrastructure costs manageable for what is intended to be an affordable platform.
3. **Making AI Medically Responsible**
AI giving health advice is a serious responsibility. I had to carefully design prompts and guardrails for Gemini so that it never overstates confidence, always recommends professional consultation for serious symptoms, and surfaces emergency services when urgency is high. The AI is a first responder to information, not a replacement for a doctor.
4. **Building Alone, Thinking at Scale**
MediLink AI has 28+ screens across 4 portals. Building this — architecting the database schema, designing the UI system, integrating four external APIs, and making it all feel seamless — while holding onto the vision of why it matters, was the hardest challenge of all. Some nights it was just me, a laptop, and the memory of my friend's rash that should have been caught much earlier.
## 🏁 What's Next
MediLink AI is ready to grow. The roadmap includes:
- Offline mode for low-connectivity rural areas
- SMS-based SOS for users without smartphones
- Insurance integrations with Kenyan NHIF and private providers
- Multi-language support including Swahili and local dialects
- Community health worker portal for the last-mile care gap
## 💬 Final Word
From Marienga to Nairobi, I've watched people suffer not from lack of hospitals, but from lack of connection. MediLink AI is that connection — intelligent, fast, and built with the dignity of every patient in mind.
> Healthcare shouldn't depend on where you were born or whether you're stuck in traffic. It should find you wherever you are.
**Built by Edward Adoyo. Built for everyone.**
Built With
- ai
- css
- form
- framer
- gemni
- google-maps
- hook
- maps
- motion
- react
- recharts
- router
- search
- shadcn/ui
- stripe
- supabase
- tailwind
- typescript
- vite
Log in or sign up for Devpost to join the conversation.