Skip to content

manojk909/Traffic-Operations-Copilot

Repository files navigation

Traffic Operations Copilot

AI-powered Traffic Operations Copilot for Bengaluru traffic event management, built for Flipkart Gridlock 2.0.

Traffic Operations Copilot converts the instructor-provided ASTraM anonymized event dataset into a decision-support command center for traffic impact assessment, resource planning, barricading, diversion advisories, CCTV validation, intervention simulation, and offline copilot answers.

Problem Statement

Political rallies, festivals, construction activity, sports events, VIP movement, accidents, and sudden public gatherings can disrupt localized road networks. Traffic teams often need to decide manpower, barricading, and diversion plans before the impact is fully visible.

Traffic Operations Copilot answers the operational question:

What should traffic police do right now?

Key Features

  • Traffic Impact Score (TIS) for event-level operational risk.
  • Attendance-aware planning for event scale and field presence.
  • Dynamic officers, reserve, patrol, and barricade recommendations.
  • Dataset-only diversion planning with lower-risk corridor ranking.
  • Intervention comparison for no action, diversion only, diversion plus barricades, and full intervention.
  • Operations map with event, hotspot, and CCTV context.
  • CCTV validation prototype with simulated live feeds and detection overlays.
  • Explainable AI sections for risk, manpower, barricades, diversion, and CCTV verification.
  • Offline AI Copilot over processed ASTraM insights.
  • Post-event learning design for future recalibration.

Architecture

flowchart LR
  A["ASTraM event dataset"] --> B["Python preprocessing"]
  B --> C["Feature engineering"]
  C --> D["Traffic Impact Score engine"]
  D --> E["Resource planner"]
  D --> F["Barricade planner"]
  D --> G["Diversion engine"]
  E --> H["Intervention simulator"]
  F --> H
  G --> H
  H --> I["Next.js API routes"]
  I --> J["Traffic Operations Copilot UI"]
  C --> K["DBSCAN hotspot engine"]
  K --> J
  C --> L["Prototype CCTV layer"]
  L --> J
Loading

More diagrams are in docs/architecture.md.

Workflow

flowchart TD
  A["Event"] --> B["Impact Assessment"]
  B --> C["Resource Planning"]
  C --> D["Barricade Planning"]
  D --> E["Diversion Planning"]
  E --> F["Intervention Comparison"]
  F --> G["Recommended Response Plan"]
  G --> H["Post-event Learning"]
Loading

Tech Stack

  • Next.js App Router
  • TypeScript
  • Tailwind CSS
  • Framer Motion
  • Mapbox GL
  • Recharts
  • Python data pipeline
  • CatBoost surrogate model
  • Scikit-learn, XGBoost, LightGBM benchmarks

Data Boundary

This project uses only the provided ASTraM anonymized event dataset for analytics, scoring, recommendations, clustering, and model training.

Important honesty constraints:

  • No external dataset is used for training or analytics.
  • The dataset has no measured congestion labels, travel time, vehicle counts, or delay duration.
  • TIS is an operational risk score, not a measured congestion prediction.
  • Mapbox is used only for basemap rendering.
  • CCTV feeds are simulated for prototype demonstration; production requires authorized live CCTV streams.

Screenshots

Command Center

Command Center

Operations Map And CCTV Validation

Operations Map and CCTV Validation

Recommended additional captures for submission:

Screen What To Capture
Simulation Scenario controls and recalculated TIS output
AI Copilot CCTV/resource/risk question and grounded answer

Simulator Walkthrough

  1. Open Simulation.
  2. Choose a high-risk event.
  3. Change event cause, priority, duration, or road-closure status.
  4. Click Recalculate TIS.
  5. Explain how TIS and recommendations change without altering backend scoring rules.

Operations Map

The map links events, hotspots, and CCTV validation:

  1. Open Operations Map.
  2. Click an event marker or Open live CCTV in the event feed.
  3. The interface scrolls to Live CCTV Verification.
  4. Review the camera feed, density, queue, detections, and operator actions.

AI Copilot

The copilot is offline and uses local processed insights. Example prompts:

  • Show CCTV camera status and visual confirmation.
  • Which zones need attention?
  • Which corridor has the most disruptions?
  • What resources are needed first?
  • Why is the highest event risky?

Demo Flow

Recommended 3-minute judging flow:

  1. Command Center - Show the recommended response plan first.
  2. Risk Gauge - Explain TIS and severity.
  3. CCTV Validation - Show simulated feed as visual confirmation layer.
  4. Operations Map - Click an event and jump to live CCTV.
  5. Simulation - Modify road closure or duration and recalculate.
  6. AI Copilot - Ask for CCTV or resource summary.

Detailed scenarios are in docs/demo-flow.md.

Local Setup

Install dependencies:

npm install

Create .env.local:

NEXT_PUBLIC_MAPBOX_TOKEN=your_mapbox_token

Generate data artifacts:

npm run process:data
npm run verify:data

Train/verify the surrogate model:

npm run train:model
npm run verify:model

Run locally:

npm run dev

Open:

http://127.0.0.1:3000

Deployment

  1. Push the repository to GitHub.
  2. Import into Vercel or another Next.js hosting provider.
  3. Set NEXT_PUBLIC_MAPBOX_TOKEN.
  4. Ensure data/processed artifacts are present.
  5. Build command: npm run build.
  6. Start command: npm run start if using a Node host.

Future Scope

  • Authorized live CCTV/ASTraM video integration.
  • Real measured congestion, travel-time, and volume labels.
  • Field feedback capture for post-event learning.
  • Role-based command center views.
  • Integration with official dispatch and incident-management systems.

License

MIT

About

AI-powered Traffic Operations Copilot for Bengaluru Traffic Police — Event Intelligence, Hotspot Detection, Traffic Impact Scoring & Resource Planning.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors