Skip to content

About

AI-powered civic issue-reporting platform that auto-categorizes problems with Gemini Vision, lets communities verify them, and drafts formal complaints that escalate up the government hierarchy. Built on Google AI Studio, Gemini & Firebase. BlockseBlock Hackathon.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Community Hero

A civic issue-reporting and resolution platform that uses AI to help communities report, verify, escalate, and resolve local problems β€” with transparency and accountability built in.

Built for the BlockseBlock Hackathon (Problem Statement 2: Community Hero β€” Hyperlocal Problem Solver).

πŸ”— Live App: https://community-hero-54733550535.us-west1.run.app/ πŸ“¦ Repository: https://github.com/avaneeshmenon/community-hero


Table of Contents


The Problem

Communities everywhere face the same recurring civic issues β€” potholes, water leakages, broken streetlights, uncollected waste, exposed wiring, open manholes. The problem isn't a lack of issues to report; it's that reporting is fragmented, opaque, and rarely leads to resolution.

A citizen who spots a hazard today has poor options: a phone call that goes unlogged, a complaint portal that never updates, or a social media post that authorities never see. There's no shared record, no way for neighbours to confirm an issue is real, no transparency into whether anyone is acting on it, and no accountability when nothing happens. Issues get reported ten times or zero times, and either way they fall through the cracks.

Community Hero closes that loop β€” from the moment a citizen photographs a problem to the moment it's verified, formally escalated to the right authority, and confirmed fixed.


Our Solution

Community Hero is a community-driven civic platform where citizens report, validate, track, and resolve local issues through collaboration and intelligent automation. It combines a familiar, engaging community feed (Reddit-style verification and discussion) with a powerful AI layer that does the heavy lifting β€” categorizing issues, drafting formal complaints, routing them to the correct municipal department, and escalating them up the government hierarchy when they go unaddressed.

The core insight: the community decides what's real, and AI handles the bureaucracy. Citizens verify each other's reports through upvotes; once an issue crosses a verification threshold, an AI agent autonomously drafts a formal complaint to the responsible department. If the issue stays unresolved, the platform escalates it β€” Local Authority, then Ward Office, then Municipal Commissioner β€” generating a progressively firmer formal notice at each stage.

This transforms civic reporting from a shout into the void to a transparent, accountable, AI-assisted escalation pipeline.


The End-to-End Flow

  1. Report β€” A citizen photographs an issue. Gemini Vision analyzes the image and automatically fills in the category, sub-category, severity, a clear title, a structured description, an urgency score, and a risk assessment. The citizen just confirms and posts.
  2. Deduplicate β€” Before the report is filed, the system checks for nearby existing reports of the same type (geo + AI image comparison) and offers to verify the existing one instead, preventing clutter.
  3. Verify β€” The report appears in the community feed. Neighbours upvote to verify it's real. The upvote is the verification β€” reputation-weighted so trusted contributors carry more weight.
  4. Promote β€” At 3 community verifications, the issue is automatically promoted from Reported to Verified.
  5. Escalate (AI Agent) β€” On reaching Verified, an AI agent drafts a formal complaint, determines the responsible municipal department, and prepares it for dispatch with a unique reference ID. If unresolved over time, it escalates up the authority chain with new AI-drafted notices.
  6. Track β€” The issue moves transparently through Reported β†’ Verified β†’ In Progress β†’ Resolved, visible to everyone.
  7. Confirm the fix β€” When resolved, any citizen can upload an "after" photo; Gemini compares before/after and marks it Resolved Β· AI Verified with a confidence score.
  8. Analyze β€” A Civic Intelligence Dashboard surfaces aggregate trends, AI-generated insights, and recurring-issue projections grounded in the real data.

Key Features

