Inspiration

Walking home at night shouldn't feel like a risk calculation. Yet for millions of women in India, every late-night route involves an invisible mental checklist — Is this street lit? Is there anyone around? What if something goes wrong?

Every navigation app on the market tells you the fastest route. None of them tell you if it's safe — and none of them understand that the same street that's Fine at 3 PM becomes dangerous at 11 PM.

SentinelAI was built on one insight: risk is not a place. It's a place, at a time.

What it does

SentinelAI is a real-time AI safety navigation system for women. It doesn't just score routes — it reasons about them.

  • AI Guardian — a Gemini-powered intelligence layer that analyses route context, reasons through risk factors step by step, and explains every threat in plain language
  • Time-Aware Risk Scoring — the same route scores differently at 2 PM vs 11 PM. A time-of-day slider updates the heatmap, polyline, and AI reasoning in real time
  • Predictive Intelligence Engine — analyzes historical incident patterns to forecast risk at different hours and identify the safest travel window for any route
  • Saheli AI Companion — Gemini synthesises all analysis into a warm, specific, non-alarmist safety briefing: not just a score, but a conversation
  • Safety Recommendations — 3 AI-generated actionable recommendations per route, prioritised by urgency and tailored to the time of day
  • Incident Trend Analysis — identifies hotspots, rising risk areas, and weekly safety patterns across the city
  • Personalized Alerts — users set their sensitivity level; SentinelAI adjusts thresholds, tone, and warnings to match
  • Voice SOS — say "help me" without touching the screen; Web Speech API triggers an instant WhatsApp SOS with live GPS coordinates
  • Safe Companion — share a live-updating location link via WhatsApp for 15, 30, or 60 minutes; recipients track a moving map marker in real time via Firestore

How we built it

SentinelAI runs entirely client-side — no backend server, no cold starts.

The core is AIGuardian.js, a single intelligence module that routes all Gemini calls through a structured pipeline:

  1. analyzeContext() — builds a context payload from time, day, incident density, user sensitivity, and route metadata
  2. reasonRisk() — Gemini reasons through risk factors and returns an AI score adjustment on top of the Haversine base score
  3. getRecommendations() — 3 typed, prioritised safety recommendations
  4. predictFutureRisk() — hour-by-hour risk forecast with safest/riskiest windows
  5. explainInNaturalLanguage() — Saheli AI synthesises all outputs into one warm, human briefing

Steps 1–4 run in parallel via Promise.all(). Step 5 synthesises after all is resolved. This cuts total Gemini latency to ~2–3 seconds instead of 10+ seconds sequentially.

Stack: React 18 + Vite · Firebase Firestore (realtime onSnapshot) · Firebase Anonymous Auth · Firebase Hosting · Google Maps JS API (Directions, HeatmapLayer, Geocoding) · Gemini 1.5 Flash · Tailwind CSS · Web Speech API · Web Geolocation API · WhatsApp Deep Link

Challenges we ran into

Polyline segmentation — Google Maps returns a single encoded polyline. Splitting it into individually coloured risk segments required decoding, chunking into ~5-waypoint groups, scoring each chunk independently, and rendering them as separate Polyline components with zero visual gaps at joins.

Gemini orchestration — Early builds made Gemini calls sequentially, producing 10+ second waits. Restructuring into Promise.all() for parallel execution and a single synthesis call after reduced perceived latency by ~70%.

Prompt engineering for tone — Gemini's default responses were either too alarming or too generic. Enforcing the "specific, helpful, not alarmist" constraint in the system prompt — and testing against 30+ route scenarios — was the most iterative part of the build.

Voice SOS background listening — Web Speech API stops listening after silence. Keeping continuous background recognition required auto-restarting the listener on onend events while respecting browser permission states.

Time-aware heatmap — Separating display weight (HeatmapLayer intensity) from scoring weight (risk formula) while keeping both reactive to the time slider Without re-fetching, Firestore required careful state architecture.

What we learned

  • Gemini Flash is fast and capable enough to power a real-time multi-call AI pipeline on free tier — the key is parallel execution, not sequential awaiting
  • Promise.all() for independent AI calls is not an optimisation; it's a necessity for any AI app that needs to feel responsive
  • Firebase Anonymous Auth is the single best UX decision for safety-critical apps — Zero friction means users are in the app before they have time to hesitate
  • The Web Speech API is criminally underused — voice-activated SOS on a safety app is a five-line implementation with a massive demo impact
  • Risk is temporal. Modelling time as a first-class variable — not an afterthought — changes what a safety app fundamentally is

What's next for SentinelAI

  • Hindi and regional language support — Saheli AI briefings in the user's language via Gemini's multilingual capability
  • Municipal data integration — verified incident feeds from local police and civic bodies to complement crowd-sourced reports
  • Route comparison — A vs B routes with AI explaining the safety tradeoff
  • 112 integration — direct routing to India's national emergency number from the SOS flow
  • Offline mode — cached heatmap and last-known risk scores for low-connectivity environments

Built With

  • deep
  • firebase-anonymous-auth
  • firebase-firestore
  • firebase-hosting
  • gemini-1.5-flash
  • google-maps-directions-api
  • google-maps-heatmaplayer
  • google-maps-js-api
  • javascript
  • link
  • react
  • tailwind-css
  • vite
  • web-geolocation-api
  • web-speech-api
  • whatsapp
Share this project:

Updates