Inspiration

Infrastructure is the backbone of any city, yet reporting damage—like severe potholes, broken streetlights, or fallen trees—remains a slow, manual, and highly subjective process. We realized that public works departments are overwhelmed with unstructured, duplicate complaints that lack precise geospatial data and technical severity assessments. This creates a massive bottleneck, leading to delayed repairs, wasted municipal budgets, and prolonged safety hazards for citizens. We built CivicLens AI to eliminate this friction by bridging the gap between citizen observation and automated municipal action.

What it does

CivicLens AI is an automated civic intelligence platform that transforms unstructured visual evidence into actionable enterprise data.

Field Agent Portal: Users upload a photo of infrastructure damage. The system instantly captures GPS coordinates and processes the image using edge-compressed AI.

AI Technical Assessment: The system generates a B2B report card featuring a 1-10 priority rating, an estimated SLA (Service Level Agreement) for repair, and a technical breakdown of the damage.

Geospatial Telemetry Dashboard: Incidents are mapped onto a live OpenStreetMap dashboard for city officials to monitor and triage.

Automated Dispatch: With a single click, the platform generates a formatted, plain-text email ticket containing all GIS telemetry and AI assessments, ready to be dispatched to repair crews.

How we built it

We architected CivicLens as a robust full-stack application designed for speed and reliability:

Frontend: Built with React.js and Vite, utilizing react-leaflet for dynamic OpenStreetMap rendering.

Backend: Engineered with Python and FastAPI for high-performance async routing, backed by an SQLite database via SQLAlchemy.

AI Integration: Powered by Google Gemini Vision (gemini-1.5-flash) for rapid image inference and JSON-structured data extraction.

Challenges we ran into

Payload Bottlenecks: Modern smartphone photos are often 5MB–10MB, which caused unacceptable latency when uploading and sending to the Gemini API. We engineered a native HTML5 Canvas compression algorithm that executes entirely on the client side, shrinking 10MB payloads to $\approx 150\text{KB}$ before transmission, reducing inference time to seconds.

API Quota & Rate Limiting: During high-frequency testing, we hit the Gemini Free Tier quotas (HTTP 429 errors), which initially crashed the backend. We implemented graceful degradation routing—the backend now safely catches the 429 status and passes it to the frontend, rendering a professional "High Traffic Volume" UI alert rather than a fatal 500 server error.

Securing Public Endpoints: Because CivicLens is a public-facing portal, we needed to prevent malicious actors from deleting other people's reports without forcing users through a high-friction authentication flow. We solved this by implementing device-level fingerprinting via browser localStorage. A local ledger maps report IDs to the active session, strictly locking non-authors into a "View Only" mode.

What we learned

We learned how to orchestrate a true edge-to-cloud pipeline, specifically balancing heavy AI inference with frontend UX. Dealing with real-world bottlenecks like API rate limits and image payload sizes taught us how to write defensively and prioritize graceful failure states. We also discovered the power of dynamic mailto: payload formatting to bridge the gap between a web app and legacy enterprise email dispatch systems.

What's next for CivicLens AI

Mobile Native App: Rebuilding the Field Agent portal in React Native to leverage native camera and background geolocation APIs.

Predictive Analytics: Aggregating report data to predict infrastructure failure points (e.g., identifying specific roads that develop potholes repeatedly after heavy rain).

Direct City Integrations: Replacing the Gmail dispatch with direct API webhooks into legacy 311 and municipal CRM platforms.

Built With

Share this project:

Updates

Submission history