React-based operator dashboard for the Smart City Dynamic Dispatch Grid.
The frontend allows an operator or judge to submit messy emergency call transcripts and view the full AI-assisted response pipeline:
Transcript
→ Incident Extraction
→ Triage Priority
→ Dispatch Assignment
→ Full JSON Output
This frontend is designed for a hackathon demo and product-style presentation. It connects to the FastAPI backend and displays:
- incoming transcript input
- sample noisy emergency calls
- priority level and score
- extracted incident type
- detected location
- dispatch status
- assigned emergency resources
- ETA values
- triage reasoning
- recommended actions
- full backend JSON output
- React
- Vite
- CSS
- lucide-react icons
- FastAPI backend integration
frontend/
├── public/
├── src/
│ ├── assets/
│ ├── App.jsx
│ ├── App.css
│ ├── index.css
│ └── main.jsx
├── .env
├── package.json
├── vite.config.js
└── README.md
From the frontend directory:
cd frontendInstall dependencies:
npm installInstall icons if not already installed:
npm install lucide-reactCreate a .env file in frontend/:
VITE_API_BASE_URL=http://127.0.0.1:8000This tells the frontend where the backend API is running.
npm run devOpen the local Vite URL, usually:
http://localhost:5173
The backend must be running separately.
From the backend directory:
cd backend
npm run dev:apiBackend URL:
http://127.0.0.1:8000
- Start backend:
cd backend
npm run dev:api- Start frontend:
cd frontend
npm run dev-
Open frontend in browser.
-
Select a sample transcript or type your own.
-
Click:
Process Call
- View:
- priority level
- incident type
- extracted location
- dispatch status
- assigned resources
- triage reasoning
- full JSON output
The UI includes sample noisy transcripts such as:
aaaa please hurry smok and fire near green park metro people trapped inside
bus and kar hit badli near sity hospital rood blockd two injrd please send amblance
gass smel in apartmant people faintng cant breth please hurry
bilding colapsd near river brij rubbl everywhere people trap send rescue now
These examples show the system handling ASR-like spelling mistakes and noisy emergency speech.
Displays:
- product name
- system status
- navigation-style modules
Allows user to:
- paste emergency call transcript
- select sample cases
- submit transcript to backend
Displays:
- priority level
- incident type
- location
- dispatch status
Shows assigned units:
- resource ID
- resource type
- ETA
Displays:
- triage reasoning
- recommended actions
Shows the complete backend response for technical evaluation.
The frontend calls:
POST /api/emergency-calls/processFull URL:
http://127.0.0.1:8000/api/emergency-calls/process
Request:
{
"call_id": "CALL_UI_001",
"transcript": "aaaa please hurry smok and fire near green park metro people trapped inside"
}Backend must allow frontend origin.
For local hackathon development, backend currently allows broad CORS access.
Production should restrict origins to the deployed frontend domain.
npm run buildPreview production build:
npm run previewThis frontend demonstrates the product in an operator-friendly way:
- Paste or select noisy emergency transcript
- Backend repairs and understands the transcript
- Incident is extracted into structured JSON
- Triage engine assigns priority
- Dispatch engine assigns emergency units
- Operator sees actions and ETA immediately
- No login/authentication
- No persistent incident history
- No real-time WebSocket updates yet
- No map visualization yet
- No role-based operator dashboard yet
- Live incident feed
- Map-based dispatch visualization
- Resource availability dashboard
- Incident history table
- Duplicate incident clustering UI
- Audio upload and transcription
- Operator notes and manual override controls
AI-assisted emergency call processing backend for a Smart City Dynamic Dispatch Grid.
This backend converts noisy emergency call transcripts into structured incident data, performs intelligent triage, and assigns emergency resources for dispatch.
The backend pipeline handles realistic, messy ASR-style emergency transcripts such as:
aaaa please hurry smok and fire near green park metro people trapped inside
and converts them into a structured response containing:
- corrected transcript understanding
- extracted incident details
- location hints
- severity classification
- casualty signals
- required emergency resources
- model-style triage score
- dispatch assignment with ETA
Raw Transcript
→ Transcript Correction
→ spaCy NLP Enrichment
→ Hybrid Parser
→ Structured Extraction JSON
→ Risk-Based Triage
→ Resource Dispatch
→ API Response
- Noisy transcript correction for ASR-style mistakes
- spaCy-based NLP enrichment using
en_core_web_sm - Hybrid extraction pipeline combining NLP signals and deterministic parsing
- Structured JSON output using Pydantic DTOs
- Model-style risk scoring for triage priority
- Safety override layer for life-threatening conditions
- Mock emergency resource registry
- Dispatch assignment with ETA
- FastAPI endpoint for frontend integration
- Unit and integration tests, including noisy transcript regression tests
- Python
- FastAPI
- spaCy
- Pydantic
- Pytest
- Uvicorn
backend/
├── src/
│ ├── application/
│ │ ├── dto/
│ │ ├── interfaces/
│ │ └── use_cases/
│ ├── core/
│ │ └── utils/
│ ├── domain/
│ │ ├── entities/
│ │ ├── enums/
│ │ └── services/
│ ├── infrastructure/
│ │ ├── dispatch/
│ │ └── nlp/
│ └── presentation/
│ ├── api/
│ └── cli/
├── tests/
│ ├── unit/
│ └── integration/
├── package.json
├── requirements.txt
└── README.md
src/core/utils/transcript_correction.py
Repairs noisy ASR-style input.
Examples:
smok → smoke
gass smel → gas smell
hospitl → hospital
injrd → injured
colapsd → collapsed
src/infrastructure/nlp/spacy_transcript_enricher.py
Uses spaCy en_core_web_sm and domain-specific entity patterns to identify:
- incident clues
- severity clues
- location hints
- hazard signals
- casualty clues
- urgency clues
src/infrastructure/nlp/hybrid_parser.py
Combines transcript repair, spaCy enrichment, and deterministic parsing to produce structured incident data.
src/domain/services/triage_service.py
Combines:
- risk scoring
- incident severity
- hazards
- casualty signals
- safety overrides
to assign a priority level:
P1 = Critical
P2 = High
P3 = Medium
P4 = Low / Needs clarification
src/domain/services/dispatch_service.py
Assigns available emergency resources:
- ambulance
- fire truck
- police unit
- rescue team
and returns ETA values.
From the backend directory:
cd backendInstall Python dependencies:
pip install -r requirements.txtInstall the spaCy English model:
python -m spacy download en_core_web_smnpm run dev:apiThe API will run at:
http://127.0.0.1:8000
Health check:
http://127.0.0.1:8000/health
API docs:
http://127.0.0.1:8000/docs
POST /api/emergency-calls/processRequest:
{
"call_id": "CALL_001",
"transcript": "aaaa please hurry smok and fire near green park metro people trapped inside"
}Response shape:
{
"extraction": {
"call_id": "CALL_001",
"incident": {},
"location": {},
"casualties": {},
"hazards": [],
"resources_needed": {},
"extraction_metadata": {},
"deduplication": {}
},
"triage": {
"priority_level": "P1",
"priority_score": 92,
"risk_probability": 0.91,
"escalation_required": true,
"triage_reason": "...",
"recommended_actions": []
},
"dispatch": {
"dispatch_status": "fully_assigned",
"assigned_resources": [],
"unfulfilled_resources": [],
"dispatch_summary": "..."
}
}npm run demo:fullThis runs the full backend pipeline from transcript to extraction, triage, and dispatch.
Run all tests:
npm run test:allRun noisy ASR transcript regression suite:
npm run test:noisyExpected current result:
66 passed
aaaa please hurry smok and fire near green park metro people trapped inside
bus and kar hit badli near sity hospital rood blockd two injrd please send amblance
gass smel in apartmant people faintng cant breth please hurry
bilding colapsd near river brij rubbl everywhere people trap send rescue now
This backend demonstrates an end-to-end AI-assisted civic emergency response system:
- Accepts noisy emergency transcripts
- Repairs ASR-like errors
- Uses spaCy NLP for transcript enrichment
- Extracts structured incident data
- Scores risk and triage priority
- Applies safety overrides
- Dispatches available emergency resources
- Returns complete operational JSON for frontend display
- Dispatch uses mock resources, not live city inventory
- ETA is based on mock location mapping
- No database persistence yet
- No real audio transcription module yet
- No duplicate incident clustering yet
- Add Whisper for audio-to-text transcription
- Add database for incident history
- Add duplicate detection across multiple calls
- Add graph-based routing for ETA
- Add live resource availability
- Add admin dashboard for command center operators
- Add multilingual transcript support
- Yashi Agrawal
- Isha Tomar
- Pratyush Chouksey
- Kavya Katal