Skip to content

Latest commit

 

History

History
451 lines (356 loc) · 18.4 KB

File metadata and controls

451 lines (356 loc) · 18.4 KB

⚡ IADSES

Intelligent Accident Detection and Severity Estimation System

ASP.NET Core SQLite License: MIT Platform

A KDD-driven web-based intelligent system for automatic road accident detection, severity estimation, V2X emergency broadcast simulation, and accident-prone zone identification.

Based on research validated at Applus+ IDIADA Automotive Research Corporation, Spain


🚀 Quick Start📐 Architecture✨ Features📸 Screenshots🔌 API Reference🤝 Connect


📖 Abstract

Modern vehicles equipped with communication technologies present an opportunity for better emergency response to road accidents. IADSES implements a novel intelligent system that:

  • Automatically detects road accidents from vehicular sensor data
  • Estimates severity using a KDD (Knowledge Discovery in Databases) pipeline with weighted feature inference
  • Broadcasts alerts via simulated V2X (Vehicle-to-Everything) vehicular networks to emergency services
  • Identifies accident-prone zones using the Haversine formula for geographic clustering
  • Visualises incidents on interactive maps powered by OpenStreetMap/Leaflet.js

The system considers the most relevant variables characterising accident severity: vehicle speed, vehicle type, impact force, airbag deployment status, road type, and weather conditions — aligning directly with the research methodology validated at Applus+ IDIADA Automotive Research Corporation.


✨ Features

🧠 Intelligence & Detection

  • KDD 5-Stage Pipeline — Data Collection → Preprocessing → Feature Selection → Pattern Mining → Knowledge Output, visualised as an animated pipeline on every result
  • AI Weighted Inference Engine — Deterministic feature-weight scoring with animated confidence bars (Impact Force 35%, Speed 25%, Airbag 20%, Vehicle Type 10%, Weather 10%)
  • Severity Escalation — Weather + road type modifiers (Fog/Rain on Highway escalates severity one level; heavy vehicles escalate on high impact)
  • Accident-Prone Zone Detection — Haversine formula calculates real geographic distances; flags any 500m radius with 3+ accidents in 30 days

📡 V2X Emergency Broadcast

  • Animated broadcast to 6 receiver nodes: Ambulance, Fire Department, Police, Hospital, Nearby Vehicles, Traffic Control
  • Zone authority notification when location is flagged as accident-prone
  • Notification messages include vehicle plate, exact address, severity, and zone status

🗺️ Location & Mapping

  • GPS Auto-detection — Browser geolocation API with OpenStreetMap Nominatim reverse geocoding
  • Interactive Maps — Leaflet.js maps on Result and Dashboard pages
  • Accident Pins — Colour-coded by severity (Red=High, Orange=Medium, Green=Low)
  • Prone Zone Circles — 500m radius danger circles rendered on map
  • Mini Map Preview — Shows location before form submission

🎮 Simulation & Mock Data

  • Physics-Based Simulator — Three modes with realistic vehicle dynamics:
    • Normal Drive — Idle → Accelerate → Cruise → Brake cycle, 0.1–1.5 kN micro-impacts
    • Simulate Crash — 5 real accident scenarios (Highway Rear-End, City Intersection, Rural Rollover, Parking Lot, Highway Head-On) with impact decay using F × e^(-t×0.6)
    • Random Event — Weighted: 50% hard braking, 35% medium impact, 15% severe crash
  • Mock Scenario Button — Fills all fields A–Z instantly with 7 pre-loaded realistic Indian road accident scenarios (plate, coordinates, address, all sensor data)

🖥️ Premium UI

  • Dark cockpit / instrument cluster aesthetic
  • Orbitron + Rajdhani + Share Tech Mono typography
  • CSS scanline overlay, animated road lines, amber/red/cyan palette
  • Animated KDD pipeline, staggered V2X node notifications
  • Scrolling traffic safety quote ticker
  • Fully responsive

🛠️ Technology Stack

Layer Technology
Backend ASP.NET Core 10.0 (MVC + Web API hybrid)
Frontend Razor Views, Vanilla JS, CSS3 Animations
Database SQLite via Entity Framework Core 9.0
ORM Entity Framework Core (Code First, EnsureCreated)
Maps Leaflet.js + OpenStreetMap + Nominatim
Fonts Google Fonts (Orbitron, Rajdhani, Share Tech Mono)
Testing xUnit, Microsoft.Extensions.Logging.Abstractions
Language C# 13
Platform Windows / Linux / macOS (cross-platform)

📐 System Architecture

┌─────────────────────────────────────────────────────────────────┐
│                    PRESENTATION LAYER                           │
│         Razor Views (Index · Result · Dashboard)                │
│         Leaflet.js Maps · CSS Cockpit UI · iadses.js            │
└──────────────────────┬──────────────────────────────────────────┘
                       │ HTTP
┌──────────────────────▼──────────────────────────────────────────┐
│                   CONTROLLER LAYER                              │
│    AccidentController (MVC)    ApiController (REST /api/)       │
└──────────────────────┬──────────────────────────────────────────┘
                       │
┌──────────────────────▼──────────────────────────────────────────┐
│                 BUSINESS LOGIC LAYER                            │
│                                                                 │
│  ┌─────────────────────┐   ┌──────────────────────────────┐    │
│  │ AccidentDetection   │   │  SeverityEstimation          │    │
│  │ Service             │   │  Service                     │    │
│  │                     │   │                              │    │
│  │ IF ImpactForce > 50 │   │ High:  Force>80 OR Speed>100 │    │
│  │ OR Airbag == true   │   │ Medium: Force > 50           │    │
│  │ → ACCIDENT          │   │ Low:   Otherwise             │    │
│  │                     │   │ +Escalation: Weather/Road    │    │
│  └─────────────────────┘   └──────────────────────────────┘    │
│                                                                 │
│  ┌─────────────────────┐   ┌──────────────────────────────┐    │
│  │ NotificationService │   │  ZoneAnalysisService         │    │
│  │                     │   │                              │    │
│  │ Builds alert msg    │   │ Haversine formula            │    │
│  │ Saves to DB         │   │ 500m radius · 30-day window  │    │
│  │ Logs to console     │   │ 3+ accidents → Prone Zone    │    │
│  └─────────────────────┘   └──────────────────────────────┘    │
└──────────────────────┬──────────────────────────────────────────┘
                       │
┌──────────────────────▼──────────────────────────────────────────┐
│                   DATA ACCESS LAYER                             │
│              ApplicationDbContext (EF Core)                     │
│                   SQLite · AccidentRecord                       │
└─────────────────────────────────────────────────────────────────┘

KDD Pipeline

📡 Data Collection  →  🔧 Preprocessing  →  🎯 Feature Selection
     Raw sensor            Validate &            Speed, Force,
     streams               normalize             Airbag, Location

        →  🧠 Pattern Mining  →  📊 Knowledge Output
              Inference rules        Accident Detected
              + Zone analysis        Severity Level

Accident-Prone Zone Detection (Haversine)

For each new accident with coordinates (lat, lon):
  Query all accidents within last 30 days with coordinates
  For each historical accident h:
    d = 2R × arcsin(√(sin²(Δlat/2) + cos(lat)·cos(h.lat)·sin²(Δlon/2)))
  Count accidents where d ≤ 500m
  If count ≥ 3 → Flag as ACCIDENT-PRONE ZONE

📁 Project Structure

