-
Notifications
You must be signed in to change notification settings - Fork 0
/
categorize.py
99 lines (90 loc) · 4.49 KB
/
categorize.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
def categorize_density(density, population):
if (population >= 50000 and density >= 1500):
return 3, "high"
elif (population >= 5000 and density >= 300):
return 2, "moderate"
elif (density < 300):
return 1, "low"
else:
return 0, "none"
def categorize_age(medain_age):
if (medain_age > 30):
return 3, "high"
elif (medain_age >= 20 and medain_age <= 30):
return 2, "moderate"
elif (medain_age >= 1 and medain_age < 20):
return 1, "low"
else:
return 0, "none"
def claculate_effectivness(start_case, end_case, start_icu, end_icu):
if start_case == 0 and end_case !=0:
percentage_change_case = end_case /(start_case + end_case) *100
elif start_case ==0 and end_case == 0:
percentage_change_case = 0
else:
percentage_change_case = ((end_case - start_case) / start_case) * 100
if start_icu ==0 and end_icu != 0:
percentage_change_icu = end_icu / (start_icu + end_case) * 100
elif start_icu == 0 and end_icu == 0:
percentage_change_icu =0
else:
percentage_change_icu = ((end_icu - start_icu) / start_icu) * 100
average_perecentage = percentage_change_case + percentage_change_icu /2
if average_perecentage > 0:
return 1
else:
if abs(average_perecentage) > 70 or abs(average_perecentage) == 0:
return 3
elif abs(average_perecentage) > 50 and abs(average_perecentage) <=70:
return 2
else:
return 1
def lockdown_policy(level):
# Define the lockdown policy description based on the lockdown policy level
if level == 0:
lockdown_policy_description = "(no lockdown measures)"
elif level == 1:
lockdown_policy_description = "(recommend not leaving house)"
elif level == 2:
lockdown_policy_description = "(require not leaving house with exceptions for daily exercise, grocery shopping, and ‘essential’ trips)"
else:
lockdown_policy_description = "(require not leaving house with minimal exceptions (e.g., allowed to leave only once every few days, or only one person can leave at a time, etc.)not implementing any lockdown policy)"
return lockdown_policy_description, level
def mask_policy(level):
# Define the mask policy description based on the mask policy level
if level == 0:
mask_policy_description = "(not required to wear mask)"
elif level == 1:
mask_policy_description = "(recommended to wear mask)"
elif level == 2:
mask_policy_description = "(required mask in some specified shared/public spaces outside the home with other people present, or some situations when social distancing not possible)"
elif level == 3:
mask_policy_description = "(required mask in all shared/public spaces outside the home with other people present or all situations when social distancing not possible)"
else:
mask_policy_description = "(required mask outside the home at all times, regardless of location or presence of other people)"
return mask_policy_description
def vaccine_policy(level):
# Define the vaccine policy description based on the mask policy level
if level == 0:
vaccine_policy_description = "(vaccination not avilable)"
elif level == 1:
vaccine_policy_description = "(vaccination avilable for ONE of the following: key workers/ clinically vulnerable groups / elderly groups)"
elif level == 2:
vaccine_policy_description = "(vaccination avilable for TWO of the following: key workers/ clinically vulnerable groups / elderly groups)"
elif level == 3:
vaccine_policy_description = "(vaccination avilable for all the following: key workers/ clinically vulnerable groups / elderly groups)"
else:
vaccine_policy_description = "(vaccination avilable for all three, plus partial additional availability *select broad groups/ages*)"
return vaccine_policy_description
def lockdown_policy_evaluation(level,start_cases,populaton):
cases_percentage = (start_cases / populaton) * 100
print(cases_percentage)
if (0.32 > cases_percentage < 0.45) and (level == 2 or level == 1 or level == 0):
return 2
elif cases_percentage > 0.45 and (level == 2 or level == 1 or level == 0):
return 3
else:
return 0
# if 50% of popuaation is vac then no lockdown and cases
# lockdown level 2 : 50% vacc and more than 0.32 and less than 0.45 (based on city to population) cases start_Date
# level 3 : no vaccine less than 30 per and 2000 cases