Predictive Event Traffic Command Center for Bengaluru
Major public eventsโIPL Cricket Matches at M. Chinnaswamy Stadium, mega concerts at Bengaluru Palace Grounds, international exhibitions at BIEC, and massive rallies near Vidhana Soudha and Freedom Parkโcause severe, cascading gridlock across Bengaluruโs arterial road networks. Traditional navigation apps operate reactively after congestion builds, leading to stranded commuters, trapped emergency vehicles, and delayed public transport.
Astraea is an end-to-end, AI-powered Predictive Event Traffic Command Center engineered specifically for urban traffic authorities in Bengaluru. Astraea moves traffic management from reactive firefighting to proactive dynamic dispatch.
By unifying Gradient-Boosted ensemble machine learning, spatiotemporal road network graphs (NetworkX), automated police deployment algorithms, and interactive geospatial visualization, Astraea enables traffic commanders to model event impacts hours in advance and deploy surgical interventions before gridlock occurs.
Real-time congestion heatmap, junction status overlays, venue footprint radius rings, and event simulation control panel.

Automated officer budget allocation, dynamic signal green-split recommendations, and dynamic corridor diversion routing.

Backtest model performance on real historical events (e.g. RCB vs CSK at Chinnaswamy Stadium) with MAE, RMSE, and actual-vs-predicted curves.

