How susi12300/safeway-road-safety-apk works
SafeWay is a route-safety application: users enter a trip, receive a route risk assessment, and can view route risk zones or check their current location. The Flask API coordinates routing, weather enrichment, risk scoring, and zone checks; the browser presents results on a map. The excerpts show the route and zone-generation calls, but not all API handler details or model-loading code, so those connections are omitted or marked unverified.
Main entry points: app.py Flask API · script.js Map and results UI · route_service.py Route analysis · weather_service.py Route weather
Components 12
Browser experience
- Map and results UI
frontend/script.js
API and risk analysis
- Flask API
app.py - Route analysis
route_service.py - Route weather
weather_service.py - Risk zones
danger_zone.py
External services
- Nominatim
- OpenRouteService
- OpenWeather
Risk model
- Model training
train_model.py - Accident dataset
accident_data.csv - Trained model
road_risk_model.pkl
Other components
- Driver
Connections 13
- Driver → Map and results UI: enters trip
frontend/script.js - Map and results UI → Flask API: requests analysis
frontend/script.js - Flask API → Route analysis: gets route
app.py - Route analysis → Nominatim: geocodes places
route_service.py - Route analysis → OpenRouteService: requests directions
route_service.py - Flask API → Route weather: gets route weather
app.py - Route weather → OpenWeather: fetches conditions
weather_service.py - Flask API → Risk zones: generates zones
app.py - Map and results UI → Flask API: requests zone checks
frontend/script.js - Flask API → Risk zones: checks location
app.py - Accident dataset → Model training: supplies examples
train_model.py - Model training → Trained model: saves model
train_model.py - Flask API → Trained model: loads for scoring