IADSES/
│
├── AccidentSystem/                     # Main ASP.NET Core project
│   ├── Controllers/
│   │   ├── AccidentController.cs       # MVC controller (UI routes)
│   │   └── ApiController.cs            # REST API controller
│   │
│   ├── Models/
│   │   ├── AccidentData.cs             # Input DTO (form + API)
│   │   └── AccidentRecord.cs           # Database entity
│   │
│   ├── Services/
│   │   ├── AccidentDetectionService.cs # Detect() — KDD rule engine
│   │   ├── SeverityEstimationService.cs# Predict() — weighted inference
│   │   ├── NotificationService.cs      # Notify() — alert + store
│   │   └── ZoneAnalysisService.cs      # Haversine prone-zone engine
│   │
│   ├── Data/
│   │   └── ApplicationDbContext.cs     # EF Core DbContext
│   │
│   ├── Views/
│   │   ├── Accident/
│   │   │   ├── Index.cshtml            # Cockpit input form
│   │   │   ├── Result.cshtml           # Analysis result + KDD + V2X + Map
│   │   │   └── Dashboard.cshtml        # Mission Control + incident map
│   │   └── Shared/
│   │       └── _Layout.cshtml          # Shared layout + nav
│   │
│   ├── wwwroot/
│   │   ├── css/site.css               # Cockpit dark theme design system
│   │   └── js/iadses.js               # Simulator + mock data + GPS
│   │
│   ├── Program.cs                      # App entry point + DI + auto DB
│   ├── appsettings.json
│   └── AccidentSystem.csproj
│
├── AccidentSystem.Tests/               # xUnit unit tests
│   ├── AccidentDetectionServiceTests.cs  # 8 detection tests
│   └── SeverityEstimationServiceTests.cs # 9 severity tests
│
├── AccidentSystem.sln
├── SETUP_AND_RUN.bat                   # Windows one-click launcher
├── README.md
└── LICENSE

🚀 Quick Start

Prerequisites

  • .NET 10 SDK — only requirement
  • No database installation needed (SQLite is built-in)
  • No Docker, no SQL Server, no environment variables

Windows

git clone https://github.com/samnaveenkumaroff/IADSES.git
cd IADSES\AccidentSystem
dotnet restore
dotnet run

Open http://localhost:5000

Or simply double-click SETUP_AND_RUN.bat

Linux / macOS

git clone https://github.com/samnaveenkumaroff/IADSES.git
cd IADSES/AccidentSystem
dotnet restore
dotnet run

Open http://localhost:5000

The SQLite database file AccidentSystem.db is created automatically in the build output directory on first run. No setup required.


🗄️ Database Schema

CREATE TABLE Accidents (
    Id                  INTEGER PRIMARY KEY AUTOINCREMENT,
    VehicleSpeed        REAL    NOT NULL,
    ImpactForce         REAL    NOT NULL,
    AirbagStatus        INTEGER NOT NULL,   -- boolean
    VehicleType         TEXT    NOT NULL,
    NumberPlate         TEXT,               -- e.g. TN29AB1234
    Severity            TEXT    NOT NULL,   -- High | Medium | Low | None
    IsAccident          INTEGER NOT NULL,   -- boolean
    IsInProneZone       INTEGER NOT NULL,   -- boolean
    Latitude            REAL,
    Longitude           REAL,
    Address             TEXT,
    RoadType            TEXT,               -- Highway | City Road | Rural | etc.
    WeatherCondition    TEXT,               -- Clear | Rain | Fog | Night | Snow
    Timestamp           TEXT    NOT NULL,   -- UTC datetime
    NotificationMessage TEXT
);

🔌 API Reference

POST /api/accident/process

Process accident data and return detection result.

Request Body:

{
  "vehicleSpeed": 94.5,
  "impactForce": 87.3,
  "airbagStatus": true,
  "vehicleType": "Car",
  "numberPlate": "TN29AB1234",
  "latitude": 12.9716,
  "longitude": 80.2137,
  "address": "NH-32, Near Tambaram Flyover, Chennai",
  "roadType": "Highway",
  "weatherCondition": "Clear"
}

Response:

