-
Notifications
You must be signed in to change notification settings - Fork 0
/
CrimeWatch notes.txt
54 lines (41 loc) · 1.6 KB
/
CrimeWatch notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
====Basics====
The app does a check every xx minutes which the user can decide, i.e. they can do battery-saving mode or frequent
Sensible frequencies might be between every fifteen minutes to every hour or simply on demand when the check the app.
The app does the following steps:
Send a GET request to:
https://data.police.uk/api/crimes-street/all-crime?lat=LATITUDE&lng=LONGTITUDE&date=DATE
We then receive back a response from the server in the form of JSON (actually an array of objects). More info: https://data.police.uk/docs/method/crime-street/
Count the number of crimes in the area that are related to crimes against a person such as violent crime, theft and so on.
We can use up to 6 months worth of data to get an accurate picture over time, but this might be a lot for the pebble to handle; 3 months might be easier for the watch to handle and be faster.
If the number is high (tbd, could be per capita or relative to size) then alert the user.
------------------------
====Parsing the JSON====
Useful links:
- https://api.jquery.com/jquery.parsejson/
- http://www.w3schools.com/json/
Pseudocode:
crime_count = 0
FOREACH json_object IN list of json_objects DO:
obj = JSON.parse(json_object)
IF obj.category == violent crime (or other relevant crime) THEN:
INCREMENT crime_count by 1
END IF
END FOREACH
RETURN crime_count
--------------------------
====List of categories====
All crime
Anti-social behaviour
Bicycle theft
Burglary
Criminal damage and arson
Drugs
Other theft
Possession of weapons
Public order
Robbery
Shoplifting
Theft from the person
Vehicle crime
Violence and sexual offences
Other crime