Reporting & AI Intake

  • Photo-based reporting with on-device camera capture and GPS auto-tagging.
  • AI Intelligent Intake β€” a single Gemini Vision call returns category, sub-category, severity, title, description, an urgency score, a risk assessment, and a spam/validity check.
  • Two-level civic taxonomy β€” eight departments (Roads, Water, Electricity, Waste, Safety, Animals, Environment, Public Facilities), each with specific sub-categories. The department doubles as the routing key for the complaint agent.
  • Multi-image uploads (up to 5 photos) with a swipeable gallery and full-screen lightbox.
  • AI Duplicate Detection β€” geo + image comparison against nearby reports to prevent the same issue being logged repeatedly; offers to verify the existing report instead.

Community Verification & Trust

  • Upvote-as-verification β€” verifying a report means confirming it's real; the vote count is the verification count.
  • Reputation-weighted verification via Impact Points, so verifications aren't easily gamed.
  • Threshold-based flagging β€” a single flag does nothing punitive; an issue only goes Under Community Review at 3 independent flags, and a verified issue can never be suppressed by flags. Flagged posts stay visible and rescuable by community verification.

The AI Complaint & Escalation Agent (core differentiator)

  • Autonomous complaint drafting β€” on reaching Verified, an agent drafts a formal, government-appropriate complaint letter.
  • Department routing β€” the agent maps the issue to the correct municipal authority and addresses the complaint accordingly.
  • Unified Authority Escalation Trail β€” one escalating ladder of formal letters: Initial Complaint (Department) β†’ Level 1 (Local Authority) β†’ Level 2 (Ward Office) β†’ Level 3 (Municipal Commissioner). Each letter is addressed to a progressively higher authority, references all prior letters and the time unresolved, and adopts a firmer tone.
  • Reference IDs, Copy / Download / Mark-as-Dispatched actions, and full transparency (clearly labelled AI-drafted).

Transparency & Tracking

  • Status lifecycle β€” Reported β†’ Verified β†’ In Progress β†’ Resolved, with a clear distinction between community-driven promotion (to Verified) and authority-side progression.
  • Interactive map β€” all reports plotted as status-colour-coded pins, with clustering, filters, popup mini-cards, and a draggable pin-picker in the composer.
  • AI Resolution Verification β€” before/after photo comparison via Gemini, producing a Resolved Β· AI Verified badge with a confidence score.

Engagement & Recognition

  • Impact Points β€” a reputation system rewarding genuine impact (reports verified, issues resolved, accurate verifications), not raw volume.
  • Civic tiers β€” Citizen β†’ Volunteer β†’ Community Guardian β†’ Civic Champion β†’ Community Hero.
  • ~70 achievement badges spanning reporting, resolution, department specialisation, verification, escalation, engagement, streaks, hyperlocal contribution, and rare milestones β€” visible on every user profile.
  • Notification centre β€” real-time alerts for everything happening to a user's reports (verified, complaint generated, escalated, resolved, commented, flagged, rescued) plus badge and tier achievements.
  • Threaded comments & replies for community discussion on each issue.

Intelligence

  • Civic Intelligence Dashboard β€” exact computed statistics (totals, resolution rate, breakdowns by department/locality/severity) plus AI-generated insights that interpret only the real aggregates, and grounded recurring-issue projections. No fabricated figures.

How the AI Works

Every AI capability in Community Hero runs on Gemini, called server-side so the API key is never exposed to the browser. Four distinct AI workflows:

  1. Intelligent Intake (Gemini Vision) β€” multimodal analysis of the reported photo returning a strict JSON object (department, sub-category, severity, title, description, priority score, risk assessment, validity check).
  2. Duplicate Detection (Gemini Vision) β€” compares a new report's image and description against nearby candidates to decide if they depict the same physical issue.
  3. Complaint & Escalation Agent (Gemini) β€” an agentic pipeline that reasons about the responsible authority, drafts a formal letter tailored to each escalation stage, and produces structured output.
  4. Resolution Verification (Gemini Vision) β€” compares before/after photos and returns a resolution judgement with a confidence score.

