# phanikumar122/public-transport-demand-prediction architecture

> Architecture diagram of the GitHub repository phanikumar122/public-transport-demand-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/phanikumar122/public-transport-demand-prediction
- Repository: https://github.com/phanikumar122/public-transport-demand-prediction

## Overview

Public Transport Demand Prediction integrates bus, rail, and air data into a warehouse and analytics pipeline, then exposes demand forecasts and operational insights through a web dashboard. The principal workflow is raw data cleaning, warehouse loading, mining and model development, followed by API-served predictions and analysis. README documents OLAP, clustering, anomaly detection, model comparison, tuning, and SHAP; sampled source confirms ETL orchestration, warehouse loading, selected API handlers, and frontend dispatch. Some subsystem wiring is documented rather than directly sampled, so uncertain internal links are omitted.

Main entry points: [`frontend/src/App.tsx`](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/App.tsx) (Dashboard App), [`src/etl/pipeline.py`](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/etl/pipeline.py) (ETL Orchestrator), [`src/ml/train.py`](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/train.py) (Model Training), [`src/warehouse/load.py`](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/warehouse/load.py) (Warehouse Loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Data Ingestion"]
  node_etlrun["ETL Orchestrator<br/>[pipeline.py]"]
  node_busetl["Bus ETL<br/>[apsrtc.py]"]
  node_railet["Rail ETL<br/>[railways.py]"]
  node_airetl["Air ETL<br/>[flights.py]"]
  node_warehouse["Warehouse Loader<br/>[load.py]"]
end

subgraph group_analysis["Analytics"]
  node_olap["OLAP Analysis"]
  node_cluster["Route Clustering<br/>[clustering.py]"]
  node_anomaly["Anomaly Detection"]
  node_preprocess["Feature Preparation<br/>[preprocessing.py]"]
  node_training["Model Training<br/>[train.py]"]
  node_evaluation["Model Evaluation<br/>[evaluate.py]"]
  node_tuning["Hyperparameter Tuning<br/>[tune.py]"]
  node_explain["SHAP Explainability<br/>[explain.py]"]
end

subgraph group_serving["Prediction Service"]
  node_predict["Demand Prediction<br/>[predict.py]"]
  node_api["REST API<br/>[main.py]"]
end

subgraph group_frontend["Dashboard"]
  node_app["Dashboard App<br/>[App.tsx]"]
  node_apiclient["API Client<br/>[api.ts]"]
  node_overview["Overview Dashboard"]
  node_simulator["Prediction Simulator"]
  node_models["Model Performance"]
  node_clusters["Cluster Analysis"]
  node_anomalies["Anomaly Explorer"]
  node_explainui["Explainability Studio"]
  node_batch["Batch Explorer<br/>[BatchExplorer.tsx]"]
  node_geomap["Geospatial Map<br/>[NetworkGeoMap.tsx]"]
end

node_operator(("Analyst"))
node_rawdata["Transport Datasets"]
node_mysql[("MySQL Warehouse")]
node_webuser(("Dashboard User"))

node_rawdata -->|"supplies data"| node_busetl
node_rawdata -->|"supplies data"| node_railet
node_rawdata -->|"supplies data"| node_airetl
node_etlrun -->|"runs"| node_busetl
node_etlrun -->|"runs"| node_railet
node_etlrun -->|"runs"| node_airetl
node_busetl -->|"cleaned data"| node_warehouse
node_railet -->|"cleaned data"| node_warehouse
node_airetl -->|"cleaned data"| node_warehouse
node_warehouse -->|"loads tables"| node_mysql
node_mysql -.->|"provides warehouse data"| node_olap
node_etlrun -.->|"mining step"| node_cluster
node_etlrun -.->|"mining step"| node_anomaly
node_preprocess -.->|"prepares features"| node_training
node_training -.->|"evaluates models"| node_evaluation
node_training -.->|"tunes models"| node_tuning
node_training -.->|"explains best model"| node_explain
node_training -.->|"supports forecasting"| node_predict
node_webuser -->|"uses dashboard"| node_app
node_app -->|"requests data"| node_apiclient
node_apiclient -->|"HTTP requests"| node_api
node_api -->|"runs prediction"| node_predict
node_app -->|"renders"| node_overview
node_app -->|"renders"| node_simulator
node_app -->|"renders"| node_models
node_app -->|"renders"| node_clusters
node_app -->|"renders"| node_anomalies
node_app -->|"renders"| node_explainui
node_app -->|"renders"| node_batch
node_app -->|"renders"| node_geomap

click node_etlrun "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/etl/pipeline.py"
click node_busetl "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/etl/apsrtc.py"
click node_railet "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/etl/railways.py"
click node_airetl "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/etl/flights.py"
click node_warehouse "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/warehouse/load.py"
click node_olap "https://github.com/phanikumar122/public-transport-demand-prediction/tree/main/src/warehouse"
click node_cluster "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/mining/clustering.py"
click node_anomaly "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/mining/anomaly_detection.py"
click node_preprocess "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/preprocessing.py"
click node_training "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/train.py"
click node_evaluation "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/evaluate.py"
click node_tuning "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/tune.py"
click node_explain "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/explain.py"
click node_predict "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/predict.py"
click node_api "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/api/main.py"
click node_app "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/App.tsx"
click node_apiclient "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/services/api.ts"
click node_overview "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/OverviewDashboard.tsx"
click node_simulator "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/PredictionSimulator.tsx"
click node_models "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/ModelPerformance.tsx"
click node_clusters "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/ClusterAnalysis.tsx"
click node_anomalies "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/AnomalyDetection.tsx"
click node_explainui "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/ExplainabilityStudio.tsx"
click node_batch "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/BatchExplorer.tsx"
click node_geomap "https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/NetworkGeoMap.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_etlrun,node_busetl,node_railet,node_airetl,node_warehouse,node_webuser toneBlue
class node_olap,node_cluster,node_anomaly,node_preprocess,node_training,node_evaluation,node_tuning,node_explain,node_mysql toneAmber
class node_predict,node_api toneMint
class node_app,node_apiclient,node_overview,node_simulator,node_models,node_clusters,node_anomalies,node_explainui,node_batch,node_geomap toneRose
class node_operator,node_rawdata toneIndigo
```

## Components

### Data Ingestion

- [ETL Orchestrator](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/etl/pipeline.py): `src/etl/pipeline.py`
- [Bus ETL](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/etl/apsrtc.py): `src/etl/apsrtc.py`
- [Rail ETL](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/etl/railways.py): `src/etl/railways.py`
- [Air ETL](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/etl/flights.py): `src/etl/flights.py`
- [Warehouse Loader](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/warehouse/load.py): `src/warehouse/load.py`

### Analytics

- [OLAP Analysis](https://github.com/phanikumar122/public-transport-demand-prediction/tree/main/src/warehouse): `src/warehouse`
- [Route Clustering](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/mining/clustering.py): `src/mining/clustering.py`
- [Anomaly Detection](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/mining/anomaly_detection.py): `src/mining/anomaly_detection.py`
- [Feature Preparation](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/preprocessing.py): `src/ml/preprocessing.py`
- [Model Training](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/train.py): `src/ml/train.py`
- [Model Evaluation](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/evaluate.py): `src/ml/evaluate.py`
- [Hyperparameter Tuning](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/tune.py): `src/ml/tune.py`
- [SHAP Explainability](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/explain.py): `src/ml/explain.py`

### Prediction Service

- [Demand Prediction](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/ml/predict.py): `src/ml/predict.py`
- [REST API](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/src/api/main.py): `src/api/main.py`

### Dashboard

- [Dashboard App](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Client](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Overview Dashboard](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/OverviewDashboard.tsx): `frontend/src/components/OverviewDashboard.tsx`
- [Prediction Simulator](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/PredictionSimulator.tsx): `frontend/src/components/PredictionSimulator.tsx`
- [Model Performance](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/ModelPerformance.tsx): `frontend/src/components/ModelPerformance.tsx`
- [Cluster Analysis](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/ClusterAnalysis.tsx): `frontend/src/components/ClusterAnalysis.tsx`
- [Anomaly Explorer](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/AnomalyDetection.tsx): `frontend/src/components/AnomalyDetection.tsx`
- [Explainability Studio](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/ExplainabilityStudio.tsx): `frontend/src/components/ExplainabilityStudio.tsx`
- [Batch Explorer](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/BatchExplorer.tsx): `frontend/src/components/BatchExplorer.tsx`
- [Geospatial Map](https://github.com/phanikumar122/public-transport-demand-prediction/blob/main/frontend/src/components/NetworkGeoMap.tsx): `frontend/src/components/NetworkGeoMap.tsx`

### Other components

- **Analyst**
- **Transport Datasets**
- **MySQL Warehouse**
- **Dashboard User**

## Connections

- Transport Datasets → Bus ETL: supplies data
- Transport Datasets → Rail ETL: supplies data
- Transport Datasets → Air ETL: supplies data
- ETL Orchestrator → Bus ETL: runs
- ETL Orchestrator → Rail ETL: runs
- ETL Orchestrator → Air ETL: runs
- Bus ETL → Warehouse Loader: cleaned data
- Rail ETL → Warehouse Loader: cleaned data
- Air ETL → Warehouse Loader: cleaned data
- Warehouse Loader → MySQL Warehouse: loads tables
- MySQL Warehouse → OLAP Analysis: provides warehouse data
- ETL Orchestrator → Route Clustering: mining step
- ETL Orchestrator → Anomaly Detection: mining step
- Feature Preparation → Model Training: prepares features
- Model Training → Model Evaluation: evaluates models
- Model Training → Hyperparameter Tuning: tunes models
- Model Training → SHAP Explainability: explains best model
- Model Training → Demand Prediction: supports forecasting
- Dashboard User → Dashboard App: uses dashboard
- Dashboard App → API Client: requests data
- API Client → REST API: HTTP requests
- REST API → Demand Prediction: runs prediction
- Dashboard App → Overview Dashboard: renders
- Dashboard App → Prediction Simulator: renders
- Dashboard App → Model Performance: renders
- Dashboard App → Cluster Analysis: renders
- Dashboard App → Anomaly Explorer: renders
- Dashboard App → Explainability Studio: renders
- Dashboard App → Batch Explorer: renders
- Dashboard App → Geospatial Map: renders
