-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqueries.py
49 lines (42 loc) · 1.3 KB
/
queries.py
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
import os
import json
from bson import ObjectId
APP_ROOT = os.path.dirname(os.path.abspath(__file__)) # refers to application_top
APP_STATIC = os.path.join(APP_ROOT, 'config.json')
with open(APP_STATIC) as f:
config = json.load(f)
def set_query2_params(restaurant_id):
query2['_id'] = ObjectId(restaurant_id)
# get restaurant location from restaurant ID
query2 = {
'_id': ''
}
def set_query1_params(coord,lowerbound, upperbound, crime_type):
query1['location']['$near']['$geometry']['coordinates'] = coord
query1['CMPLNT_FR_TM']['$lte'] = upperbound
query1['CMPLNT_FR_TM']['$gte'] = lowerbound
query1['OFNS_DESC']['$in'] = crime_type
query1 = {
"location" :
{
"$near" :
{
"$geometry":
{
"type": "Point",
"coordinates": ""
},
"$minDistance": 0,
"$maxDistance": config["D"]
}
},
"CMPLNT_FR_TM":
{
"$lte": "",
"$gte": ""
},
"OFNS_DESC":
{
"$in": ""
}
}