Name: Community Incident Reporter
Basic Overview: Community Incident Reporter is a platform that allows community members to report incidents such as illegal activities, disputes, traffic issues, and crashes. Users can submit reports with details, locations, and images. The platform also features a community discussion section where users can comment on and like reports. A key feature is the integration of AI to automatically generate formal, structured official reports from user-submitted incident data, ready to be sent to relevant authorities.
Technical Explanation
Architecture: The application follows a full-stack architecture using a React frontend and an Express backend, both served together during development using Vite middleware.
- Frontend: Built with React, utilizing functional components and hooks. It uses Tailwind CSS for styling, Lucide React for icons, and Motion for animations. React-Markdown is used to render the AI-generated reports.
- Backend: Built with Express.js, providing RESTful API endpoints for user authentication, report submission, commenting, and liking.
- Database: Uses
better-sqlite3for local, file-based SQLite database storage (incidents.db), managing users, reports, comments, and likes. - Real-time: Uses WebSockets (
ws) to broadcast new comments and likes to all connected clients in real-time.
Tech Stack:
- Frontend: React 18, Vite, Tailwind CSS, Lucide React, Motion, React-Markdown, date-fns.
- Backend: Node.js, Express.js, WebSockets (
ws), better-sqlite3. - AI Integration:
@google/genaiSDK for interacting with Gemini models.
Prompt Design
Prompt Engineering Process: The prompt used to generate the official incident report is designed to be clear, structured, and context-rich.
- Objective Context: The prompt starts by clearly stating the goal: "Generate a formal incident report for the following activity to be sent to the authority:". This sets the tone and purpose for the AI.
- Data Injection: We inject all relevant data points from the user's report directly into the prompt using template literals. This includes:
- Incident Reference (ID)
- Type of incident
- Reporter's name
- Date and Time
- Location
- Description
- Metadata (JSON stringified for structured key-value pairs)
- Formatting Instructions: Finally, the prompt provides specific instructions on the desired output format: "The report should be professional, objective, and structured with clear headings (e.g., Executive Summary, Incident Details, Involved Parties, Conclusion)." This ensures the generated report is ready for official use without requiring significant manual editing.
- Model Selection: We use the
gemini-3-flash-previewmodel, which is well-suited for fast, high-quality text generation tasks like summarizing and structuring information.
Built With
- vibecodingusinggemini
Log in or sign up for Devpost to join the conversation.