Neighbourhoods

class police_api.neighbourhoods.Neighbourhood(*args, **kwargs)[source]

A Neighbourhood Policing Team. Uses the neighbourhood API call.

Parameters:
  • api (PoliceAPI) – The instance of PoliceAPI to use.
  • preload (bool) – If True, attributes are loaded from the API on instantiation rather than waiting for a property to be accessed.
  • attrs – Only the force and id are required. Any other attributes supplied will be set on the instance and not fetched from the API.
>>> from police_api import PoliceAPI
>>> api = PoliceAPI()
>>> force = api.get_force('leicestershire')
>>> neighbourhood = force.get_neighbourhood('C04')
>>> print(neighbourhood.name)
City Centre neighbourhood
id
Type:str

The neighbourhood’s identifier (usually a code, but can contain spaces).

name
Type:str

The name of the NPT.

description
Type:str

A description of the NPT’s area.

url_force
Type:str

The URL for this NPT on the force’s website

population
Type:str

An estimate of the number of people living within the NPT boundary.

centre
Type:dict

The approximate centre point of the neighbourhood.

>>> print(neighbourhood.centre['latitude'])
52.6268
>>> print(neighbourhood.centre['longitude'])
-1.12621
Type:list

A list of links relevant to this force.

>>> link = neighbourhood.links[0]
>>> print(link['title'])
Leicester City Council
>>> print(link['url'])
http://www.leicester.gov.uk/
locations
Type:list

A list of police stations in this NPT.

>>> print(neighbourhood.locations[0]['address'])
74 Belgrave Gate
, Leicester
contact_details
Type:dict

Ways that this NPT can be contacted.

>>> print(neighbourhood.contact_details['email'])
centralleicester.npa@leicestershire.pnn.police.uk
>>> print(neighbourhood.contact_details['twitter'])
http://www.twitter.com/leicesterpolice
officers
Type:list

A list of Neighbourhood.Officer objects.

events
Type:list

A list of Neighbourhood.Event objects.

priorities
Type:list

A list of Neighbourhood.Priority objects.

boundary
Type:list

A list of (lat, lng) coordinates representing the perimeter of this neighbourhood’s boundary.

>>> neighbourhood.boundary[0]
(52.6235790036, -1.1433951806)
class Officer(api, data={})[source]

A police officer. Uses the neighbourhood-team API call.

Parameters:
  • api (PoliceAPI) – The instance of PoliceAPI to use.
  • data (dict) – The attributes that will be copied to this instance.
>>> from police_api import PoliceAPI
>>> api = PoliceAPI()
>>> force = api.get_force('surrey')
>>> neighbourhood = force.get_neighbourhood('ELCO')
>>> officer = neighbourhood.officers[0]
neighbourhood
Type:Neighbourhood

The Neighbourhood Policing Team that this officer is part of.

name
Type:str

The officer’s name.

rank
Type:str

The officer’s rank.

bio
Type:str

The officer’s biography.

contact_details
Type:list

A list of dict, containing methods of contacting the officer.

>>> print(officer.contact_details['email'])
elmbridge@surrey.pnn.police.uk
>>> print(officer.contact_details['telephone'])
101
class Neighbourhood.Event(api, data={})[source]

A neighbourhood event (e.g. a beat meating or surgery). Uses the neighbourhood-events API call.

Parameters:
  • api (PoliceAPI) – The instance of PoliceAPI to use.
  • data (dict) – The attributes that will be copied to this instance.
>>> from police_api import PoliceAPI
>>> api = PoliceAPI()
>>> force = api.get_force('leicestershire')
>>> neighbourhood = force.get_neighbourhood('C04')
>>> event = neighbourhood.events[0]
neighbourhood
Type:Neighbourhood

The Neighbourhood Policing Team that organised this event.

title
Type:str

The title of the event.

type
Type:str

The type of the event.

description
Type:str

A description of the event.

address
Type:str

The location of the event.

start_date
Type:datetime.datetime

The date and time that the event starts.

class Neighbourhood.Priority(api, data={})[source]

A neighbourhood priority (i.e. an issue raised by the community and a corresponding policing action to address this). Uses the neighbourhood-priorities API call.

Parameters:
  • api (PoliceAPI) – The instance of PoliceAPI to use.
  • data (dict) – The attributes that will be copied to this instance.
neighbourhood
Type:Neighbourhood

The Neighbourhood Policing Team that owns this priority.

issue
Type:str

The issue that was raised.

action
Type:str

The action that was taken to address the issue.

issue_date
Type:datetime.datetime

The date that the issue was raised.

action_date
Type:datetime.datetime

The date that the action was implemented.