Crime

class police_api.crime.Crime(api, data={})[source]

An individual crime. Uses the outcomes-for-crime API call.

Parameters:
  • api (PoliceAPI) – The API instance to use.
  • data (dict) – The attributes that will be copied to this instance.
id
Type:int

This crime’s unique internal ID (not used elsewhere in the data or API).

persistent_id
Type:str

This crime’s persistent ID, which is referenced by the outcomes data and in the CSV files. Not guaranteed to be unique.

month
Type:str

The month that this crime was reported in (%m-%d).

category
Type:CrimeCategory

The category of this crime.

location
Type:Location

The anonymised location that this crime occurred closest to.

context
Type:str

Additional data about this crime provided by the reporting force.

outcome_status
Type:Crime.Outcome

The latest outcome to have been recorded for this crime.

outcomes
Type:list

A list of Outcome objects for this crime, in the order they occurred.

class Outcome(api, data={})[source]

An outcome for an individual crime.

Parameters:
  • api (PoliceAPI) – The API instance to use.
  • data (dict) – The attributes that will be copied to this instance.
crime
Type:Crime

The crime that this outcome refers to.

category
Type:OutcomeCategory

The category of this particular outcome.

date
Type:str

The month that this outcome was recorded in (%m-%d).

class police_api.crime.Location(*args, **kwargs)[source]

An anonymised location, to which crimes are “snapped”. Information about how location anonymisation works is published on the data.police.uk about page.

Parameters:
  • api (PoliceAPI) – The API instance to use.
  • data (dict) – The attributes that will be copied to this instance.
id
Type:int

This location’s unique ID.

name
Type:str

The name of this location (e.g. On or near Petrol Station)

latitude
Type:str

This location’s latitude.

longitude
Type:str

This location’s longitude.

type
Type:str

This location’s type (either 'BTP' or 'Force', indicating whether the location contains crimes snapped from the British Transport Police or all other forces).

is_btp()[source]
Return type:bool
Returns:True if this location’s type is 'BTP', and False otherwise.
class police_api.crime.CrimeCategory(api, data={})[source]

A crime category. Uses the crime-categories API call.

Parameters:
  • api (PoliceAPI) – The API instance to use.
  • data (dict) – The attributes that will be copied to this instance.
id
Type:str

A slug representing this crime category.

name
Type:str

The name of this crime category.

class police_api.crime.OutcomeCategory(api, data={})[source]

An outcome category.

Parameters:
  • api (PoliceAPI) – The API instance to use.
  • data (dict) – The attributes that will be copied to this instance.
id
Type:str

A slug representing this outcome category.

name
Type:str

The name of this outcome category.

class police_api.crime.NoLocationCrime(api, data={})[source]

A crime with no location. Retrieved via the crimes-no-location API call.