-
Notifications
You must be signed in to change notification settings - Fork 9
/
original.html
331 lines (306 loc) · 16 KB
/
original.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<!doctype html>
<html lang="en">
<head>
<!--<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">-->
<link rel="stylesheet" href="https://bootswatch.com/4/cyborg/bootstrap.min.css" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" type="image/x-icon" href="/arewedeadyet/favicon.ico">
<title>Are we dead yet?</title>
<style>
canvas {
height: 30em;
max-height: 30em;
}
</style>
</head>
<body class="container">
<div class="jumbotron">
<p class="lead">
I am quite frustrated with corona graphs in the news, since most reporters seem to have skipped math classes
back
then.
For instance, just plotting the number of confirmed infections at the respective dates does not tell you
anything
due to the different time point of outbreak. So lets fix that first.
</p>
<hr>
<p>The following charts are based on live data from <a
href="https://github.com/pomber/covid19">https://github.com/pomber/covid19</a>, which in turn sources <a
href="https://coronavirus.jhu.edu/map.html">jhu.edu</a>.
</p>
</div>
<div class="alert alert-danger" role="alert">
⚠ Johns Hopkins Has Ceased Live COVID-19 Data Reporting as of March 10, 2023
</div>
<div class="alert alert-info" role="alert">
<a href="monitor.html">You can find a reduced number of plots, aligned by the current date here.</a>
</div>
<div class="card">
<div class="card-header">
Countries to compare
</div>
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action" href="?countries=Italy; Germany; France; Spain">
Italy; Germany; France; Spain
</a>
<a class="list-group-item list-group-item-action" href="?countries=Korea, South; Israel; Austria; Sweden">
Korea, South; Israel; Austria; Sweden
</a>
<a class="list-group-item list-group-item-action" href="?countries=India; EU; US; Brazil">
India; EU; US; Brazil
</a>
</div>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Custom</span>
</div>
<input type="text" id="countries" value="Italy; Germany; France; Spain" class="form-control" onkeyup="show_autocomplete()">
<div class="input-group-append dropleft">
<input type="button" value="Apply" onclick="refresh()" class="btn btn-primary">
<div class="dropdown-menu" id="autocomplete"></div>
</div>
</div>
</div>
<div class="card mt-3">
<div class="card-header">
Contents
</div>
<ul class="nav nav-fill nav-pills card-body">
<li class="nav-item">
<a class="nav-link" href="#confirmed">Confirmed</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#rate">Infection Rate</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#tdoubling">Doubling Time</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#r0">Effective reproduction R</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#incidence">7-Day incidence</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#fatality">Case Fatality</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#dead-per-million">Mortality</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#recovery">Active infections</a>
</li>
</ul>
</div>
<div class="card mt-3">
<div class="card-body">
<a href="#confirmed">#</a>
<canvas id="confirmed"></canvas>
<p class="card-text">
This is still pretty useless as the countries differ in total population and population density, lets
turn to
something
actually comparable.</p>
<div class="alert alert-primary" role="alert">Here, confirmed refers to a case being <b>reported</b> in contrast
to a
case
being <b>infected</b>.
Therefore, fluctuations are introduced by working days (e.g. less tests performed on weekends &
holidays).
</div>
</div>
</div>
<div class="card mt-3">
<div class="card-header">
Spreading rate measures
</div>
<div class="card-body">
<a href="#rate">#</a>
<canvas id="rate"></canvas>
<p class="card-text">
The values are smoothed using a moving
average
over
seven days.
This numbers actually allow comparing how well the different countries are doing in their corona
countermeasurements, regardless of the population size.</p>
<div class="alert alert-primary" role="alert">An infection rate of 1.0 means no new infections.
</div>
However, after the initial outbreak a significant part of populatian has been infected and any new outbreaks are dimished in this metric.
<hr>
<a href="#tdoubling">#</a> The same data can be visualized more intuitively as the <em>doubling time</em>,
i.e. the time it takes for the confirmed count to double. It is given below for reference.
<canvas id="tdoubling"></canvas>
<p class="card-text">
However, this representation is less numerically stable as it diverges to infinity as the infection rate
approaches to 1.0.
</p>
<hr>
<a href="#r0">#</a> Yet another way to represent the same data is the <a
href="https://en.wikipedia.org/wiki/Basic_reproduction_number#Notes">effective reproduction number R</a>.
<canvas id="r0"></canvas>
<p class="card-text">
Actually, it is very similar what we defined as the infection rate above. However, instead of comparing the
the absolute number of <em>confirmed</em> from day to day, the change in <em>confirmed</em> over a period of time is
used.
Therefore, R becomes 0.0 if there are no new infections.
</p>
<div class="alert alert-primary" role="alert">
The number R determines which proportion of the population must be vaccinated to stop the disease.
Generally speaking: the higher R, the higher the proportion.
</div>
<div class="alert alert-primary" role="alert">
<a href="https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology">There is a variety of models to
estimate R.</a>
I went with a rather naive approach (see code), so the actual numbers may vary from official reports.
</div>
<hr>
<a href="#incidence">#</a> Yet another way to represent the same data is the 7-Day incidence.
<canvas id="incidence"></canvas>
<p class="card-text">
This measures the number of infected per 100.000 over the last 7-Days. This too, measures the effective reproduction
of the virus. But the different unit makes this more understandable I guess.
</p>
<div class="alert alert-primary" role="alert">
The population count to compute the incidence is based on <a
href="https://github.com/paroj/arewedeadyet/blob/master/population_from_wikipedia.js">data from
wikipedia</a>
</div>
</div>
</div>
<div class="card mt-3">
<div class="card-body">
<a href="#fatality">#</a>
However, <em>confirmed</em> does not mean the same between different countries and even in the same country
at
different time points of the epidemic. This is due to the sampling bias induced by the limited amount of
corona test kits.
In the early days of the epidemic there are enough kits to test everyone, so many cases that do not yet show
symptoms are tested.
With ongoing spread, we hit limits on test-kit and health-system capacities and the focus shifts to testing
severe cases only. This in turn pushes the fatality rate.
<canvas id="fatality"></canvas>
<p class="card-text">A significant increase of the fatality rate indicates that</p>
<ol>
<li>the confirmed count is being under-estimated.</li>
<li>the health-system capacites being exhausted.</li>
</ol>
<p>Conversely, a decrase of the fatality rate indicates that</p>
<ol>
<li>the confirmed count was previously under-estimated. (e.g. by the exhaustion of the health system and focusing on severe cases)</li>
</ol>
<div class="alert alert-primary" role="alert">
We are only talking about an <em>estimate</em> of fatality rate here, as we cannot measure the true
fatality
rate while the epidemic is ongoing. For us the relative rate between countries is sufficient. Therefore
we simpliy chose the optimisitic deaths by confirmed ratio here.
</div>
</div>
</div>
<div class="card mt-3">
<div class="card-body">
<a href="#dead-per-million">#</a>
In contrast to the fatality rate, the mortality rate below is shown in dead per million inhabitants.
This makes it independant of whether the confirmed count is estimated correctly. In most cases both will be
correlated.
<canvas id="dead-per-million"></canvas>
<p>
However, the mortality rate
is a better indicator of the influence of the pandepic on a countries society and economy - especially
when the health-system is exhausted.
</p>
<div class="alert alert-primary" role="alert">
The population count to compute the mortality is based on <a
href="https://github.com/paroj/arewedeadyet/blob/master/population_from_wikipedia.js">data from
wikipedia</a>
</div>
</div>
</div>
<div class="card mt-3">
<div class="card-body">
<a href="#recovery">#</a>
To close with something positive, lets look at the absolute number of infections. That is, cases which are
neither
recovered nor died yet and are potentially infectious.
If there are no such cases left, we can assume the epidemic to be stopped.
<canvas id="recovery"></canvas>
Notably, when this graph reaches zero you
<strong>can
not</strong> assume that the epidemic is stopped due to the stochastic nature of the data.
However, a rise of the graph after a decline can indicate that a second wave is coming.
</div>
</div>
<hr>
Source-code: <a href="https://github.com/paroj/arewedeadyet">https://github.com/paroj/arewedeadyet</a><br>
<a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License"
style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />This work is
licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International License</a>.
<script src="./population_from_wikipedia.js"></script>
<script src="./coronalib.js"></script>
<script>
"use strict"
function makeCharts(data, countries)
{
var cconfig = JSON.parse(JSON.stringify(config))
cconfig.data.datasets = getDatasets(data, getDays, countries, false)
cconfig.data.labels = labels
cconfig.options.scales.yAxes[0].ticks.userCallback = tickDecimalPoint
cconfig.options.tooltips.callbacks.label = tooltipDecimalPoint
makeChart("confirmed", cconfig)
cconfig = JSON.parse(JSON.stringify(config))
cconfig.options.title.text = 'Corona infection rate comparison'
cconfig.options.scales.yAxes[0].scaleLabel.labelString = "confirmed today/yesterday"
cconfig.options.scales.yAxes[0].ticks.min = 0.9
cconfig.data.datasets = getDatasets(data, getRate, countries, false)
cconfig.data.labels = labels
makeChart("rate", cconfig)
cconfig = JSON.parse(JSON.stringify(config))
cconfig.options.title.text = 'Corona infection doubling time comparison'
cconfig.options.scales.yAxes[0].scaleLabel.labelString = "days"
cconfig.options.scales.yAxes[0].ticks.min = 0.5
cconfig.options.scales.yAxes[0].ticks.max = 90
cconfig.options.tooltips.position = "nearest"
cconfig.data.datasets = getDatasets(data, getDoublingTime, countries, false)
cconfig.data.labels = labels
makeChart("tdoubling", cconfig)
cconfig = JSON.parse(JSON.stringify(config))
cconfig.options.title.text = 'Corona effective reproduction number'
cconfig.options.scales.yAxes[0].scaleLabel.labelString = "see getRe in code"
cconfig.options.scales.yAxes[0].ticks.min = 0.0
cconfig.options.scales.yAxes[0].ticks.max = 3
cconfig.data.datasets = getDatasets(data, getRe, countries, false)
cconfig.data.labels = labels
makeChart("r0", cconfig)
cconfig = JSON.parse(JSON.stringify(config))
cconfig.options.title.text = '7-Day incidence per 100.000'
cconfig.options.scales.yAxes[0].scaleLabel.labelString = "new infections"
cconfig.options.scales.yAxes[0].ticks.min = 0.0
cconfig.data.datasets = getDatasets(data, getIncidence, countries, false)
cconfig.data.labels = labels
makeChart("incidence", cconfig)
cconfig = JSON.parse(JSON.stringify(config))
cconfig.options.title.text = 'Corona fatality rate comparison'
cconfig.options.scales.yAxes[0].scaleLabel.labelString = "deaths/confirmed [%]"
cconfig.data.datasets = getDatasets(data, getFatalityRate, countries, false)
cconfig.data.labels = labels
makeChart("fatality", cconfig)
cconfig = JSON.parse(JSON.stringify(config))
cconfig.options.title.text = 'Mortality rate comparison'
cconfig.options.scales.yAxes[0].scaleLabel.labelString = "deaths per million"
cconfig.data.datasets = getDatasets(data, getDeadPerMillion, countries, false)
cconfig.data.labels = labels
makeChart("dead-per-million", cconfig)
cconfig = JSON.parse(JSON.stringify(config))
cconfig.options.title.text = 'Corona infected comparison'
cconfig.options.scales.yAxes[0].scaleLabel.labelString = "confirmed - recovered - dead"
cconfig.data.datasets = getDatasets(data, getInfected, countries, false)
cconfig.data.labels = labels
makeChart("recovery", cconfig)
}
refresh()
</script>
</body>
</html>