Inspiration

At a crowded event, a safety problem rarely appears as one clear warning. It appears as scattered reports: "someone fell," "people are pushing," "I can't move," or "someone needs help." For an organizer monitoring hundreds or thousands of people, understanding what those reports collectively mean can be difficult and time-critical.

We wanted to build a system that could turn these scattered reports into actionable, real-time safety intelligence.

What We Built

We built a real-time crowd safety platform that connects a participant mobile application with an organizer dashboard.

Participants can discover active events, share their location, and send SOS reports. Reports are validated against the event's geofence and stored in PostgreSQL.

The backend uses a spatially optimized DBSCAN algorithm to group nearby incidents and identify areas with increasing incident density. These risk zones are streamed to the administrator dashboard in real time through WebSockets and visualized on a live map.

Where Gemini Comes In

The most important challenge was that location and incident count alone cannot tell the whole story.

Two reports in the same area could simply be minor assistance requests, while a single report such as "someone is being assaulted" could represent an immediate safety threat.

We integrated Gemini into the core incident-risk pipeline to understand the meaning of participant descriptions and classify their semantic risk as LOW, MEDIUM, or HIGH.

The system combines:

  • DBSCAN spatial risk — how concentrated incidents are geographically
  • Gemini semantic risk — how serious the reported situation is

The final risk is the higher of the two.

This means a single severe report can be escalated to HIGH even when there are not enough reports to form a high-density spatial cluster.

When a participant does not provide a description, Gemini is skipped and the existing spatial-risk system continues to work normally. If Gemini is unavailable, the system safely falls back to DBSCAN.

What We Learned

We learned that building a real-time safety system is not only about detecting incidents; it is about combining different kinds of signals without allowing one unreliable component to break the system.

We also learned how to integrate a generative AI model into an existing deterministic system in a meaningful way rather than using AI only as a chatbot or presentation feature.

Challenges

One of our biggest challenges was designing the Gemini integration without putting the SOS flow at risk. Gemini analysis is therefore handled asynchronously after the incident is safely persisted.

We also had to solve real-time communication between the mobile application, Spring Boot backend, PostgreSQL, DBSCAN processing, WebSockets, and the React dashboard while keeping the existing system responsive.

Another challenge was handling incomplete reports. Participants may provide no description at all, so the system needed a reliable fallback instead of forcing AI analysis when there is insufficient information.

What Makes It Different

Our system combines spatial intelligence and semantic intelligence.

DBSCAN tells us where incidents are concentrating.

Gemini helps us understand what people are actually reporting.

Together, they allow scattered human reports to become a richer real-time picture of crowd safety.

Built With

Share this project:

Updates

Submission history