Neighbourhoods

class police_api.neighbourhoods.Neighbourhood(api, preload=False, **attrs)

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
>>> from police_api.forces import Force
>>> from police_api.neighbourhoods import Neighbourhood
>>> api = PoliceAPI()
>>> force = Force(api, id='leicestershire')
>>> neighbourhood = Neighbourhood(api, force=force, id='C04')
>>> 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.

>>> neighbourhood.centre
{"latitude": "52.6268", "longitude": "-1.12621"}
Type:list

A list of links relevant to this force.

>>> pprint(neighbourhood.links)
[{u'description': None,
  u'title': u'Leicester City Council',
  u'url': u'http://www.leicester.gov.uk/'},
 {u'description': None,
  u'title': u'Beaumont Leys LPU',
  u'url': u'http://leicspolice.wordpress.com/category/lpu-blogs/beaumont-leys/'}]
locations
Type:list

A list of police stations in this NPT.

>>> pprint(neighbourhood.locations)
[{u'address': u'2 Beaumont Way\n, Leicester',
  u'description': None,
  u'latitude': None,
  u'longitude': None,
  u'name': u'Beaumont Leys',
  u'postcode': u'LE4 1DS',
  u'type': u'station'}]
contact_details
Type:dict

Ways that this NPT can be contacted.

>>> pprint(neighbourhood.contact_details)
{u'email': u'beaumont.lpu@leicestershire.pnn.police.uk',
 u'facebook': u'http://www.facebook.com/leicestercitypolice',
 u'telephone': u'101',
 u'twitter': u'http://www.twitter.com/LPAbbey'}
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.

>>> pprint(neighbourhood.boundary)
[(52.6235790036, -1.1433951806),
 (52.6235759765, -1.1432002292),
 ...
 (52.6241719477, -1.143313233),
 (52.6235790036, -1.1433951806)]