How it works

From open data to a glowing route home

Ingest

Each month a Node job pulls street-level crimes from the police.uk API while the walkable street network comes from OpenStreetMap.

Score

Every street segment gets a risk_score from nearby incidents, weighted by category severity_weight.

Route

Fastest, balanced and safest options are compared. The chosen route glows across the dark map.

Learn

DBSCAN with a haversine metric finds hotspots without needing a cluster count and ignores noise.

police.uk APIcrimes, monthly
OpenStreetMapstreets, lighting, pavements
Node ingestscheduled data refresh
PostgreSQL + PostGISGIST-indexed geometry
scikit-learnDBSCAN hotspots · later
FastAPIqueries, scoring, ML
Leafletmap, filters, planner

Tech stack

Each piece earns its place

A production-shaped stack with a geospatial core.

Data sources: police.uk API for crimes and OpenStreetMap for the street network and pedestrian features.

Data model

What the watch remembers

Everything lives in PostgreSQL with PostGIS, in SRID 4326. Hover or tap a table to trace its links.