Skip to content
abhineet-saha
Back

SafeRoute India

Routing scored on real accident data

Overview

A routing service that treats safety as a first-class routing metric. Given two points, it pulls candidate routes, scores each against historical accident data, and returns them ranked from 0–100 with a risk band.

Problem

Every consumer maps app optimises for time. On Indian roads that regularly means routing a driver through corridors with a documented accident history, because those corridors are fast. The accident data is public. Nothing was using it at routing time.

What I did

  • Built the service end to end: spatial data model, scoring algorithm, API and the map frontend.
  • Ingested and normalised government accident datasets into a queryable spatial schema.

Approach

  • PostGIS finds every recorded accident within 100 metres of a candidate route geometry.
  • Those incidents are weighted by severity (fatal, grievous, minor), recency, and time-of-day pattern — a late-night blackspot should not penalise a 9am commute equally.
  • Scored routes are cached in Redis, since the same corridors get requested constantly and the spatial query is the expensive part.
  • Hotspot clustering surfaces dangerous stretches directly on the map instead of hiding them inside a score.

Challenges

  • Government accident data arrives in inconsistent shapes across sources and needs normalising before any of it is spatially queryable.
  • A 100-metre radius search across a full route geometry is not cheap; the spatial indexes and the cache layer are what make it interactive rather than batch.