How 0xros-200/dynamic-fare-and-occupancy-regressor-model works
This repository is a transit analytics platform: historical telemetry is prepared and used to train fare, occupancy, and delay regressors; events can then be predicted through an API or Kafka streaming path, with prediction records available to a dashboard. The graph preserves documented training, streaming, synthetic-data, and monitoring capabilities. Some streaming and training details are documented only in the README; edges based on that documentation cite it, and unsampled implementation details are not inferred.
Main entry points: server.py Prediction API · ingest.py Telemetry Ingestion · train_pipeline.py Model Training · spark_streaming_predict.py Spark Streaming Predictor
Components 19
Data Preparation
- Telemetry Ingestion
spark/ingest.py - Prepared Parquet
- Feature Engineering
spark/feature_engineering.py
Modeling and Serving
- Model Training
spark/train_pipeline.py - Fare, Occupancy, Delay Models
- MLflow Tracking
- Batch Evaluation
spark/batch_evaluate.py - Prediction API
api/server.py - Model Predictor
api/predictor.py
Real-time Feeds
- Kafka Producer
stream/kafka_producer.py - Transit Event Topic
- Synthetic Event Generator
stream/synthetic_generator.py - Spark Streaming Predictor
stream/spark_streaming_predict.py
Analytics
- Prediction Audit Store
api/server.py - Analytics Dashboard
dashboard/app.py - Prediction Data Loader
dashboard/data_loader.py - Plotly Visualizations
dashboard/charts.py
Other components
- Transit Archive
- API Clients
Connections 20
- Transit Archive → Telemetry Ingestion: supplies telemetry
README.md - Telemetry Ingestion → Prepared Parquet: writes Parquet
spark/ingest.py - Prepared Parquet → Feature Engineering: reads splits
README.md - Telemetry Ingestion → Feature Engineering: provides Spark session
spark/feature_engineering.py - Feature Engineering → Model Training: produces features
README.md - Model Training → Fare, Occupancy, Delay Models: saves models
spark/train_pipeline.py - Model Training → MLflow Tracking: logs metrics
spark/train_pipeline.py - Fare, Occupancy, Delay Models → Batch Evaluation: evaluated by
spark/batch_evaluate.py - API Clients → Prediction API: submits events
README.md - Prediction API → Model Predictor: requests predictions
api/server.py - Model Predictor → Fare, Occupancy, Delay Models: loads and predicts
api/predictor.py - Prediction API → Prediction Audit Store: records predictions
api/server.py - Synthetic Event Generator → Transit Event Topic: publishes events
README.md - Kafka Producer → Transit Event Topic: publishes telemetry
README.md - Transit Event Topic → Spark Streaming Predictor: streams events
README.md - Spark Streaming Predictor → Prediction API: posts event batches
stream/spark_streaming_predict.py - Spark Streaming Predictor → Prediction Audit Store: inserts predictions
stream/spark_streaming_predict.py - Prediction Audit Store → Prediction Data Loader: stores prediction rows
dashboard/data_loader.py - Analytics Dashboard → Prediction Data Loader: loads predictions
dashboard/app.py - Analytics Dashboard → Plotly Visualizations: renders charts
dashboard/app.py