23
23
from servers import worldbank
24
24
from servers import geocoding
25
25
from servers import foodstandartsagency
26
+ from servers import police
26
27
27
28
# Flask-Cache (configured to use App Engine Memcache API)
28
29
cache = Cache (app )
42
43
'worldbank' : 1 ,
43
44
'geocoding' : 2 ,
44
45
'foodstandartsagency' : 3
46
+ 'police' : 4
45
47
}
46
48
47
49
@external_api .route ('/api/' + str (servers ['worldbank' ])+ '/<dataType>/<date>/<format>' )
@@ -65,13 +67,36 @@ def getFoodStandartsAgencyData(name, location, format):
65
67
result = foodstandartsagency .getData (name , location , format )
66
68
return jsonify (result )
67
69
70
+ #Gets the crime categories from the police api
71
+ @external_api .route ('/api/' + str (servers ['police' ]))
72
+ def getCrimeCategories ():
73
+ result = police .getCategories ()
74
+ return jsonify (result )
68
75
76
+ # Gets the neighbourhoods in a county from the police api
77
+ @external_api .route ('/api/' + str (servers ['police' ])+ '/<county>' )
78
+ def getNeighbourhoods (county ):
79
+ result = police .getNeighbourhoods (county )
80
+ return jsonify (result )
69
81
82
+ # Gets the boundary coordinates for a neighbourhood in a county
83
+ @external_api .route ('/api/' + str (servers ['police' ])+ '/<county>/<nhood>' )
84
+ def getBoundary (county , nhood ):
85
+ result = police .getBoundary (county , nhood )
86
+ return jsonify (result )
70
87
88
+ # Gets the crimes done in this location during that month from the police api
89
+ # The date must be a string in the format 'yyyy-mm'
90
+ @external_api .route ('/api/' + str (servers ['police' ])+ '/<category>/<lat>/<lng>/<date>' )
91
+ def getCrimes (category , lat , lng , date ):
92
+ result = police .getCrimes (category , lat , lng , date ):
93
+ return jsonify (result )
71
94
72
-
73
-
74
-
75
-
95
+ # Gets the crimes done in this area during that month from the police api
96
+ # The date must be a string in the format 'yyyy-mm'
97
+ @external_api .route ('/api/' + str (servers ['police' ])+ '/<category>/<latArr>/<lngArr>/<date>' )
98
+ def getCrimes (category , latArr , lngArr , date ):
99
+ result = police .getCrimes (category , latArr , lngArr , date ):
100
+ return jsonify (result )
76
101
77
102
0 commit comments