- Backend: Node.js, TypeScript, Express.js, Firebase Functions, Firestore
- AI/ML: Google Gemini (for synthesis, multimodal analysis, and predictive insights)
- Validation: Zod (schema validation)
- Deployment & Emulation: Firebase CLI, Firebase Emulators
- Logging: Firebase Functions logger
A bustling metropolis like Bengaluru generates millions of scattered data points every minute—from traffic updates and civic issues to spontaneous cultural events. This information is noisy, siloed across different platforms, and becomes outdated almost instantly. The challenge is not just to report news, but to find the signal in the noise and create a living pulse of the city.
Build an agentic application that provides a live, synthesized, and intelligent view of the city. The agent should:
- Fuse Disparate Data: Ingest real-time data from multiple sources (e.g., social media feeds, user-submitted reports). Use Gemini to synthesize multiple reports into a single, actionable summary.
- Enable Multimodal Citizen Reporting: Allow users to submit geo-tagged photos or videos of events. Use Gemini's multimodal capabilities to analyze, categorize, describe, and map these events.
- Create a Predictive & Agentic Layer: Analyze event streams to provide predictive alerts and intelligent notifications, powered by Gemini.
- Visualize the Pulse: Present synthesized information on a real-time, map-based dashboard with a scalable Firebase backend. (Bonus: Analyze public sentiment for a "mood map".)
-
Project Structure:
- All backend code is under
backend/functions/src. - TypeScript is used for type safety and maintainability.
- All backend code is under
-
Endpoints Implemented:
POST /report/submit-report: Accepts user-submitted reports with geo-location, type, source, and optional media URL.GET /: Health check endpoint.GET /health-check: Additional health check endpoint.
-
Report Submission Flow:
- Validates incoming report data using Zod schemas.
- Handles errors gracefully and returns structured API responses.
- Stores validated reports in Firestore with a timestamp.
-
Error Handling:
- Centralized error middleware for consistent API error responses.
-
Utilities:
- Async handler for Express routes.
- Zod error handler for user-friendly validation errors.
- Security Rules:
- Temporary open rules for development.
- Indexes:
- Placeholder for custom indexes.
- Scripts:
- Linting, building, serving, deploying, and logs.
- Emulator Support:
- Local development with Firebase Emulators for Functions and Firestore.
- Integrate Google Gemini:
- Synthesize multiple reports, analyze media, and provide predictive insights.
- Frontend Dashboard:
- Build a real-time, map-based dashboard to visualize city events and summaries.
- Multimodal Analysis:
- Enable photo/video uploads and analysis via Gemini.
- Predictive & Agentic Features:
- Implement predictive alerts and intelligent notifications.
- Sentiment Analysis:
- Analyze public sentiment for mood mapping.
- Install dependencies:
sh cd backend/functions npm install
- Run locally with emulators:
sh npm run serve
- Deploy to Firebase:
sh npm run deploy
- backend/functions/src/index.ts: Express app entry point, route registration, Firebase initialization.
- backend/functions/src/routes/report.route.ts: Report submission route.
- backend/functions/src/controllers/report.controller.ts: Report submission logic.
- backend/functions/src/schemas/report.schema.ts: Zod schema for report validation.
- backend/functions/src/types/report.type.ts: TypeScript types for reports.
- backend/functions/src/utils: API response, error handling, async utilities.