Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crime-stats-uk

A criminological analysis of street-level crime data for any location in England, Wales, or Northern Ireland, using open data from data.police.uk.

The project examines three questions:

  1. Trends — How has recorded crime changed over time, and which categories are driving that change?
  2. Outcomes — What actually happens after a crime is recorded? How does the clear-up rate vary by offence type?
  3. Deprivation — Is there a relationship between neighbourhood deprivation and crime rates?

The analysis is accompanied by criminological commentary on what the data does and doesn't tell us — including the dark figure of unreported crime, the limitations of clear-up rates as a measure of police effectiveness, and the difference between correlation and causation in deprivation research.


Background

This project sits at the intersection of a 35-year IT career and a degree in Sociology & Criminology. The technical work is straightforward; the interesting questions are methodological. Crime statistics are routinely misused in public and political debate — this notebook tries to model what careful interpretation looks like.


Data sources

Source Description Licence
data.police.uk Street-level crime and outcomes, England/Wales/NI Open Government Licence
postcodes.io Postcode geocoding and reverse geocoding MIT
English Indices of Deprivation 2019 LSOA-level deprivation scores, MHCLG Open Government Licence

No API keys are required for any data source.


Project structure

crime-stats-uk/
├── notebooks/
│   ├── 01_exploration.ipynb    # scratch notebook for understanding the raw API data
│   └── crime_analysis.ipynb    # main analysis — start here
├── src/
│   └── crime_stats/
│       ├── __init__.py
│       └── api.py              # data.police.uk and postcodes.io client
├── data/
│   └── imd/                    # place IMD CSV here (see setup below)
├── requirements.txt
└── README.md

Setup

1. Clone the repo and install dependencies

git clone https://github.com/yourusername/crime-stats-uk.git
cd crime-stats-uk
pip install -r requirements.txt

2. Download the deprivation data

The deprivation analysis (Part 3) requires a local copy of the IMD data:

  1. Go to English Indices of Deprivation 2019
  2. Download File 7 — "all ranks, deciles and scores for the indices of deprivation, and population denominators"
  3. Open the Excel file and go to the 'IoD2019 Scores' sheet
  4. Save that sheet as data/imd/imd2019_lsoa.csv

Parts 1 and 2 work without this file — the notebook will skip Part 3 gracefully if it's missing.

3. Open the notebook

jupyter lab

Open notebooks/crime_analysis.ipynb, set your postcode in the Configuration cell, and run top to bottom.


Configuration

The only thing you need to change is the postcode in the Configuration cell:

POSTCODE = "L1 2TR"  # any UK postcode

The notebook will automatically detect the police force, check whether outcomes data is available for that force, and select an appropriate date range. The API covers England, Wales, and Northern Ireland — Scotland is not included (only British Transport Police data is available there).


A note on the Metropolitan Police

The Met covers roughly 20% of all recorded crime in England and Wales. Outcomes data for the Met is available in this API but has a longer publication lag than most forces — typically 6 or more months. The notebook accounts for this by using a date window that ends 6 months before the latest available data. There may also be other forces that are lagging behind - I didn't test all of them.


Known limitations

  • Recorded crime only — this analysis cannot capture unreported or unrecorded crime (the 'dark figure')
  • Location data is approximate — the API snaps crime locations to the nearest road junction within a 100-metre grid, for victim privacy reasons
  • IMD data is from 2019 — deprivation scores have not been updated since; local conditions may have changed
  • API rate limiting — data.police.uk enforces rate limits; the client uses a 2-second delay between requests

Requirements

  • Python 3.10+
  • See requirements.txt for package dependencies

About

Investigating UK crime stats

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages