index.html 22 KB
Newer Older
1
2
<html>
    <head>
3
        <meta charset="utf-8"/>
4
        <title>Scary COVID-19 Data</title>
Michał Woźniak's avatar
fix    
Michał Woźniak committed
5
        <script src="./wtf_wikipedia-client.min.js"></script>
Michał Woźniak's avatar
charts!    
Michał Woźniak committed
6
        <script src="./Chart.bundle.min.js"></script>
Michał Woźniak's avatar
fix    
Michał Woźniak committed
7
        <script src="./covid.js"></script>
Michał Woźniak's avatar
Michał Woźniak committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
        <style>
            @font-face {
                font-family: "Play Regular";
                src: url(./Play/Play-Regular.ttf);
            }
            @font-face {
                font-family: "Play Bold";
                src: url(./Play/Play-Bold.ttf);
            }
            body {
                background: #444;
                color: springgreen;
                font-family: "Play Regular";
                padding:0px;
                margin:0px;
                font-size: 16pt;
Michał Woźniak's avatar
Michał Woźniak committed
24
25
26
                display: flex;
                flex-direction: column;
                min-height:100vh;
Michał Woźniak's avatar
Michał Woźniak committed
27
28
29
30
31
32
33
34
35
36
            }
            body > * {
                padding-left:5vw;
                padding-right:5vw;
            }
            body > * > * {
                text-shadow: none;
            }
            h1 {
                text-align:center;
Michał Woźniak's avatar
Michał Woźniak committed
37
38
39
40
41
42
                padding-top:2em;
                padding-bottom:0.7em;
                font-family: "Play Regular";
                font-weight: normal;
                font-size: 260%;
                text-shadow:-1px -1px 1px black, 1px 1px 0px #888;
Michał Woźniak's avatar
Michał Woźniak committed
43
            }
Michał Woźniak's avatar
Michał Woźniak committed
44
            h2, h3, h4, h5, h6, h7, strong {
Michał Woźniak's avatar
Michał Woźniak committed
45
46
47
48
49
50
                font-family: "Play Bold";
            }
            a {
                color: yellow;
            }
            
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
            input[type=button] {
                display:inline-block;
                border:none;
                border-radius:0.2em;
                color:springgreen;
                font-family: "Play Bold";
                font-size: 100%;
                padding:0.4em 1em 0.5em 1em;
                background:#555;
                box-shadow:0px 0px 2px #555;
                font-variant: all-small-caps;
                transition: box-shadow 0.5s, color 0.5s, background-color 0.5s;
            }
            input[type=button]:hover {
                color:black;
                background:springgreen;
                box-shadow:0px 0px 2px springgreen;
            }
            input[type=button]:active {
                box-shadow:inset 0px 0px 2px #444;
            }
            
Michał Woźniak's avatar
Michał Woźniak committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
            #covid-stats {
                display: grid;
                grid-auto-flow: column;
                background: springgreen;
                color: #444;
            }
            #covid-stats > * {
                margin:0em;
                padding:0.5em;
                display: grid;
            }
            #covid-stats .value {
                font-weight: bold;
                font-family: "Play Bold";
Michał Woźniak's avatar
Michał Woźniak committed
87
                align-self: end;
Michał Woźniak's avatar
Michał Woźniak committed
88
            }
Michał Woźniak's avatar
Michał Woźniak committed
89
            #covid-stats h2 {
Michał Woźniak's avatar
Michał Woźniak committed
90
91
92
93
                font-size: 140%;
                font-family: "Play Regular";
                font-weight: bold;
                text-transform: uppercase;
Michał Woźniak's avatar
Michał Woźniak committed
94
                color: #444;
Michał Woźniak's avatar
Michał Woźniak committed
95
                opacity: 0.4;
96
97
98
99
100
101
102
                margin:0px;
            }
            #covid-stats .item-container {
                display: flex;
                justify-content: center;
                align-items: center;
            }
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
            #main-menu-container {
                padding-top:1em;
                overflow:hidden;
                transition:max-height 1s;
                font-size:80%;
            }
            #internal-main-menu-container {
                display:flex;
                flex-wrap:wrap;
                justify-content:center;
            }
            #internal-main-menu-container h2 {
                font-size: 100%;
                font-variant: all-small-caps;
                margin: 0.3em 0.2em;
                padding: 0.5em 1em 0.5em 0.2em;
            }
            #internal-main-menu-container input[type=button] {
                margin: 0.3em;
                flex-grow: 1;
                flex-shrink: 1;
                padding-left:2em;
                padding-right:2em;
