How muthesht527/traffic-prediction-project works
This is a Chennai-focused traffic forecast product, not a navigation app. Users choose source, destination, date, and time; the frontend requests a forecast, and the backend resolves locations, obtains a route and weather, predicts congestion where coverage permits, colors route segments, and returns results for map and summary display. The graph includes history and model information as supporting capabilities, plus model training. Some frontend and backend service files were not excerpted; their documented links cite the README, while uncertain implementation-level links are omitted.
Main entry points: routes.py Forecast and utility endpoints · prediction_service.py Congestion prediction · ForecastPage.jsx Forecast page · ForecastForm.jsx Forecast form
Components 21
Forecast interface
- Page router
frontend/src/App.jsx - Forecast page
frontend/src/pages/ForecastPage.jsx - Forecast form
frontend/src/components/Form/ForecastForm.jsx - Place autocomplete
frontend/src/components/Form/AutocompleteSearch.jsx - API client
frontend/src/services/api.js - Traffic map
frontend/src/components/Map/TrafficMap.jsx - Colored route
frontend/src/components/Map/RouteLayer.jsx - Congestion legend
frontend/src/components/Map/Legend.jsx - Prediction summary
frontend/src/components/UI/PredictionSummary.jsx
API and coverage
- Forecast and utility endpoints
backend/api/routes.py
Route and context
- Geocoding
backend/services/geocoding_service.py - Route retrieval
backend/services/route_service.py - Weather retrieval
backend/services/weather_service.py
Prediction and storage
- Feature engineering
backend/services/feature_engineering.py - Congestion prediction
backend/services/prediction_service.py - Model inference
backend/model/model_loader.py - Route color mapping
backend/services/color_mapper.py - Prediction history
backend/services/database_service.py
Model training
- Model trainer
backend/services/model_trainer.py - Training preprocessing
src/data_preprocessing.py
Other components
- User
Connections 22
- User → Page router: opens
- Page router → Forecast page: routes to
frontend/src/App.jsx - Forecast page → Forecast form: presents
- Forecast form → Place autocomplete: uses
- Forecast form → API client: submits forecast
- Place autocomplete → API client: requests geocoding
- API client → Forecast and utility endpoints: sends JSON
- Forecast and utility endpoints → Geocoding: resolves places
backend/api/routes.py - Forecast and utility endpoints → Route retrieval: gets route
backend/api/routes.py - Forecast and utility endpoints → Weather retrieval: gets forecast
backend/api/routes.py - Forecast and utility endpoints → Congestion prediction: requests prediction
backend/api/routes.py - Congestion prediction → Feature engineering: builds features
backend/services/prediction_service.py - Congestion prediction → Training preprocessing: prepares features
backend/services/prediction_service.py - Congestion prediction → Model inference: predicts score
backend/services/prediction_service.py - Forecast and utility endpoints → Route color mapping: colors segments
backend/api/routes.py - Forecast and utility endpoints → Prediction history: saves prediction
backend/api/routes.py - Forecast and utility endpoints → Prediction history: reads history
backend/api/routes.py - Forecast and utility endpoints → Traffic map: returns map data
- Traffic map → Colored route: renders
frontend/src/components/Map/TrafficMap.jsx - Traffic map → Congestion legend: shows key
- Forecast page → Prediction summary: shows results
- Model trainer → Training preprocessing: prepares training data