SYSTEM ARCHITECTURE PROTO TYPE DOCUMENT

TrafficMind AI

Event-Driven Traffic Congestion Intelligence Platform — Predictive ML, Resource Optimization, Offline LLM Copilot, and Real-Time Command Center for Bengaluru Traffic Operations.

React 18 + FastAPI Scikit-Learn 1.9 · OR-Tools 9.15 Naxerion LLM (Offline · Fine-tuned) Edge Deployable · Zero Internet STT (Whisper) · TTS (Coqui) Leaflet Maps · Recharts · Framer Motion
6
React Modules
12
API Endpoints
3
ML Models
100%
Offline Capable
<3s
LLM Response
01 SYSTEM ARCHITECTURE PROTO TYPE

End-to-End System Layers

Five distinct layers — from raw data ingestion through AI inference to the React command interface. Each layer communicates via well-defined interfaces.

L0
DATA SOURCES & INGESTION
Historical Dataset
Bengaluru incident CSV — causes, zones, junctions, durations, priorities loaded via Pandas at startup
Pandas 3.0
Event Feeds
Planned events (rallies, sports), unplanned incidents (accidents, breakdowns) — classified at ingest
Typed Input
GIS / Map Data
GPS coordinates, junction names, zone boundaries — hotspots with lat/lon served to Leaflet maps
Leaflet + OSM
Feature Engineering
Zone/cause label encoding, hour sin/cos cyclical transforms, day-of-week features, StandardScaler normalization
Scikit-Learn
Preprocessed feature vectors flow to AI layer
L1
AI / ML ENGINE
Random Forest Classifier
Predicts incident priority (High/Low) and road closure requirement with confidence scores. Joblib serialized.
Scikit-Learn · RF
Gradient Boost Regressor
Predicts incident duration in minutes. Outputs confidence intervals. Feature importance values exposed via API.
Scikit-Learn · GBR
OR-Tools MIP Optimizer
Mixed Integer Program solves optimal officer + barricade allocation. Cost minimization with resource constraints. <200ms.
OR-Tools 9.15 · MIP
Cosine Similarity RAG
Retrieves top-K similar historical incidents by cosine distance. Injects matched cases as context into Naxerion LLM.
NumPy · Cosine
Queue Simulator (M/D/1)
Queue-theoretic model simulates vehicle accumulation / clearance before vs. after intervention over time.
M/D/1 Queue Theory
Predictions + context flow to Naxerion LLM layer
NAXERION LLM + VOICE ENGINE — OFFLINE OFFLINE READY
Naxerion LLM (Our Own)
Fine-tuned transformer on traffic SOPs + BLR corpus. GGUF Q4_K_M quantization. Runs via llama.cpp — CPU only, no GPU required. <4GB RAM. <2s response.
llama.cpp GGUF Q4_K_M ZERO CLOUD
STT — Whisper
Offline speech recognition (Whisper tiny.en). Converts officer voice commands to text. WebSpeech API as browser fallback.
Offline · <300ms
TTS — Coqui
Offline text-to-speech synthesis. Reads AI-generated operational plans aloud. Priority-adjusted prosody. WebSpeechSynthesis fallback.
Offline · <500ms
RAG Context Injection
System prompt + top-3 cosine-matched incidents + ActiveEvent JSON injected into Naxerion before each inference call.
Context-Aware
JSON responses served over REST API
L3
FastAPI REST LAYER
FastAPI 0.137
Uvicorn ASGI. Auto OpenAPI docs. Pydantic v2 validation. CORS middleware. Startup model preload.
Uvicorn ASGI
Analysis Routes
GET /summary · /hotspots · /timeline · /cause-distribution · /zone-distribution · /junction-ranking · /lessons-learned
Prediction Routes
POST /predict/predict-all → priority + closure + duration
GET /predict/feature-importances
Action Routes
POST /optimize (OR-Tools MIP)
POST /similarity (cosine RAG)
POST /simulate (M/D/1 queue)
HTTP via Vite proxy :5173 → :8000
L4
REACT 18 COMMAND CENTER
Command Center
KPI tiles, SVG risk gauge, AI recommendations, Resource Timeline Gantt, cause distribution charts
Live Map
Leaflet + hotspot markers, officer positions, barricade circles, diversion polylines, tile layer switcher
Forecasting
ML prediction form — cause/zone/time inputs → priority + closure + duration forecast with confidence
Ops Planner
OR-Tools optimizer UI, deployment map, step-by-step playbook timeline with skeleton loader
Digital Twin
Canvas queue animation — 4-lane cars + officers + barricades. Before/After Recharts area chart
AI Copilot ★
Naxerion LLM chat + STT mic input + TTS readback + deployment map. Suggested prompts panel.
Naxerion + Voice
02 — OFFLINE LLM

Naxerion — Fine-Tuned Offline LLM

Our own domain-specific language model for traffic operations. Runs on CPU, requires no internet, and is contextually aware of the active incident at all times.

FLAGSHIP COMPONENT — OUR OWN MODEL

Model Specs

Base: Naxerion AI - MENTOR 7B(our Finetuned Model Under Publication)
Quantization: GGUF Q4_K_M (4-bit)
Runtime: llama.cpp — CPU only
RAM Usage: < 6 GB
Disk Size: ~4.2 GB
Response: < 9 seconds
Internet: Not required

Context Pipeline

① System Prompt
Traffic operations expert — BLR jurisdiction, 120 officers, 300 barricades available
③ ActiveEvent JSON
Current incident: cause, zone, lat/lon, priority, officers, barricades deployed

Outputs

Deployment Playbook
T-120 → T+0 step-by-step tactical plan
Resource Recommendation
Officer count, barricade positions, tow truck ETA
Risk Analysis
Secondary incident probability, queue projections
Diversion Routes
Alternative paths with added travel time estimates
Similarity Recall
Historical match with what worked before

STT — Speech-to-Text

Whisper (tiny.en, offline) converts officer voice commands to text. WebSpeech API browser fallback. Domain vocabulary boost for traffic terms — "SilkBoard", "deploy", "barricade". <300ms recognition on CPU. Hindi + English support.

Whisper tiny.en Offline WebSpeech fallback <300ms

TTS — Text-to-Speech

Coqui (offline neural synthesis) reads Naxerion responses aloud. Priority-adjusted prosody — CRITICAL alerts use urgent tone. WebSpeechSynthesis as browser fallback. First audio in <500ms. Edge WASM deployable.

TTS Offline WebSpeech fallback <500ms

VOICE ROUND-TRIP PIPELINE

Speak
Microphone Input
STT
Whisper → Text
Intent
deploy / predict / route
Naxerion
LLM Inference
TTS
Coqui → Audio
Render
Chat UI + Map
Total round-trip: < 3 seconds — fully offline, zero cloud dependency
03 — EDGE DEPLOYMENT

Edge Computing & Offline Architecture

All components run on a single edge device — Raspberry Pi 5, Intel NUC, or a standard laptop — with zero internet dependency.

Edge Hardware

Raspberry Pi 5 (8GB) / Intel NUC / Laptop. All AI models, FastAPI server, and React build co-located. Local WiFi for field device connectivity.

<4GB RAM ~3GB Disk CPU Only

Offline Capabilities

Every API endpoint, all ML models, Naxerion LLM, STT/TTS, and map tiles function without internet. SQLite for local data persistence. Sync on reconnect.

All 12 APIs OSM Tiles Cached SQLite

Live Analytics (Offline)

Real-time incident metrics, officer utilization, queue depth, and zone heat maps computed from local data — no cloud stream required.

Local Pandas Recharts WS Push Ready

Edge Node — Installed Components

ML MODELS
Naxerion GGUF Q4_K_M (~1.2GB)
RF Classifier — Joblib (~45MB)
GB Regressor — Joblib (~30MB)
Whisper tiny.en (~150MB)
Coqui TTS (~120MB)
SERVICES
FastAPI + Uvicorn (:8000)
React build / Vite dev (:5173)
SQLite local incident cache
OR-Tools 9.15 optimizer
OSM tile cache (offline maps)
NOT REQUIRED
OpenAI / Gemini API
Cloud database / Redis
Internet connection
GPU (CPU inference only)
External auth / OAuth
04 — CONTEXT ENGINE

Context-Aware Global State

A lightweight pub/sub store syncs the active incident context across all 6 React screens in real-time — no Redux, no boilerplate.

ActiveEvent Store

Global singleton holds: eventCause, zone, junction, lat/lon, priority, roadClosure, durationMin, officers, barricades, diversions. Any component update instantly propagates to all 6 pages via useActiveEvent() hook.

Pub/Sub useActiveEvent hook <16ms sync

Live Analytics Engine

Recharts Area + Bar charts fed by FastAPI data. Monthly trend (planned vs unplanned), cause distribution, zone heat map, officer utilization — all computed from the loaded Pandas DataFrame on-device.

Recharts Pandas groupby Real-time ready

CROSS-SCREEN CONTEXT PROPAGATION

ActiveEvent
Store
setActiveEvent()
Command
Live Map
Forecast
Ops Planner
Twin Sim
AI Copilot

Select an incident on Command Center → all screens instantly reflect updated context

05 — REST API

API Endpoints

12 production endpoints across 5 modules. FastAPI 0.137 · Uvicorn ASGI · Pydantic v2 · Auto OpenAPI docs.

METHOD ENDPOINT MODULE PURPOSE KEY FIELDS
GET /health System Server status + loaded model names status, data_loaded, models_loaded[]
GET /api/analysis/summary Analysis Aggregate KPI summary of all incidents total_events, avg_duration_min, road_closures_required
GET /api/analysis/cause-distribution Analysis Incident count grouped by cause [ {cause, count} ]
GET /api/analysis/timeline Analysis Monthly planned vs unplanned trend [ {month, planned, unplanned, total} ]
GET /api/analysis/hotspots Analysis Geo-tagged incident list for Leaflet map [ {lat, lon, cause, priority, road_closure, address} ]
GET /api/analysis/lessons-learned Analysis Repeat junction patterns + recommendations top_repeat_junctions[], top_zones[], causes_by_delay[]
POST /api/predict/predict-all Predict RF + GB inference — priority, closure, duration predicted_priority, priority_confidence, predicted_duration_minutes
GET /api/predict/feature-importances Predict RF feature importance scores for visualization { "zone": 0.23, "hour": 0.18, ... }
POST /api/optimize Optimize OR-Tools MIP — optimal officer + barricade count recommended_officers, recommended_barricades, expected_reduction_percentage
POST /api/similarity RAG Cosine similarity — top-K historical incident matches matches[]: { similarity_score, historical_action, address }
POST /api/simulate Simulate M/D/1 queue simulation — before vs after intervention simulation_timeline[], metrics.overall_delay_reduction_percentage
WS /ai/live-stream Naxerion WebSocket — streaming LLM token output + live alerts Server-sent token stream, alert event payloads
06 — DATA PIPELINE

End-to-End Data Flow

From raw incident input to AI-generated playbook — 7 deterministic stages with measured latencies.

Ingest
CSV → Pandas · Startup
Transform
Feature Eng. · StandardScaler
Predict
RF + GB · <50ms
Optimize
OR-Tools MIP · <200ms
RAG
Cosine Top-K · <20ms
Naxerion
LLM Inference · <2s
Render
React + TTS · <3s total
TECH STACK

Backend

FastAPI0.137.1
Uvicorn0.49.0
Pandas3.0.3
NumPy2.4.6
Scikit-Learn1.9.0
Joblib1.5.3
OR-Tools9.15.6755
Pydantic2.13.4

Frontend

React18
Tailwind CSS+CSS vars
Framer Motion6+
Lucide ReactSVG icons
RechartsArea/Bar/Pie
React-LeafletOSM/Esri
ViteHMR proxy
TypeScriptstrict

AI / Offline

Naxerion LLMGGUF Q4
llama.cppCPU only
Whisper STTtiny.en
Coqui TTSoffline
OR-Tools MIP9.15
Cosine RAGNumPy
SQLitelocal cache
OSM tilescached
07 — OFFLINE ROUND CASE

Why TrafficMind AI Gets Shortlisted

Five concrete differentiators that make this solution stand out from 60,000+ competing teams.

Own Fine-Tuned LLM (Naxerion)

Not using GPT/Gemini API — we built and fine-tuned our own model on traffic operations data. Runs offline on CPU. No team in this competition can claim a custom offline LLM for their domain.

Mathematically Optimal Resource Allocation

OR-Tools Mixed Integer Program — not heuristics, not rules. Provably optimal officer and barricade deployment minimizing cost subject to capacity constraints. Solved in <200ms.

Voice-Controlled AI Copilot

Officers speak commands in the field → Whisper STT → Naxerion generates tactical plan → Coqui TTS reads it back. Hands-free AI operations. Entire pipeline offline in <3 seconds.

Canvas Digital Twin Queue Simulation

HTML5 Canvas renders actual animated car queues in 4 lanes. Vehicles physically drain as you increase officers/barricades via sliders. Visual proof of intervention impact — unique in this competition.

Full-Stack Offline — Demo-Ready in 60 Seconds

Run uvicorn app.main:app --port 8000 + npm run dev → entire platform live. No .env secrets, no cloud keys, no network. Select incident → Generate Plan → Naxerion responds in <3s → TTS reads it aloud → map updates. Demonstrable in one screen, zero setup.