-
๐ฎ Predictive Congestion Forecasting Engine: Utilizes a trained
HistGradientBoostingRegressormodel evaluated on over 575,000 spatiotemporal instances across 440+ historical and simulated events. Forecasts junction-level congestion index (0โ100%) and vehicle delay (min/km). -
๐บ๏ธ Bengaluru Road Graph Network (NetworkX): Models 38 key arterial junctions (e.g., Trinity Circle, Hebbal Flyover, Central Silk Board, Mekhri Circle, Corporation Circle) and 54 major connecting corridors with lane capacities, free-flow travel speeds, Haversine distances, and Betweenness Centrality metrics.
-
๐ฆ Automated Intervention & Dispatch Optimizer: Generates targeted tactical recommendations for traffic police commanders given a fixed manpower budget:
- Officer Allocation: Prioritizes bottleneck nodes based on predicted surge and network centrality.
- Signal Timing Adjustments: Recommends adaptive green-split extensions (+15s to +30s) on heavy corridors.
- Dynamic Diversions: Identifies detour routes to protect central arterial nodes.
-
โฑ๏ธ Granular Spatiotemporal Timeline Scrubber: Interactive scrubber spanning T-3h (pre-event entry ramp-up) to T+3h (post-event dispersion), capturing arrival peaks, mid-event lulls, and departure surges.
-
๐ Post-Event Accuracy & Replay Analytics: Module for historical event backtesting (e.g. RCB vs CSK IPL matches, ColdPlay concerts). Computes MAE (Mean Absolute Error), RMSE (Root Mean Square Error), and percentage of predictions within ยฑ5/10 point tolerances.
flowchart TD
subgraph Inputs ["Input Layer"]
A[Event Metadata: Venue, Attendance, Start Time, Duration]
B[Weather & Calendar: Rain, Temp, Day of Week, Holiday]
C[Road Graph Topology: 38 Junctions, 54 Corridors]
end
subgraph FeatureEng ["Feature Engineering"]
D[Distance Decay Calculation]
E[Temporal Offset Phase Mapping]
F[Betweenness Centrality & Saturation Volumes]
end
subgraph ML ["Predictive ML Pipeline"]
G[HistGradientBoosting Regressor]
H[Congestion Index Prediction]
I[Vehicle Delay Prediction]
end
subgraph Optimizer ["Intervention Engine"]
J[Manpower Budget Allocator]
K[Signal Timing Optimizer]
L[Corridor Diversion Planner]
end
subgraph UI ["Interactive Command Center"]
M[Leaflet Geospatial Map]
N[Timeline Scrubber T-3h to T+3h]
O[Tactical Action Cards]
P[Historical Event Replay]
end
A --> D
B --> E
C --> F
D & E & F --> G
G --> H & I
H & I --> J & K & L
H & I & J & K & L --> M & N & O & P
The Astraea forecasting pipeline splits synthetic and historical event data by event ID to ensure strict out-of-sample evaluation on unseen public events.
| Model Target | MAE (Mean Absolute Error) | Rยฒ Score | Baseline MAE | Skill vs. Baseline |
|---|---|---|---|---|
| Congestion Index (0โ100) | 3.049 | 0.9434 | 13.576 | +77.5% |
| Vehicle Delay (min/km) | 0.493 | 0.8185 | 1.066 | +53.7% |
- Spatial & Topology:
dist_km,lanes,base_volume,centrality - Event Properties:
attendance,attendance_ratio,venue_capacity,event_type_code - Temporal & Calendar:
hour,dow,is_weekend,is_holiday,minutes_rel,duration_min,phase_code - Environmental:
rain,temp_c
- M. Chinnaswamy Stadium (Capacity: 40,000 | Cricket, Concerts)
- Bengaluru Palace Grounds (Capacity: 100,000 | Concerts, Festivals, Rallies)
- Freedom Park (Capacity: 50,000 | Political Rallies, Protests)
- Vidhana Soudha Precinct (Capacity: 30,000 | VIP Movement, Rallies)
- Sree Kanteerava Stadium (Capacity: 24,000 | Football, Athletics)
- Kanteerava Indoor Stadium (Capacity: 12,000 | Indoor Sports, Concerts)
- National College Grounds, Basavanagudi (Capacity: 35,000 | Cultural Festivals)
- Jayamahal Palace Grounds (Capacity: 20,000 | Exhibitions, Expos)
- Central Core: Trinity Circle, Anil Kumble Circle, Cubbon Park, MG Road, Residency Road, Richmond Circle, Corporation Circle, Town Hall, KR Market.
- Arterial Flyovers & Hubs: Central Silk Board, Hebbal Flyover, Mekhri Circle, Windsor Manor, Majestic (Kempegowda), Dairy Circle, Domlur Flyover, KR Puram / Tin Factory.
Astraea/
โโโ api/ # Python FastAPI Backend
โ โโโ app/
โ โ โโโ artifacts/ # Trained model artifacts & metrics JSON
โ โ โ โโโ model_congestion.joblib
โ โ โ โโโ model_delay.joblib
โ โ โ โโโ metrics.json
โ โ โโโ data/ # Spatial graph & venue definitions
โ โ โ โโโ graph.py # NetworkX road graph & centrality
โ โ โ โโโ venues.py # Bengaluru venue database
โ โ โโโ ml/ # Machine Learning pipeline
โ โ โ โโโ features.py # Feature engineering & encoders
โ โ โ โโโ forecast.py # Forecaster wrapper class
โ โ โ โโโ generate.py # Historical event generator & actuals simulator
โ โ โ โโโ optimize.py # Police manpower & signal optimizer
โ โ โ โโโ train.py # Training script
โ โ โโโ main.py # FastAPI entrypoint & REST routes
โ โ โโโ schemas.py # Pydantic request/response schemas
โ โโโ Procfile
โ โโโ requirements.txt
โโโ web/ # Next.js 16 / React 19 Frontend
โ โโโ src/
โ โ โโโ app/ # Next.js App Router
โ โ โ โโโ layout.tsx
โ โ โ โโโ page.tsx
โ โ โโโ components/ # UI Components
โ โ โ โโโ Dashboard.tsx # Main Command Center Container
โ โ โ โโโ MapView.tsx # Leaflet Map Component
โ โ โ โโโ ScenarioPanel.tsx # Scenario Input Controls
โ โ โ โโโ TimeSlider.tsx # Spatiotemporal Scrubber
โ โ โ โโโ KpiBar.tsx # Top Metrics Display
โ โ โ โโโ RecommendationsPanel.tsx # Tactical Dispatch Cards
โ โ โ โโโ AccuracyPanel.tsx # Replay Evaluation Panel
โ โ โ โโโ TimelineChart.tsx # Recharts Congestion Curve
โ โ โโโ lib/ # API client & types
โ โโโ package.json
โ โโโ tsconfig.json
โ โโโ postcss.config.mjs
โโโ docs/
โโโ images/ # Embedded visual assets
โโโ hero-banner.png
โโโ dashboard-preview.png
โโโ dispatch-optimization.png
โโโ post-event-replay.png
- Node.js: v18.0.0 or higher
- Python: v3.10 or higher
- npm or pnpm
git clone https://github.com/AdityaSahu786/Astraea.git
cd Astraea-
Navigate to
api/directory:cd api -
Create & activate Python virtual environment:
python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Train the ML models:
python -m app.ml.train
-
Start the FastAPI server:
uvicorn app.main:app --reload --port 8000
๐ API Interactive Documentation: Available at http://localhost:8000/docs
-
In a new terminal window, navigate to
web/:cd web -
Install Node dependencies:
npm install
-
Start the Next.js development server:
npm run dev
-
Open your browser and launch the Astraea Command Center:
http://localhost:3000
| Endpoint | Method | Description |
|---|---|---|
GET /health |
GET |
Health check & model artifact training status verification |
GET /api/venues |
GET |
Returns all 8 Bengaluru venue records with coordinates & capacities |
GET /api/event-types |
GET |
Returns event categories (cricket, concert, rally, festival, etc.) |
GET /api/weather-options |
GET |
Returns rain/weather options for simulation |
GET /api/graph |
GET |
Returns 38 graph nodes and 54 edges with centrality and road capacities |
GET /api/metrics |
GET |
Returns model evaluation metrics (MAE, Rยฒ, baseline comparison) |
POST /api/simulate |
POST |
Generates junction-level forecasts and tactical intervention plans |
GET /api/events |
GET |
Returns list of historical events available for replay |
GET /api/events/{id}/replay |
GET |
Computes replay accuracy, predicted-vs-actual curves, and per-junction deltas |
- Live IoT Feed Integration: Ingest real-time traffic speeds from TomTom / Google Distance Matrix APIs and CCTV camera counts.
- V2X Signal Hardware API: Direct integration with Bengaluru Traffic Police (BTP) automated traffic signal controllers for dynamic green-wave pulsing.
- Reinforcement Learning Dispatcher: Deep Q-Network (DQN) agent for multi-agent officer routing under dynamic urban constraints.
- Public Transit Dynamic Rerouting: Dynamic shuttle frequency adjustment recommendations for BMTC buses during major event exits.
Distributed under the MIT License. See LICENSE for more information.
Built with โค๏ธ for Bengaluru Urban Mobility & Traffic Command
