How akashmeh/safecruise works
SafeCruise is a research prototype for temporal driving-risk scoring and inspection. Its implemented workflow accepts a telemetry window through the FastAPI service, derives time-windowed features, predicts risk with a persisted XGBoost model, and can return SHAP explanations; a Streamlit dashboard replays trips through the shared scoring path. A separate training workflow builds features from DriveSet data and writes model and evaluation artifacts. The README describes phone/vehicle alerts and connected-vehicle integrations, but the sampled source does not establish their implementation or wiring.
Main entry points: dashboard.py Streamlit dashboard · features.py Risk scoring · train_full_model.py Training and evaluation · main.py FastAPI endpoints
Components 12
Data and Features
- Trip ingestion
features.py - Merged trip data
safe_cruise_full_dataset.csv.gz - Temporal features
features.py - Risk scoring
features.py - SHAP explanations
features.py
Model Lifecycle
- Training and evaluation
train_full_model.py - XGBoost model
safe_cruise_xgboost_model.pkl - Evaluation artifacts
safe_cruise_eval.json
Scoring Service
- FastAPI endpoints
main.py
Dashboard
- Streamlit dashboard
dashboard.py
Other components
- Telemetry client
- DriveSet trips
UAH-DRIVESET-v1
Connections 17
- DriveSet trips → Trip ingestion: supplies trips
- Trip ingestion → Merged trip data: builds dataset
- Training and evaluation → Trip ingestion: loads data
- Training and evaluation → Temporal features: engineers features
- Training and evaluation → XGBoost model: writes model
- Training and evaluation → Evaluation artifacts: writes metrics
- Telemetry client → FastAPI endpoints: posts windows
- FastAPI endpoints → Risk scoring: scores windows
- Risk scoring → Temporal features: derives features
- Risk scoring → XGBoost model: loads model
- Risk scoring → SHAP explanations: requests attribution
- FastAPI endpoints → SHAP explanations: formats impacts
- Streamlit dashboard → Merged trip data: reads trips
- Streamlit dashboard → Evaluation artifacts: reads metrics
- Streamlit dashboard → XGBoost model: loads model
- Streamlit dashboard → Risk scoring: replays trips
- Streamlit dashboard → SHAP explanations: explains peak rows