Note: This project is a Minimum Viable Product (MVP). It serves as a proof-of-concept for community safety mapping. The current version utilizes simulated local data and routing heuristics to demonstrate the platform's core capabilities.
SafeOrbit is an advanced, AI-powered safety intelligence platform designed to improve security in public spaces. The platform collects real-time user feedback, analyzes risk factors via NLP sentiment analysis, and visualizes this information on a dynamic, color-coded safety heatmap.
By leveraging real-time data, granular time-of-day contextual analysis, and community feedback, SafeOrbit generates responsive safety heatmaps and intelligent routing that help users avoid risky areas and make informed travel decisions.
graph TD
A[User Interface HTML/JS/CSS] -->|Routing Requests| B[Leaflet Routing Machine]
A -->|Submit Reports| C[Flask Backend POST /api/report]
A -->|Fetch Map Data| D[Flask Backend GET /api/safety-data]
A -->|Fetch Route Score| E[Flask Backend GET /api/route-score]
C -->|Rate Limiting Check| F[IP Cooldown Cache]
F -->|Store Incident| G[(SQLite Database)]
D -->|Generate Points| H[AI Sentiment Analyzer]
H -->|Calculate NLP Score| I[Dynamic Time Risk Modifiers]
I -->|Return JSON| A
E -->|Time Analysis| I
Safety indicators aren't just random. The backend Python server utilizes Natural Language Processing (NLP) keyword-matching to analyze community reviews (e.g., "dark", "harassment", "safe", "lit"). The sentiment directly influences the safety score and color of an area.
Locations are displayed using a professional glowing heatmap effect via overlapping, borderless Leaflet circles:
- Safe: High community trust, well-lit.
- Moderately Safe: Exercise Caution.
- Unsafe: High Risk Area based on poor sentiment and time.
Input an origin and destination to calculate a route. SafeOrbit provides an Overall Safety Score out of 100. The routing line drawn on the map dynamically changes color (Green, Yellow, Red) based on the calculated safety score for the journey.
Safety risks change drastically when the sun goes down. SafeOrbit features an exact Time Input that dynamically recalculates heatmaps and route safety scores based on the specific hour, heavily penalizing late-night travel in unlit areas.
The map automatically generates and plots nearby emergency POIs including Police Stations, Hospitals, and Metro Stops using custom FontAwesome icons to assist users in distress.
A seamless UI modal allows users to submit General Safety Feedback or report specific incidents. To prevent spam, the backend enforces a strict IP-based 60-second rate limiter (429 Too Many Requests). Reports are securely stored in a local SQLite database.
| Frontend | Backend & AI | Map & Visualization | Database |
|---|---|---|---|
-
Clone the repository:
git clone https://github.com/yourusername/SafeOrbit.git cd SafeOrbit -
Install dependencies:
pip install flask
-
Run the Flask application:
python web.py