Reliability engineering: every Gemini call is wrapped in a resilient pattern β€” automatic retries with exponential backoff on transient errors (503/429/500), automatic model fallback (gemini-2.5-flash β†’ gemini-2.5-flash-lite), JSON-mode structured output, markdown-fence stripping, and a graceful text-fallback so a parsing failure degrades to a usable result rather than an error.

Integrity principle: the AI never fabricates precise figures. Estimates are clearly labelled "AI estimate," priority is explicitly scoped to "how it looks in the photo," and dashboard insights interpret only real computed aggregates. This honesty is a deliberate trust signal.


Tech Stack

Frontend

  • React (SPA)
  • Vite (build tool)
  • Tailwind CSS (styling)
  • lucide-react (icons)
  • React Router (client-side routing, deep-linkable report/profile/map/dashboard routes)

Mapping

  • Leaflet + react-leaflet (interactive map)
  • OpenStreetMap (map tiles)
  • leaflet.markercluster (clustering)
  • OpenStreetMap Nominatim (reverse geocoding β†’ neighbourhood-level localities)

Backend / Data

  • Firebase Authentication (Google sign-in)
  • Cloud Firestore (all application data, real-time via onSnapshot)
  • Client-side image compression + base64 storage in Firestore (no external blob storage required)

AI

  • Google Gemini 2.5 Flash (primary multimodal model)
  • Google Gemini 2.5 Flash-Lite (fallback model)
  • Gemini structured (JSON) output mode

Build & Deploy

  • Google AI Studio (Build mode β€” full-stack app generation, server-side runtime for Gemini calls)
  • Google Cloud Run (deployment)

Google Technologies Used

Community Hero is built end-to-end on Google's stack:

Technology Role in the project
Google AI Studio Core build-and-deploy environment; generated the full-stack app and hosts the server-side runtime that makes Gemini calls with the managed API key.
Google Gemini 2.5 Flash Multimodal vision + reasoning powering all four AI workflows: intelligent intake, duplicate detection, the complaint/escalation agent, and resolution verification.
Google Gemini 2.5 Flash-Lite Automatic fallback model for resilience under load.
Firebase Authentication Google sign-in and user identity.
Cloud Firestore Real-time database for reports, users, verifications, comments, complaints, escalations, notifications, and badges.
Google Cloud Run Serverless hosting of the deployed, publicly accessible application.

This integrated Google-first architecture means AI, auth, data, and hosting all live within one ecosystem, provisioned and deployed through Google AI Studio.


Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   React + Vite SPA (client)  β”‚
                    β”‚  Tailwind Β· lucide Β· Router   β”‚
                    β”‚  Leaflet/OSM map Β· galleries  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                    β”‚                      β”‚
      β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚ Firebase Auth  β”‚  β”‚  Cloud Firestore  β”‚  β”‚  Server runtime   β”‚
      β”‚ (Google sign-in)β”‚  β”‚ (real-time data,  β”‚  β”‚ (AI Studio) calls β”‚
      β”‚                β”‚  β”‚  base64 images)   β”‚  β”‚  Gemini securely  β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                            β”‚
                                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                              β”‚  Google Gemini 2.5 Flash   β”‚
                                              β”‚  (+ Flash-Lite fallback)   β”‚
                                              β”‚  intake Β· dedup Β· agent Β·  β”‚
                                              β”‚  resolution verification   β”‚
                                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

      Reverse geocoding β†’ OpenStreetMap Nominatim
      Deployed on β†’ Google Cloud Run

Key architectural points:

  • All Gemini calls execute server-side within the AI Studio runtime; the API key is never shipped to the client.
  • Firestore is the single source of truth and drives real-time UI via onSnapshot listeners β€” the live deployed site and the development preview read/write the same database.
  • The app is a single-page application with SPA routing fallback so deep links (/report/{id}, /user/{uid}, /map, /dashboard) resolve correctly on direct load.

Data Model

Core Firestore collections (simplified):

  • reports/{id} β€” title, description, department, subcategory, severity, status, lat/lng, locality, reporter info, verificationCount, commentCount, flagCount, AI fields (priorityScore, risks, validity), escalation/complaint trail.
  • reports/{id}/verifications/{uid} β€” one doc per verifying user (existence = a verification).
  • reports/{id}/comments/{autoId} β€” threaded comments and replies.
  • reports/{id}/flags/{uid} β€” one flag per user, threshold-based review.
  • reports/{id}/images/{autoId} & reportImages/{id} β€” compressed base64 image data, stored separately from the main doc to keep feed queries fast.
  • reports/{id}/afterImages/{autoId} β€” resolution proof photos.
  • reports/{id}/authorityActions β€” the unified complaint + escalation trail (stages 0–3).
  • users/{uid} β€” displayName, photoURL, impactPoints, level, counts, earnedBadges, joinedAt.
  • notifications/{uid}/items/{autoId} β€” per-user notification feed.

Engineering Decisions & Trade-offs

We made several deliberate engineering choices to keep the platform free, accessible, and reliable β€” fitting for a civic product meant for communities:

  • Image storage via client-side compression + base64 in Firestore, rather than Firebase Storage. Firebase Storage now requires a billing plan; we instead resize images in-browser (longest side ~1280px, JPEG quality ~0.65) and store them as base64, keeping image data under Firestore's 1 MB document limit and stored separately from report metadata for fast feed queries. This keeps the entire platform on the free tier with no loss of functionality.
  • Leaflet + OpenStreetMap for mapping, rather than Google Maps Platform. This keeps mapping key-free and billing-free while still delivering pins, clustering, filtering, and a draggable pin-picker. Reverse geocoding uses OpenStreetMap Nominatim, called sparingly and cached to respect rate limits.
  • Resilient Gemini calls everywhere β€” retries, model fallback, and graceful degradation so transient model overload never breaks a user flow or a live demo.
  • AI honesty over fake precision β€” the AI never invents population figures or statistics; estimates are labelled, and dashboard insights interpret only real computed aggregates. Data integrity is a visible trust signal.
  • One escalation ladder, not two systems β€” the complaint and escalation were unified into a single Authority Escalation Trail to avoid redundancy and present one coherent accountability story.

Local Setup

The application is built and deployed via Google AI Studio. To run a local copy of the exported source:

  1. Clone the repository
    git clone https://github.com/avaneeshmenon/community-hero.git
    cd community-hero
  2. Install dependencies
    npm install
  3. Configure environment β€” create a .env (or use the AI Studio Secrets panel) with your Firebase config and Gemini API key:
    FIREBASE_API_KEY=...
    FIREBASE_PROJECT_ID=mythical-xray-sbwbv
    FIREBASE_AUTH_DOMAIN=...
    GEMINI_API_KEY=...        # used server-side only
    
  4. Run the dev server
    npm run dev

Note: Gemini calls run server-side; in production the key is managed by Google AI Studio and never exposed to the client.


Deployment

The application is deployed to Google Cloud Run via Google AI Studio's one-click deploy. The live, publicly accessible URL is:

https://community-hero-54733550535.us-west1.run.app/

The deployment serves the built SPA with routing fallback so all deep links resolve, and runs the server-side functions that make secure Gemini API calls.


Acknowledgements

Built for the BlockseBlock Hackathon under Problem Statement 2 (Community Hero β€” Hyperlocal Problem Solver), using Google AI Studio as the core build-and-deploy tool.

About

AI-powered civic issue-reporting platform that auto-categorizes problems with Gemini Vision, lets communities verify them, and drafts formal complaints that escalate up the government hierarchy. Built on Google AI Studio, Gemini & Firebase. BlockseBlock Hackathon.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages