SYSTEM FLOW ARCHITECTURE

TrafficMind AI
Command Center

Smart City Traffic Operations Intelligence — Predictive ML, MIP Optimization, Digital Twin Simulation, Offline LLM Copilot for Bengaluru's 8,173 ASTRAM incidents.

8,173
ASTRAM INCIDENTS
46
DATA COLUMNS
88%
PRIORITY ACCURACY
93%
CLOSURE ACCURACY
67%
DELAY REDUCTION
React 18 + TypeScript FastAPI 0.137 + Uvicorn Scikit-Learn 1.9 — RF + TF-IDF OR-Tools 9.15 MIP Naxerion LLM (Offline) Whisper STT + Coqui TTS Leaflet + ESRI ArcGIS Tiles 6 Live Modules
01 — MASTER DATA FLOW

End-to-End System Architecture

Five sequential tiers — from raw ASTRAM CSV through ML inference, LLM intelligence, REST API, to the React command dashboard. Each tier communicates through typed interfaces.

L0: SYSTEM INGESTION & FEATURE PIPELINE L1: CORE COMPUTATIONAL AI/ML & SIMULATION TWIN L2: LOCAL CO-PROCESSOR INTELLIGENCE & VOICE AGENT (NAXERION EDGE) L3: FastAPI REST APPLICATION CONTROLLER & MODEL ROUTER L4: REACT 18 USER INTERFACE COMMAND CENTER (STATE SYNC) Raw ASTRAM CSV Engineered Vector Closure Prediction pred_duration MIP Resource Allocation (x, y) Operator Voice Text Query Prompt Playbook Synthesized Audio REST API & State Sync (JSON) ASTRAM Incident DB 8,173 incidents · 46 cols CSV / pandas 3.0 Operator Manual Inputs Active event updates JSON Payloads Feature Extractor Label encode & cyclical time Scikit-Learn Pipeline StandardScaler & Encoder Zero mean / unit variance scale dense scaled arrays Priority Classifier Random Forest (n=50) Priority: High / Low 88% Acc · Joblib Closure Predictor Random Forest (depth=12) Requires Road Closure 93% Acc · Joblib Duration Regressor RF Regressor (Chained Input) Resolution Time in Minutes MAE: ~38m · R²: 0.41 TF-IDF Similarity Search Cosine search on BLR corpus Retrieves top-3 historical cases 10,000 features · RAG OR-Tools MIP Optimizer Mixed-Integer Program Minimizes officer/barricade cost Google OR-Tools SCIP M/D/1 Queue Simulator Digital Twin Simulation Comp A vs B (with resources) Delay Saved · Queue Twin Whisper STT (Offline) Offline voice recognition WASM / Local Engine tiny.en · <300ms Context & Prompt Assembler Binds queries with active variables and top-3 RAG context logs Context-Aware ★ Naxerion LLM (Our Own) Fine-tuned on BLR SOPs & incident database GGUF Q4_K_M running via llama.cpp on CPU Naxerion AI - MENTOR 7B(our Finetuned Model Under Publication) Coqui TTS (Offline) Neural audio synthesis Priority prosody speech Speech Output · <500ms FastAPI REST Controller — 12 GET/POST Endpoints (Auto OpenAPI /docs) React 18 Dashboard Command Center — 6 Views (Context State-Sync)

IEEE Technical Specification

Hover or click any architecture component in the diagram to inspect mathematical models, data schemas, code references, and exact metrics.

02 — MACHINE LEARNING

ML Models — Exact Performance Metrics

Three Random Forest models trained on 80/20 stratified splits from 8,173 ASTRAM incidents. One TF-IDF vectorizer. All serialized to .joblib files, loaded at FastAPI startup for <50ms inference.

Priority Classifier

Random Forest · n_estimators=50 · max_depth=12 · Predicts High / Low incident priority before dispatch

Accuracy88%
Class: Low (1,180 samples)
Precision0.89
Recall0.94
F10.91
Class: High (454 samples)
Precision0.82
Recall0.72
F10.77
Top features: Junction + longitude (~52% combined importance)
RF Classifier Joblib serialized

Road Closure Predictor

Random Forest · Same feature set · Predicts road closure requirement for pre-activating diversion routes

Accuracy93%
Class: No Closure (1,367 samples)
Precision0.93
Recall0.98
F10.95
Class: Closure (268 samples)
Precision0.91
Recall0.72
F10.80
Use: Output fed as input feature into Duration Regressor
RF Classifier Chained Model

Duration Regressor

RF Regressor · Predicts incident duration in minutes · closure prediction used as additional input

MAE~38 minutes
R² Score0.41
OutputContinuous (min)
Targetcomputed_duration_min
Duration cap: 1,440 min (24h) to remove anomalies. Fallback chain: closed_dt → resolved_dt → end_dt → modified_dt
RF Regressor Chained Input

TF-IDF Cosine Similarity

10,000 feature sparse matrix on composite text: {cause} {description} at {address} in {zone} near {junction}. Cosine similarity against all 8,173 events. Returns top-K with historical action taken.

Use in Copilot: New incident query → retrieves closest match → injects that match's response record into Naxerion as evidence. Prevents hallucination by grounding in real outcomes.

max_features=10000 Joblib vectorizer Cosine sim

OR-Tools MIP Resource Optimizer

SCIP Mixed-Integer Program. Objective: Min 100x + 20y (x=officers, y=barricades) subject to reduction target constraint.

Officer reduction rate8.0 min × priority_factor
Barricade reduction rate1.5 min × priority_factor
High priority factor1.5×
Sample (120min, High)3 officers, 16 barricades
Expected reduction72% → 34 min remaining
Solver latency<200ms · fallback grid-search
03 — OFFLINE AI

Naxerion LLM — Fine-Tuned, Offline, Our Own

Not using GPT-4 or Gemini — we built and fine-tuned our own traffic-domain language model. Runs on CPU, zero cloud, zero API keys. Full voice pipeline under 3 seconds.

FLAGSHIP — OUR OWN MODEL
MODEL SPECS
Base: Naxerion AI - MENTOR 7B(our Finetuned Model Under Publication)
Fine-tune corpus: Traffic SOPs + BLR incident history
Quantization: GGUF Q4_K_M (4-bit)
Runtime: llama.cpp — CPU only
RAM: <6 GB
Disk: ~4.2 GB
Latency: <9 seconds per response
Internet: None required
CONTEXT INJECTION
① System Prompt
Traffic ops expert, BLR jurisdiction, 120 officers, 300 barricades available
② TF-IDF RAG
Top-3 cosine-matched incidents with historical_action field
③ ActiveEvent JSON
Current: cause, zone, lat/lon, priority, officers deployed, barricades
OUTPUTS
T-120→T+0 Deployment Playbook
Officer + Barricade Count Advice
Secondary Incident Risk Analysis
Diversion Route Suggestions
Historical Match + What Worked
Recovery Phase Plan
VOICE ROUND-TRIP — FULL OFFLINE — <3 SECOND END-TO-END
Speak
Officer mic
Whisper STT
tiny.en · <300ms offline
Intent Parse
deploy/predict/route/risk
TF-IDF RAG
Top-3 historical match
Naxerion LLM
<2s CPU inference
Coqui TTS
<500ms audio
UI + Map
Chat render + polylines
04 — EDGE & CONTEXT

Edge Deployment & Context-Aware State

100% offline capable on a single device. Global publish-subscribe store synchronizes incident context across all 6 screens in <16ms.

Edge Deployment Checklist

All 12 API endpoints run offline
All 5 joblib ML models loaded at startup
Naxerion LLM inference on CPU only
Whisper STT offline (tiny.en)
Coqui TTS offline synthesis
OR-Tools MIP solver local
ESRI ArcGIS tile cache (confirmed working, no key)
start.bat one-click launch — zero setup
OpenAI / Gemini API — NOT NEEDED
GPU — NOT NEEDED (CPU only)
Internet connection — NOT NEEDED

Context-Aware Global State

Pub/sub store.ts — no Redux. setActiveEvent(patch) → all 6 screens re-render in <16ms via useActiveEvent() hook.

① Command Center
② Live Map
③ Forecasting
ActiveEvent
pub/sub store
<16ms sync
④ Ops Planner
⑤ Digital Twin
⑥ AI Copilot ★
Fields: eventCause · zone · junction · lat/lon · priority · roadClosure · durationMin · officers · barricades · diversions[]

Edge Hardware Requirements

<6GB
RAM Required
~4.2GB
Disk (models)
CPU
No GPU needed
RPi 5
/ NUC / Laptop
05 — REST API

12 API Endpoints

FastAPI 0.137 · Uvicorn 0.49 · Pydantic v2 · Auto OpenAPI at http://127.0.0.1:8000/docs

METHODENDPOINTMODULEPURPOSEKEY RESPONSE FIELDS
GET/healthSystemBackend health + loaded model liststatus, data_loaded, models_loaded[]
GET/api/analysis/summaryAnalysisAggregate KPI metrics from 8,173 incidentstotal_events, avg_duration_min, road_closures_required
GET/api/analysis/cause-distributionAnalysisIncident count per cause (11 categories)[ {cause, count} ]
GET/api/analysis/hotspotsAnalysis1,000 geo-tagged incidents for Leaflet map[ {lat, lon, cause, priority, road_closure, address} ]
GET/api/analysis/timelineAnalysisMonthly planned vs unplanned trend[ {month, planned, unplanned, total} ]
GET/api/analysis/junction-rankingAnalysisTop 15 junctions ranked by incident count[ {junction, count} ]
GET/api/analysis/lessons-learnedAnalysisHigh-risk junctions + zone + delay causestop_repeat_junctions[], top_zones[], causes_by_delay[]
POST/api/predict/predict-allPredictRF inference chain → priority + closure + durationpredicted_priority, priority_confidence, predicted_duration_minutes
GET/api/predict/feature-importancesPredictRF feature importance for explainability chart{ "junction": 0.31, "longitude": 0.21, ... }
POST/api/optimizeOptimizeOR-Tools MIP → optimal officers + barricadesrecommended_officers, barricades, expected_reduction_percentage
POST/api/similarityRAGTF-IDF cosine → top-K historical matchesmatches[]: { similarity_score, historical_action, address }
POST/api/simulateSimulateQueue-theoretic twin — before vs after interventionsimulation_timeline[], metrics.overall_delay_reduction_percentage
06 — DATA INSIGHTS

Lessons Learned from 8,173 ASTRAM Incidents

Key findings extracted directly from the Bengaluru incident dataset — used to drive Naxerion prompting, OR-Tools constraints, and risk gauge calibration.

Top 5 High-Risk Junctions

SilkBoard Junction flagged for permanent officer deployment — highest avg duration + most road closures.

JUNCTIONINCIDENTSAVG DURATIONCLOSURES
SilkBoardJunc54~112 min18
MekhriCircle64~95 min12
KRCircle43~91 min11
AyyappaTempleJunc58~88 min9
BTMLayout2ndStage47~78 min6

Cause Analysis

Vehicle Breakdown dominates frequency. Water Logging causes longest delays. Accidents drive road closures.

CAUSECOUNT / SHAREAVG DELAYCAPACITY REDUCTION
Vehicle Breakdown4,896 (59.9%)25%
Water Logging~145 min65%
Protest~132 min70%
VIP Movement60%
Accident50% + closures
Procession55%

Temporal Patterns

Peak hour incidents last40% longer
Highest incident density dayFriday
Monsoon water-logging uplift2.3× higher
Peak hours (morning)07:00–10:00
Peak hours (evening)17:00–20:00
Top 2 features (RF)Junction + Longitude (~52%)

Digital Twin — Sample Result

120-min accident · 6 officers · 25 barricades

Peak queue (no intervention)512 vehicles
Peak queue (with intervention)187 vehicles
Total delay saved8.4 hours
Overall delay reduction67%
ModelM/D/1 queue theory · 5-min steps
Dispatch lagT+10 min
07 — INNOVATION HIGHLIGHTS

Why This Gets Shortlisted

Six precise differentiators — each verifiable in the codebase and backed by real metrics from the ASTRAM dataset.

1
Own LLM
Naxerion fine-tuned · no GPT/Gemini · offline CPU
2
MIP Optimizer
Provably optimal · hard constraints · <200ms
3
Voice AI
STT → Naxerion → TTS · <3s offline
4
Digital Twin
Canvas animation · 67% delay reduction demo
5
Context State
6-screen sync · <16ms · pub/sub · no Redux
6
Zero Cloud
start.bat → full platform · no .env · no keys

Proven by Numbers

8,173 real ASTRAM incidents — not synthetic data
88% / 93% classification accuracy — verified by held-out test set
67% delay reduction — computed from M/D/1 queue model
72% reduction by OR-Tools MIP — for 120min High priority incident
Junction + Longitude = 52% RF importance — verifiable via /feature-importances
SilkBoard = highest risk junction — 18 closures, 112min avg — data-backed

Demo in 60 Seconds

double-click start.bat
Backend (:8000) + Frontend (:5173) launch
Select SilkBoard Junction incident on Command Center
AI Copilot: "Generate deployment playbook"
Naxerion responds in <2s · TTS reads it aloud
Ops Planner: OR-Tools returns 3 officers, 16 barricades
Digital Twin shows 67% delay reduction — offline, zero cloud