{
  "recordId": 1,
  "accident": true,
  "severity": "High",
  "isProneZone": false,
  "plate": "TN29AB1234",
  "location": {
    "latitude": 12.9716,
    "longitude": 80.2137,
    "address": "NH-32, Near Tambaram Flyover, Chennai"
  },
  "timestamp": "2026-03-21T07:00:00Z",
  "message": "🔴 HIGH SEVERITY — Vehicle TN29AB1234 at NH-32..."
}

GET /api/accident/zones

Returns all accident-prone zone clusters.

[
  {
    "latitude": 12.9715,
    "longitude": 80.2135,
    "accidentCount": 4,
    "highSeverity": 2,
    "lastAccident": "2026-03-20T14:30:00Z",
    "address": "NH-32, Tambaram, Chennai"
  }
]

GET /api/accident/health

{ "status": "ok", "timestamp": "2026-03-21T07:00:00Z" }

🧪 Detection & Severity Rules

Accident Detection

ACCIDENT = TRUE  if:  ImpactForce > 50 kN
                 OR   AirbagStatus == true

Severity Classification

HIGH    if:  ImpactForce > 80 kN  OR  VehicleSpeed > 100 km/h
MEDIUM  if:  ImpactForce > 50 kN
LOW     if:  Accident detected but below thresholds

ESCALATE one level if:
  Weather ∈ {Fog, Rain}  AND  RoadType = Highway
  OR
  VehicleType ∈ {Truck, Bus}  AND  ImpactForce > 80 kN

AI Feature Weights

Impact Force   → 35% weight
Vehicle Speed  → 25% weight
Airbag Status  → 20% weight
Vehicle Type   → 10% weight
Weather        → 10% weight

🧪 Running Tests

cd AccidentSystem.Tests
dotnet test -v normal

17 unit tests covering:

  • Accident detection (8 tests) — no accident, impact threshold, airbag trigger, boundary conditions, null guard
  • Severity estimation (9 tests) — High/Medium/Low paths, boundary values, escalation, null guard

🌍 Mock Scenarios (Built-in)

The 🎭 LOAD MOCK SCENARIO button cycles through 7 pre-loaded real Indian road accident scenarios:

# Scenario Plate Location
1 Highway Rear-End Collision TN29AB1234 NH-32, Tambaram, Chennai
2 City Intersection T-Bone KA05MN5678 Silk Board Junction, Bengaluru
3 Foggy Highway Head-On MH12CD9988 Mumbai-Pune Expressway
4 Rural Road Pothole Skid AP09XY3344 SH-1, Shamshabad, Telangana
5 Night City Speeding DL3CAF7722 Ring Road, AIIMS, Delhi
6 Bridge Guardrail Impact GJ15EF4411 Sardar Bridge, Ahmedabad
7 Safe Normal Drive TN22GH8801 Anna Salai, Chennai

🔮 Future Extensibility

  • Replace rule-based engine with ML.NET trained model
  • Integrate real OBD-II / IoT sensor data streams
  • Add SMS/Email alerts via Twilio / SendGrid
  • Real GPS tracking with live vehicle movement
  • Mobile app companion (MAUI / React Native)
  • Export accident reports to PDF
  • Multi-language support (Tamil, Hindi)
  • Real V2X DSRC/C-V2X protocol integration

📚 Research Reference

This project implements the system described in:

"A Novel Intelligent System for Automatic Notification and Severity Estimation of Vehicles in Road Accidents" — A KDD-based approach validated at Applus+ IDIADA Automotive Research Corporation, Spain.

Key contributions implemented:

  • KDD-based accident detection from vehicular sensor features
  • Feature-based severity inference (Speed, Impact, Airbag, Vehicle Type)
  • V2X vehicular network notification architecture
  • Accident-prone zone identification from historical data

📄 License

This project is licensed under the MIT License — see LICENSE for details.


🤝 Connect With Me

Sam Naveenkumar V

Email LinkedIn GitHub Medium Portfolio


⚡ Built with ASP.NET Core · SQLite · Leaflet.js · OpenStreetMap

Every millisecond saved in accident detection can save a life.