Inspiration
We’ve all had that moment where maps send us down a sketchy side street or across an intersection that just "feels wrong," even though it's technically the fastest route. Cities also drown in unstructured safety complaints with no clear way to triage what's truly urgent. CivicSafe AI flips this dynamic: it builds its own safety database from citizen complaints, turning community knowledge into safer routes for everyone. We wanted to connect those two worlds: let citizens move more safely through the city, and give city staff a live, data‑driven picture of where things are most dangerous right now.
What it does
CivicSafe AI is a smart‑city safety copilot with two faces:
- For citizens: it shows both the fastest and safest routes between two points. The safest route is computed using real crash data, street infrastructure (bike lanes, sidewalks), lighting quality, and live complaint density from our growing community database instead of just time and distance. A built‑in AI explains why one route is safer in plain language.
- For city staff: it turns messy reports into an AI‑triaged safety inbox and a live safety heatmap. Staff see which segments are truly high‑risk, get an auto‑generated daily safety brief, and can test simple "what‑if" changes (like adding lighting or a crosswalk) to see how the safety score for a street would improve.
The magic happens as citizens report issues: every complaint makes future routes safer for everyone else. More pothole reports on a street? That segment's safety score drops, and future users automatically avoid it.
How we built it
We used a modern cloud stack (Gemini API for AI, MongoDB Atlas for data, Auth0 for secure login) and stitched together open data with our self‑improving complaint database:
- Street network: OpenStreetMap‑based routing service for baseline "fastest" routes.
- Crash data: Chicago's Vision Zero traffic crash dataset, snapped to street segments for crash risk per km.
- Infrastructure features: OSM tags for bike lanes/sidewalks, hand‑labeled lighting quality.
- Community safety layer: Every complaint citizens submit gets geo‑tagged to a street segment and stored in MongoDB Atlas. High‑urgency complaints (AI‑classified via Gemini API) directly lower that segment's safety score, creating a live, crowd‑sourced safety map that gets smarter with every user.
Secure multi‑role access powered by Auth0 separates citizen reporting from city operator/planner dashboards.
When someone requests a route:
- Get candidate paths from routing service
- Score each segment using our MongoDB Atlas database (crash risk + OSM features + complaint density)
- Return fastest vs safest, where "safest" maximizes average safety score
- Gemini API explains the difference using the actual segment data: "This route avoids three high‑crash intersections and most dark segments at the cost of 3 extra minutes."
The complaint loop closes the system: citizen → complaint → MongoDB Atlas update → better routes for next citizen.
Challenges we ran into
- Bootstrapping the safety database: Open crash data gave us a baseline, but the real power is crowd‑sourced complaints stored in MongoDB Atlas. We had to seed realistic demo complaints so judges could see how the system learns from community input.
- Balancing speed vs safety: Too much complaint weight made routes unusable; too little made "safest" identical to "fastest."
- Live complaint impact: Making safety scores update in real‑time without recalculating the entire street network in MongoDB Atlas was tricky.
- Geocoding reliability: Free geocoders fail often, so we added robust map‑click fallback + local biasing.
- Auth0 role management: Getting citizen vs operator vs planner permissions right while keeping the login flow smooth.
Accomplishments that we're proud of
- Self‑improving safety database in MongoDB Atlas: Every complaint makes the system smarter for everyone else—no static dataset, it literally learns from community use.
- Gemini API explanations: Turning raw segment stats (crash risk, lighting, complaints) into compelling "why this route is safer" narratives.
- Closing the feedback loop: Citizen experience (routes) ↔ community input (complaints) ↔ city operations (triage) in one coherent system.
- Secure multi‑role architecture: Auth0 separates citizen reporting from protected city dashboards without compromising UX.
- Real quantitative safety: Not just colors on a map—actual crash density per km + complaint‑weighted scores that change live.
What we learned
- Community data beats perfect datasets: Real people know where it "feels" unsafe better than any static crash map. The complaint‑driven safety layer in MongoDB Atlas was the breakthrough.
- Feedback loops are magic: When citizens see their complaints actually change routes, they'll report more. When cities see complaint patterns, they'll fix root causes.
- AI shines at explanation: Gemini API turning numbers into "This avoids 3 high‑risk blocks" was way more compelling than raw safety scores.
- Modern cloud stack simplifies everything: MongoDB Atlas handled geospatial queries and real‑time updates smoothly, Auth0 gave us enterprise‑grade security in minutes.
What's next for CivicSafe AI – Smart Route & Safety Copilot
- Real‑time complaint impact: As complaints roll into MongoDB Atlas, routes automatically adapt without full recalculation
- Personalized safety: Let users weight what matters most (avoid dark streets vs high‑crash intersections vs accessibility barriers)
- City‑wide rollout: Partner with universities/campuses first (contained geography), then scale to full cities
- Predictive safety: Use complaint patterns to predict where crashes happen next, not just where they happened
- Civic gamification: Reward frequent reporters with "safety karma" badges and route priority
Built With
- auth0
- axe-core
- cdn
- docker
- elevenlabs
- express.js
- fast-check
- gemini-ai
- geojson
- graphhopper
- gridfs
- jwt
- mapbox
- material-ui
- mongodb-atlas
- node.js
- openrouteservice
- pwa
- react
- react-native
- redis
- typescript
- vultr
- websocket
Log in or sign up for Devpost to join the conversation.