How shashwat-19/real-time-traffic-analysis works
This platform collects TomTom traffic observations, persists them as CSV, derives congestion features, and serves analytics and predictions through an API and Streamlit dashboard. Its ML workflow trains and compares classifiers, saves the best model, and uses that artifact for inference. The README documents the scheduler and product capabilities; source excerpts show the collection, API, dashboard, feature, storage, and prediction calls. Training and evaluation modules are indexed, but evaluation internals were not sampled.
Main entry points: train.py Model training · predict.py Congestion predictor · feature_engineering.py Traffic features · app.py Streamlit dashboard
Components 15
Traffic collection
- Collection scheduler
main.py - TomTom fetcher
src/data_fetcher.py
Traffic data
- Runtime settings
src/config.py - CSV repository
src/data_storage.py - Traffic features
src/feature_engineering.py
Modeling and inference
- Model training
src/train.py - Model evaluation
src/evaluate.py - Feature preprocessing
src/preprocessing.py - Congestion predictor
src/predict.py - Persisted model
- Model metrics
outputs/metrics
User products
- FastAPI service
api/main.py - Streamlit dashboard
src/app.py - Congestion map
src/map_generator.py
Other components
- TomTom Traffic API
Connections 21
- Collection scheduler → Runtime settings: loads settings
main.py - Collection scheduler → TomTom fetcher: fetches records
main.py - TomTom fetcher → TomTom Traffic API: requests traffic
src/data_fetcher.py - Collection scheduler → CSV repository: appends records
main.py - FastAPI service → CSV repository: reads records
api/main.py - FastAPI service → Traffic features: enriches records
api/main.py - FastAPI service → Congestion predictor: requests prediction
api/main.py - Streamlit dashboard → CSV repository: reads records
src/app.py - Streamlit dashboard → Traffic features: enriches records
src/app.py - Streamlit dashboard → Congestion map: renders map
src/app.py - Streamlit dashboard → Congestion predictor: requests prediction
src/app.py - Model training → Runtime settings: loads settings
src/train.py - Model training → Traffic features: generates features
src/train.py - Model training → Feature preprocessing: builds transformer
src/train.py - Model training → Persisted model: saves best model
src/train.py - Model training → Model metrics: writes metrics
src/train.py - Congestion predictor → Traffic features: generates features
src/predict.py - Congestion predictor → Feature preprocessing: uses feature columns
src/predict.py - Congestion predictor → Persisted model: loads model
src/predict.py - Model evaluation → Traffic features: uses feature engineering
src/evaluate.py - Model evaluation → Feature preprocessing: uses preprocessing
src/evaluate.py