-
Notifications
You must be signed in to change notification settings - Fork 0
/
filterCenters.py
60 lines (56 loc) · 2.71 KB
/
filterCenters.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
50
51
52
53
54
55
56
57
58
59
60
def getAgeBasedCentersPaid(response,age):
response=response.json()
listofCenters=[]
centers=response["centers"]
dateCenterdict={}
for center in centers:
if center["fee_type"]=="Paid":
for session in center["sessions"]:
if session["min_age_limit"]==age and session["available_capacity"]!=0:
if session["date"] in dateCenterdict:
dateCenterdict[session["date"]].append([center["name"],session["vaccine"],session["available_capacity"]])
else:
dateCenterdict[session["date"]]=[[center["name"],session["vaccine"],session["available_capacity"]]]
return(dateCenterdict)
def getAllCentersPaid(response,age):
response=response.json()
listofCenters=[]
centers=response["centers"]
dateCenterdict={}
for center in centers:
if center["fee_type"]=="Paid":
for session in center["sessions"]:
if session["available_capacity"]!=0:
if session["date"] in dateCenterdict:
dateCenterdict[session["date"]].append([center["name"],session["vaccine"],session["available_capacity"]])
else:
dateCenterdict[session["date"]]=[[center["name"],session["vaccine"],session["available_capacity"]]]
return(dateCenterdict)
def getAllCentersUnpaid(response,age):
response=response.json()
listofCenters=[]
centers=response["centers"]
dateCenterdict={}
for center in centers:
if center["fee_type"]=="Free":
for session in center["sessions"]:
if session["available_capacity"]!=0:
if session["date"] in dateCenterdict:
dateCenterdict[session["date"]].append([center["name"],session["vaccine"],session["available_capacity"]])
else:
dateCenterdict[session["date"]]=[[center["name"],session["vaccine"],session["available_capacity"]]]
return(dateCenterdict)
def getAgeBasedCentersUnpaid(response,age):
response=response.json()
listofCenters=[]
centers=response["centers"]
dateCenterdict={}
for center in centers:
if center["fee_type"]=="Free":
for session in center["sessions"]:
if session["min_age_limit"]==age and session["available_capacity"]!=0:
if session["date"] in dateCenterdict:
dateCenterdict[session["date"]].append([center["name"],session["vaccine"],session["available_capacity"]])
else:
dateCenterdict[session["date"]]=[[center["name"],session["vaccine"],session["available_capacity"]]]
return(dateCenterdict)