-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
153 lines (122 loc) · 6.59 KB
/
index.html
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<title>Covid Risk Calculator</title>
</head>
<body class="bg-light" style="margin:auto">
<div class="container">
<div class="text-center">
<h2>Enter your local infection rate (per 100,000 people)</h2>
<h4> Current infection rates: </h4>
<h5> England: 537.9, Scotland: 249.4, Wales: 344.4, NI: 449.8 (as of 17th Jan) </h5>
<form class="card p-2" style="max-width: 200px; margin: auto;">
<div class="input-group">
<input id="rate" type="text" class="form-control">
<button onclick="return update()" class="btn btn-secondary">Go!</button>
</div>
</form>
</div><!-- text-center-->
</div><!-- container-->
<div id="results" class="container" style="max-width: 600px; margin: auto; display:none">
<div class="text-center">
<h3>The likelihood that at least one person in a group has covid is as follows:</h3>
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<h1 class="return"> In a group of 2 people: <span id="update-2">?</span>% chance</h1>
<h3> e.g., Meeting up with a friend </h3>
</div>
<div class="carousel-item">
<h1 class="return"> In a group of 10 people: <span id="update-10">?</span>% chance</h1>
<h3> e.g., Meeting up with a group of friends </h3>
</div>
<div class="carousel-item">
<h1 class="return"> In a group of 30 people: <span id="update-30">?</span>% chance</h1>
<h3> e.g., Playing team sports </h3>
</div>
<div class="carousel-item">
<h1 class="return"> In a group of 150 people: <span id="update-150">?</span>% chance</h1>
<h3> e.g., Going to primary school </h3>
</div>
<div class="carousel-item">
<h1 class="return"> In a group of 500 people: <span id="update-500">?</span>% chance</h1>
<h3> e.g., Going to the supermarket </h3>
</div>
<div class="carousel-item">
<h1 class="return"> In a group of 1000 people: <span id="update-1000">?</span>% chance</h1>
<h3> e.g., Going to secondary school </h3>
</div>
<div class="carousel-item">
<h1 class="return"> In a group of 10,000 people: <span id="update-10000">?</span>% chance</h1>
<h3> e.g., Going to a busy shopping centre </h3>
</div>
<div class="carousel-item">
<h1 class="return"> In a group of 25,000 people: <span id="update-25000">?</span>% chance</h1>
<h3> e.g., Going to a football match </h3>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div><!-- text-center-->
<div id="accordion">
<div class="card">
<div class="card-header" id="headingOne">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
About...
</button>
</div>
<div id="collapseOne" class="collapse" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<p>Data taken from <a href="https://coronavirus.data.gov.uk/details/cases"> UK government dashboard </a></p>
<p>Note 1. This assumes everyone with/without the virus is equally likely to meet, which is likely not the case (so probabilities may be lower)</p>
<p>Note 2. The ONS recently estimated as many as 1 in 50 people have the virus - equivalent to 2000 in 100,000 (so probabilities may be higher). </p>
<p>Note 3. Stay at home. Wear a mask. Get the vaccine.</p>
</div>
</div>
</div>
</div>
</div><!-- container-->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script>
function update(){
$('.carousel').carousel(0);
document.getElementById("results").style.display = "block";
var text = document.getElementById("rate").value;
document.getElementById("update-2").innerHTML = getRisk(text,2);
document.getElementById("update-10").innerHTML = getRisk(text,10);
document.getElementById("update-30").innerHTML = getRisk(text,30);
document.getElementById("update-150").innerHTML = getRisk(text,150);
document.getElementById("update-500").innerHTML = getRisk(text,500);
document.getElementById("update-1000").innerHTML = getRisk(text,1000);
document.getElementById("update-10000").innerHTML = getRisk(text,10000);
document.getElementById("update-25000").innerHTML = getRisk(text,25000);
return false;
}
function getRisk(rate,people){
var risk = ((1 - ((1 - (rate/100000))**people)) * 100).toFixed(2)
if(rate > 0)
{
if (risk == 0)
risk = "0.01"
else if (risk == 100)
risk = "99.99"
}
return risk
}
</script>
</body>
</html>