Inspiration
Our inspiration for CityAlert 2.0 stemmed directly from the "Chatbots for Public Safety" challenge at the Indy Civic Tech Hackathon 2025. We recognized a critical gap in how citizens interact with local authorities regarding non-emergency public safety issues and general civic concerns. Traditional reporting methods can be cumbersome, leading to underreporting and delayed responses. We envisioned a streamlined, accessible platform that leverages modern AI and mapping technologies to empower Indianapolis residents (and potentially beyond) to easily report incidents, while simultaneously providing city departments with efficient tools for management and communication. The core idea was to bridge the communication divide, making cities safer and more responsive through technology.
What it does
CityAlert 2.0 is a comprehensive web platform designed to revolutionize public safety communication. It serves two primary user groups:
For Civilians (Public-facing):
AI-Powered Incident Reporting: Users can report incidents (e.g., fire, crime, hazards, public works issues) through an intuitive, fine-tuned Gemini AI chatbot. The chatbot guides them through a structured reporting flow, collecting descriptions, locations, and optionally, images. It intelligently classifies incidents to the correct city department(s).
Real-time Alerts Map: An interactive Google Map displays all reported incidents with color-coded markers (red for reported, orange for in-progress, green for resolved). Users can click on "View on Map" from incident cards to focus on specific locations. The map updates automatically, providing real-time situational awareness.
Email Alert System: Residents can subscribe to email notifications for new incidents reported in their city, with options to filter by specific departments. They also receive automated email updates when the status of an incident changes.
Resource Hub: A dedicated page offers helpful guides and information on various safety scenarios and provides access to the email subscription service.
Duplicate Detection: The system intelligently identifies and warns users about similar or exact duplicate incidents already reported, directing them to existing alerts to prevent redundant reports.
For City Departments (Department-facing):
Secure Dashboard: Authorized department personnel can log in to a secure dashboard.
Incident Management: Departments view incidents relevant to their classification on a dedicated list and an interactive map. They can easily update the status of incidents (from "reported" to "in_progress" to "resolved").
Incident Details & Actions: Each incident card provides comprehensive details, including location, timestamp, department classification, and a link to view any uploaded images. Departments can also delete incidents (with key verification).
Real-time Overview: The department dashboard's map and incident list update in real-time, offering an immediate overview of ongoing situations.
How we built it
CityAlert 2.0 was built as a full-stack web application, combining robust backend services with a dynamic and user-friendly frontend:
Backend (Flask & Python):
- RESTful API: Developed using Flask, the backend serves as the central hub for all data operations.
- Database: SQLite, managed with Flask-SQLAlchemy, stores incident reports, department details, and user subscriptions.
- AI Integration: A dedicated API endpoint (
/api/chat/gemini) proxies user chat inputs to the Google Gemini 2.0 Flash API. Crucially, we implemented detailed system instructions (prompt engineering) to fine-tune Gemini's behavior, ensuring it adheres strictly to the incident reporting flow, classifies incidents accurately (e.g., "POLICE", "FIRE", "MEDICAL"), and avoids off-topic responses. It also performs initial image analysis when an image is uploaded. - Geocoding: Integrated Google Maps Geocoding API to convert reported addresses into precise latitude and longitude coordinates for map display.
- Image Handling: Supports image uploads (base64) from the frontend, saving them to the server and storing their paths in the database.
- Email Service: Utilized Python's
smtplibto implement a comprehensive email notification system, sending alerts for new incidents and status changes to subscribed users. - Duplicate Detection Logic: Implemented sophisticated logic to detect exact and similar incidents based on description, location, and timestamp, preventing report clutter.
- Department Authentication: Simple key-based authentication for department logins.
Frontend (HTML, CSS, JavaScript):
- Public Interface: Built with plain HTML, styled using Tailwind CSS for a modern, responsive design. JavaScript handles all interactive elements.
- Chatbot UI: A modal-based chatbot interface (
public/js/chat.js) facilitates conversational incident reporting. It dynamically switches between text input and a Google Maps Place Picker for location entry. It sends user messages and uploaded images to the backend's Gemini proxy. - Interactive Maps: Leverages the Google Maps JavaScript API, including the
AdvancedMarkerElementfor custom, color-coded incident markers andgmpx-place-pickerfor enhanced location input. Thepublic/js/map-utils.jsprovides reusable map functionalities. - Real-time Updates: Frontend scripts (
public/js/alerts.js,departments/js/dashboard.js) periodically poll the backend for incident updates, ensuring maps and lists reflect the latest information. - Department Dashboard: A separate HTML/CSS/JS interface for departments, allowing them to view, filter, and update incident statuses. It includes its own interactive map.
- Email Subscription: A dedicated form on the resources page allows users to subscribe to email alerts with optional department-specific filtering.
Challenges we ran into
- Fine-tuning Gemini's Behavior: Crafting the precise system instructions for the Gemini chatbot to ensure it consistently followed the multi-step reporting flow, accurately classified incidents, and provided helpful safety advice while strictly adhering to its defined purpose and refusing off-topic queries. Iterative testing of prompts was crucial.
- Seamless Google Maps Integration: Integrating various Google Maps APIs (Geocoding, JavaScript API, Place Picker, Advanced Markers) to work harmoniously across both public and department interfaces, ensuring real-time updates and accurate location display, proved complex. Handling API key management securely was also a consideration.
- Robust Duplicate Incident Detection: Developing a reliable duplicate detection mechanism that could identify both exact and similar incidents, and then gracefully communicate this to the user via the chatbot, required careful logic design and frontend implementation to provide a good user experience.
- Real-time Data Synchronization: While we implemented polling for real-time updates, ensuring efficient and consistent data synchronization between the backend and multiple frontend views (public alerts, department dashboards) without overwhelming the server was a continuous optimization task.
- Email Service Configuration: Setting up and debugging the
smtplibfor email notifications, especially with various SMTP server requirements (SSL/TLS, port numbers, app passwords), was a non-trivial task that required careful attention to configuration and error handling.
Accomplishments that we're proud of
- Conversational AI for Public Safety: Successfully implementing a functional, fine-tuned Gemini chatbot that provides a natural and efficient way for citizens to report incidents, demonstrating the power of AI in civic tech.
- Full-Stack Functionality: Delivering a complete, end-to-end full-stack application with distinct public and departmental interfaces, showcasing robust backend APIs and a responsive frontend.
- Dynamic Interactive Maps: Integrating sophisticated Google Maps features to visually represent incidents in real-time, enhancing situational awareness for both citizens and city departments.
- Comprehensive Email Alert System: Developing a reliable system for automated email notifications for new incidents and status updates, significantly improving community awareness and engagement.
- Intelligent Duplicate Detection: Implementing a smart system to prevent redundant incident reports, which is crucial for maintaining data integrity and efficiency for city departments.
- Clean Codebase & Scalability: Maintaining a modular and well-structured codebase (backend blueprints, separate JS modules) that is ready for future enhancements and potential scaling.
What we learned
- Prompt Engineering Mastery: Gained deep insights into the nuances of prompt engineering and system instruction design for large language models like Gemini, understanding how subtle changes can drastically affect AI behavior and output.
- Full-Stack Development Synergy: Reinforced the importance of seamless integration between frontend and backend, learning to troubleshoot communication issues and optimize data flow across the stack.
- API Integration Best Practices: Developed practical skills in integrating multiple external APIs (Google Maps, Gemini, SMTP) and managing their keys and rate limits effectively.
- User-Centric Design in Civic Tech: Understood the critical need for intuitive and accessible design in public-facing applications, especially when dealing with sensitive topics like safety and emergency reporting.
- Real-time System Considerations: Explored the complexities of building "real-time" features, from polling mechanisms to the potential for WebSockets for true instant updates.
- Problem-Solving Under Pressure: Learned to rapidly prototype, debug, and iterate on features within a tight deadline, a core skill in hackathon environments.
What's next for CityAlert
- Enhanced Real-time Communication: Implement WebSocket integration to provide truly instantaneous updates for both public alerts and department dashboards, moving beyond periodic polling for a more dynamic experience.
- Advanced Duplicate Detection: Introduce fuzzy matching for incident descriptions and geographic radius checking to identify even more nuanced duplicate reports.
- Analytics and Reporting for Departments: Develop features for departments to analyze incident trends, track response times, and generate comprehensive reports (e.g., heat maps of incident hotspots).
- Improved Mobile Experience: Transform CityAlert into a Progressive Web App (PWA) with GPS location detection for mobile users and offline reporting capabilities.
- Multi-language Support: Expand accessibility by adding support for multiple languages, catering to diverse communities within Indianapolis.
- Voice-to-Text Reporting: Integrate voice recognition for an even more hands-free and accessible incident reporting experience.
- Integration with Existing Emergency Services: Explore partnerships and API integrations with existing 911/emergency dispatch systems to potentially streamline critical incident routing.
- Automated Incident Severity Assessment: Leverage AI to automatically assess the severity of reported incidents, helping departments prioritize responses more effectively.
- User Dashboard for Preferences: Allow users to manage their email subscription preferences (e.g., department filters, digest frequency) through a dedicated personal dashboard.
NOTE: This project is currently in-progress of being deployed through Vercel.
Log in or sign up for Devpost to join the conversation.