126
            }
Michał Woźniak's avatar
Michał Woźniak committed
127
            .sources {
Michał Woźniak's avatar
Michał Woźniak committed
128
129
130
131
132
133
                font-size: 80%;
                font-style: italic;
                margin-top: 0.4em;
                text-align: right;
                opacity: 0.5;
            }
134
            .site-data {
Michał Woźniak's avatar
Michał Woźniak committed
135
                display: grid;
Michał Woźniak's avatar
Michał Woźniak committed
136
                grid-template-columns: auto auto auto;
Michał Woźniak's avatar
Michał Woźniak committed
137
138
                grid-template-rows: auto auto auto;
                grid-template-areas: 
Michał Woźniak's avatar
Michał Woźniak committed
139
140
141
                    "auto auto auto"
                    "auto auto auto"
                    "sources sources sources";
Michał Woźniak's avatar
Michał Woźniak committed
142
143
144
                grid-auto-flow: row;
                padding-top:1em;
                padding-bottom:1em;
Michał Woźniak's avatar
Michał Woźniak committed
145
            }
146
            .site-data > * {
Michał Woźniak's avatar
Michał Woźniak committed
147
                display: grid;
Michał Woźniak's avatar
Michał Woźniak committed
148
149
150
                margin:0px;
                padding:0.5em;
            }
151
            .site-data > h2 {
Michał Woźniak's avatar
Michał Woźniak committed
152
153
                grid-area: header;
            }
154
            .site-data > .sources {
Michał Woźniak's avatar
Michał Woźniak committed
155
                grid-area: sources;
Michał Woźniak's avatar
Michał Woźniak committed
156
            }
157
            .site-data > * .value {
Michał Woźniak's avatar
Michał Woźniak committed
158
159
160
                font-weight: bold;
                font-family: "Play Bold";
            }
161
            #sites-data-container {
Michał Woźniak's avatar
Michał Woźniak committed
162
                flex-grow:1;
163
164
                display: flex;
                flex-direction: row;
165
                align-items:stretch;
166
167
                justify-content: center;
                flex-wrap: wrap;
168
                min-height:8em;
169
170
            }
            #sites-data-container .site-data-container {
Michał Woźniak's avatar
Michał Woźniak committed
171
                display: flex;
Michał Woźniak's avatar
Michał Woźniak committed
172
                flex-direction: column;
173
174
                align-items:center;
                width:23em;
Michał Woźniak's avatar
Michał Woźniak committed
175
            }
Michał Woźniak's avatar
Michał Woźniak committed
176
177
178
179
180
181
182
183
            footer {
                font-size: 70%;
                text-align:center;
                opacity:0.8;
                line-height:150%;
                font-family: Monospace;
                background: black;
            }
184
            .site-data-container .sites-select {
Michał Woźniak's avatar
Michał Woźniak committed
185
186
187
188
189
190
191
192
193
194
                display: inline;
                -moz-appearance: none;
                -webkit-appearance: none;
                appearance: none;
                border:dotted 1px springgreen;
                padding:0.25em;
                background:none;
                color:springgreen;
                font-family: inherit;
                font-size:inherit;
195
                min-width:15em;
196
                transition: box-shadow 0.5s;
Michał Woźniak's avatar
Michał Woźniak committed
197
            }
198
199
200
            .site-data-container .sites-select:hover {
                box-shadow: 0px 0px 5px springgreen;
            }
201
            .site-data-container .sites-select option {
202
203
                font-size:70%;
            }
204
            .site-data-container h2 {
Michał Woźniak's avatar
Michał Woźniak committed
205
206
207
208
209
                font-family: "Play Regular";
                font-weight: normal;
                margin-top:0.35em;
            }
            .site-data-container h2.for-select {
Michał Woźniak's avatar
Michał Woźniak committed
210
                position:relative;
Michał Woźniak's avatar
Michał Woźniak committed
211
212
                font-size:140%;
                margin-top:0.85em;
Michał Woźniak's avatar
Michał Woźniak committed
213
            }
Michał Woźniak's avatar
Michał Woźniak committed
214
            .site-data-container h2.for-select::after {
Michał Woźniak's avatar
Michał Woźniak committed
215
216
217
218
219
220
                position:absolute;
                right:0.5em;
                top:0.25em;
                content: "▾";
                display: block;
                color: springgreen;
221
222
                z-index: -10; /* needed to not obscure the select box from clicks */
            }
223
            .sites-menu-container {
Michał Woźniak's avatar
Michał Woźniak committed
224
225
226
                width:1px;
                height:0px;
            }
227
228
229
            .sites-menu-container > input {
                display:none;
            }
230
            .sites-menu-container > a {
231
232
233
234
                font-size: 250%;
                text-decoration: none;
                border: dotted 1px springgreen;
                width: 1em;
235
                height: 0.97em;
236
237
238
                line-height: 90%;
                outline:none;
                text-align: Center;
239
                margin-top: 0.49em;
240
                color: springgreen;
241
                display: none;
242
                cursor: pointer;
243
                transition: box-shadow 0.5s;
244
245
246
            }
            .sites-menu-container > a:hover {
                box-shadow: 0px 0px 5px springgreen;
Michał Woźniak's avatar
Michał Woźniak committed
247
248
249
            }
            #add-site.visible {
                display: inline-block;
250
            }
251
            .site-data-container:nth-of-type(7) + .sites-menu-container > #add-site {
Michał Woźniak's avatar
Michał Woźniak committed
252
253
                display:none;
            }
254
            .site-data-container:nth-of-type(3) ~ .sites-menu-container > #remove-site {
255
256
                display:inline-block;
            }
257
            .sites-menu-container.left > a {
Michał Woźniak's avatar
Michał Woźniak committed
258
259
                display: inline-block;
                margin-left: -1em;
260
            }
Michał Woźniak's avatar
Michał Woźniak committed
261
            #the-chart-container {
262
263
                height:80vh;
                min-height:600px;
Michał Woźniak's avatar
Michał Woźniak committed
264
265
266
                background: #333;
                padding-top: 1em;
                padding-bottom: 1em;
Michał Woźniak's avatar
Michał Woźniak committed
267
            }
Michał Woźniak's avatar
charts!    
Michał Woźniak committed
268
            #the-chart {
Michał Woźniak's avatar
Michał Woźniak committed
269
                display:block;
Michał Woźniak's avatar
charts!    
Michał Woźniak committed
270
            }
271
272
273
            #disclaimers-container {
                font-size:80%;
            }
274
275
276
277
278
            .chart-config-container {
                margin-top:1em;
                display:flex;
                justify-content: center;
                font-size:80%;
279
                flex-wrap: wrap;
280
281
282
            }
            .chart-config-container input {
                display:none;
283
284
285
286
287
288
289
290
            }
            .chart-config-container label input {
                display:inline-block;
                background:none;
                border:none;
                font-weight: bold;
                color:springgreen;
            }
291
292
            .chart-config-container #chart-reset-settings {
                display:inline-block;
293
            }
294
            .chart-config-container label {
295
296
297
298
299
                padding: 0.5em;
                border-radius:0.2em;
                background:#404040;
                box-shadow: inset 0px 0px 2px #333;
            }
300
301
302
            /*
             * chart controls mechanics
             */
303
304
305
            .chart-config-container input#chart-data-confirmed:checked ~ .chart-config-group label[for=chart-data-confirmed],
            .chart-config-container input#chart-data-recovered:checked ~ .chart-config-group label[for=chart-data-recovered],
            .chart-config-container input#chart-data-deaths:checked ~ .chart-config-group label[for=chart-data-deaths],
Michał Woźniak's avatar
Michał Woźniak committed
306
            .chart-config-container input#chart-data-active:checked ~ .chart-config-group label[for=chart-data-active],
307
308
309
310
311
312
            .chart-config-container input#chart-type-logarithmic:checked ~ .chart-config-group label[for=chart-type-logarithmic],
            .chart-config-container input#chart-type-linear:checked ~ .chart-config-group label[for=chart-type-linear],
            .chart-config-container input#chart-cases-cumulative:checked ~ .chart-config-group label[for=chart-cases-cumulative],
            .chart-config-container input#chart-cases-new:checked ~ .chart-config-group label[for=chart-cases-new],
            .chart-config-container input#chart-values-absolute:checked ~ .chart-config-group label[for=chart-values-absolute],
            .chart-config-container input#chart-values-per-million:checked ~ .chart-config-group label[for=chart-values-per-million],
313
            .chart-config-container input#chart-start-date:checked ~ .chart-config-group label[for=chart-start-date],
314
315
316
317
            .chart-config-container input#chart-start-first:checked ~ .chart-config-group label[for=chart-start-first],
            .chart-config-container input#chart-start-tenth:checked ~ .chart-config-group label[for=chart-start-tenth],
            .chart-config-container input#chart-start-hundredth:checked ~ .chart-config-group label[for=chart-start-hundredth],
            .chart-config-container input#chart-start-thousandth:checked ~ .chart-config-group label[for=chart-start-thousandth] {
318
319
320
321
                background:springgreen;
                color:black;
                box-shadow: 0px 0px 2px springgreen;
            }
322
323
324
            .chart-config-container input#chart-start-date:checked ~ .chart-config-group label[for=chart-start-date] > input {
                color:black;
            }
325
326
327
            .chart-config-group {
                display:flex;
                justify-content: center;
328
329
330
331
332
                margin:0.5em 1em;
            }
            .chart-config-group > p {
                margin:0em;
                padding:0.5em;
333
            }
334
335
336
            .chart-config-group .per-million,
            .chart-config-group .data-confirmed,
            .chart-config-group .data-recovered,
Michał Woźniak's avatar
Michał Woźniak committed
337
338
            .chart-config-group .data-deaths,
            .chart-config-group .data-active {
339
340
                display:none;
            }
341
342
343
            .chart-config-container input#chart-values-per-million:checked ~ .chart-config-group .per-million,
            .chart-config-container input#chart-data-confirmed:checked ~ .chart-config-group .data-confirmed,
            .chart-config-container input#chart-data-recovered:checked ~ .chart-config-group .data-recovered,
Michał Woźniak's avatar
Michał Woźniak committed
344
345
            .chart-config-container input#chart-data-deaths:checked ~ .chart-config-group .data-deaths,
            .chart-config-container input#chart-data-active:checked ~ .chart-config-group .data-active {
346
347
                display:inline;
            }
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
            .chart-config-group.chart-average {
                display:none;
            }
            .chart-config-container input#chart-cases-new:checked ~ .chart-config-group.chart-average {
                display:flex;
            }
            .chart-config-container #chart-average {
                display: inline;
                -webkit-appearance: none;
                -moz-appearance: none;
                appearance: none;
                color:springgreen;
                width: 4em;
                text-align: center;
                padding: 0.5em;
                border: none;
                border-radius:0.2em;
                background:#404040;
                box-shadow: inset 0px 0px 2px #333;
                font-weight:bold;
            }
369
370
371
372
            .chart-config-container .break {
                flex-basis: 100%;
                height: 0;
            }
Michał Woźniak's avatar
Michał Woźniak committed
373
        </style>
374
375
    </head>
    <body>
376
377
        <h1>Scary COVID-19 data</h1>
        <div id="covid-stats">
378
379
380
381
382
            <div class="item-container"><h2>Global stats</h2></div>
            <div id="confirmed"><span class="label">Confirmed cases:</span> <span class="value">(loading...)</span></div>
            <div id="deaths"><span class="label">Deaths:</span> <span class="value">(loading...)</span></div>
            <div id="recovered"><span class="label">Recovered:</span> <span class="value">(loading...)</span></div>
            <div id="mortality"><span class="label">Mortality rate:</span> <span class="value">(loading...)</span></div>
383
        </div>
384
        <div class="sources"><a href="https://github.com/CSSEGISandData/COVID-19">source</a></div>
385
        <div id="main-menu-container">
386
            <div id="internal-main-menu-container">
387
                <h2>Load 6 sites with at least 100 confirmed cases and:</h2>
388
389
390
                <input type="button" id="site-menu-button-rate" value="largest growth rate"/>
                <input type="button" id="site-menu-button-percentage" value="highest percentage of population infected"/>
                <input type="button" id="site-menu-button-deaths" value="most deaths"/>
Michał Woźniak's avatar
Michał Woźniak committed
391
                <input type="button" id="site-menu-button-recoveries" value="most recoveries"/>
392
                <input type="button" id="site-menu-button-active-drop" value="greatest daily drop of number of active cases"/>
Michał Woźniak's avatar
Michał Woźniak committed
393
            </div>
394
395
        </div>
        <div id="sites-data-container">
Michał Woźniak's avatar
Michał Woźniak committed
396
            <div class="sites-menu-container left">
397
                <a href="#clear-all" id="clear-all-sites">×</a>
Michał Woźniak's avatar
Michał Woźniak committed
398
            </div>
399
            <div class="site-data-container">
Michał Woźniak's avatar
Michał Woźniak committed
400
                <h2 class="for-select"><select class="sites-select" tabindex="1">
401
402
403
404
                    <option value="select one">(select an area)</option>
                </select></h2>
                <div class="site-data">
                </div>
Michał Woźniak's avatar
Michał Woźniak committed
405
            </div>
406
            <div  class="sites-menu-container right">
407
408
409
                <a href="#add-site" id="add-site">+</a>
                <a href="#remove-site" id="remove-site">-</a>
            </div>
410
        </div>
Michał Woźniak's avatar
charts!    
Michał Woźniak committed
411
412
        <div id="the-chart-container">
            <canvas id="the-chart"></canvas>
Michał Woźniak's avatar
Michał Woźniak committed
413
414
        </div>
        <div class="chart-config-container">
415
            <input type="radio" id="chart-data-confirmed" name="chart-data" value="confirmed" checked="checked"/>
416
            <input type="radio" id="chart-data-recovered" name="chart-data" value="recovered"/>
417
            <input type="radio" id="chart-data-deaths" name="chart-data" value="deaths"/>
Michał Woźniak's avatar
Michał Woźniak committed
418
            <input type="radio" id="chart-data-active" name="chart-data" value="active"/>
419
420
421
422
423
424
            <input type="radio" id="chart-type-logarithmic" name="chart-type" value="logarithmic" checked="checked"/>
            <input type="radio" id="chart-type-linear" name="chart-type" value="linear"/>
            <input type="radio" id="chart-cases-cumulative" name="chart-cases" value="cumulative" checked="checked"/>
            <input type="radio" id="chart-cases-new" name="chart-cases" value="new"/>
            <input type="radio" id="chart-values-absolute" name="chart-values" value="absolute" checked="checked"/>
            <input type="radio" id="chart-values-per-million" name="chart-values" value="per-million"/>
425
            <input type="radio" id="chart-start-date" name="chart-start" value="date"/>
426
427
428
429
            <input type="radio" id="chart-start-first" name="chart-start" value="1"/>
            <input type="radio" id="chart-start-tenth" name="chart-start" value="10" checked="checked"/>
            <input type="radio" id="chart-start-hundredth" name="chart-start" value="100"/>
            <input type="radio" id="chart-start-thousandth" name="chart-start" value="1000"/>
430
            <div class="chart-config-group">
431
432
433
434
                <p>Show:</p>
                <label for="chart-data-confirmed">confirmed cases</label>
                <label for="chart-data-recovered">recoveries</label>
                <label for="chart-data-deaths">deaths</label>
Michał Woźniak's avatar
Michał Woźniak committed
435
                <label for="chart-data-active">active cases</label>
436
            </div>
Michał Woźniak's avatar
Michał Woźniak committed
437
438
439
440
441
            <div class="chart-config-group">
                <p>Scale:</p>
                <label for="chart-type-logarithmic">logarithmic</label>
                <label for="chart-type-linear">linear</label>
            </div>
442
            <div class="break"></div>
Michał Woźniak's avatar
Michał Woźniak committed
443
444
445
446
447
            <div class="chart-config-group">
                <p>Cases:</p>
                <label for="chart-cases-cumulative">cumulative</label>
                <label for="chart-cases-new">new</label>
            </div>
448
449
450
451
452
            <div class="chart-config-group chart-average">
                <p>Average over:</p>
                <input type="number" min="1" max="15" step="2" value="1" name="chart-average" id="chart-average"/>
                <p>datapoints</p>
            </div>
Michał Woźniak's avatar
Michał Woźniak committed
453
454
455
456
457
            <div class="chart-config-group">
                <p>Values:</p>
                <label for="chart-values-absolute">absolute</label>
                <label for="chart-values-per-million">per 1M</label>
            </div>
458
            <div class="break"></div>
Michał Woźniak's avatar
Michał Woźniak committed
459
            <div class="chart-config-group">
460
                <p>Start</p>
461
                <label for="chart-start-date">on: <input type="date" name="chart-start-date" value="2020-01-22" min="2020-01-22"/></label>
462
                <p>or from:</p>
Michał Woźniak's avatar
Michał Woźniak committed
463
464
465
466
                <label for="chart-start-first">1st</label>
                <label for="chart-start-tenth">10th</label>
                <label for="chart-start-hundredth">100th</label>
                <label for="chart-start-thousandth">1000th</label>
Michał Woźniak's avatar
Michał Woźniak committed
467
                <p><span class="data-confirmed">case</span><span class="data-recovered">recovery</span><span class="data-deaths">death</span><span class="data-active">active case</span><span class="per-million"> per 1M</span></p>
468
            </div>
469
470
471
472
            <div class="break"></div>
            <div class="chart-config-group">
                <input type="button" id="chart-reset-settings" value="Reset all settings"/>
            </div>
Michał Woźniak's avatar
charts!    
Michał Woźniak committed
473
        </div>
474
475
476
        <div id="disclaimers-container">
            <h3>Disclaimers:</h3>
            <ul>
477
478
                <li><p>This is all back-of-the-napkin math. Take with a grain (or preferably, a spoonfull) of salt. Check your own sources. Make your own analysis.</p></li>
                <li><p>There are bugs. A reasonable attempt is made to clean the data before displaying it.</p></li>
479
480
481
            </ul>
            <h3>Some great resources:</h3>
            <ul>
482
                <li><p><a href="https://covid.hi.is/english/">University of Iceland's COVID data model</a> (and its <a href="https://github.com/bgautijonsson/covid19/">sources</a>);</p></li>
483
484
                <li><p><a href="https://covid-cases.now.sh/">COVID-19 Statistics</a> with some decent models and predictions;</p></li>
                <li><p><a href="https://aatishb.com/covidtrends/">a brilliant chart</a> showing very clearly when a country starts being able to control the outbreak;</p></li>
485
                <li><p>John Hopkins University's <a href="https://www.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6">COVID-19 dashboard</a>, and their <a href="https://github.com/CSSEGISandData/COVID-19">cleaned global data in CSVs</a>, updated daily (this is the base data for this site).</p></li>
486
487
            </ul>
        </div>
488
        <footer>
Michał Woźniak's avatar
Michał Woźniak committed
489
            <p>cobbled together by <a href="https://mastodon.social/@rysiek/">@rysiek</a>; <a href="https://git.rys.io/rysiek/covid/">code is here</a>; license: <a href="./LICENSE">Affero GPL</a><br/>
Michał Woźniak's avatar
charts!    
Michał Woźniak committed
490
            uses <a href="https://github.com/spencermountain/wtf_wikipedia"><code>wtf_wikipedia</code></a> and <a href="https://www.chartjs.org/">Charts.js</a> (both <a href="./LICENSE.wtf_wikipedia-charts.js.txt">MIT-licensed</a>) and the Play font (licensed under the <a href="./Play/OFL.txt">OFL</a>)<br/>
491
492
            data from <a href="https://github.com/CSSEGISandData/COVID-19">John Hopkins University</a> via <a href="https://github.com/pomber/covid19"><code>pomber/covid19</code></a></p>
            <p>there are no <a href="https://barnacles.online">barnacle trackers</a> on this page:<br/>no fonts, styles, scripts, nor images fetched from third-party servers</p>
493
        </footer>
494
495
    </body>
</html>