-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
377 lines (328 loc) · 21.1 KB
/
index.html
File metadata and controls
377 lines (328 loc) · 21.1 KB
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-129083114-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-129083114-2');
</script>
<link rel="stylesheet" href="styles.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hammerjs@2.0.8"></script>
<!-- chartjs-plugin-zoom v7.7 breaks chart pan/zoom sync -->
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom@0.7.4"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-annotation/0.5.5/chartjs-plugin-annotation.js'></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script src="world_data.js"></script>
<script src="world_population.js"></script>
<script src="SL_district_data.js"></script>
<script src="world_vaccine_data.js"></script>
<script src="optimal_parameters.js"></script>
<script src="model.js"></script>
<script src="simulator.js"></script>
<script src="prediction_history.js"></script>
<script src="optimizer.js"></script>
<title>COVID-19 simulator for Sri Lanka</title>
<meta name="description" content="An interactive tool for simulating and analyzing the COVID-19 pandemic in Sri Lanka"/>
<meta name="keywords" content="COVID-19, Coronavirus, Sri Lanka, simulation, analysis">
</head>
<body>
<div style="margin:0 auto; width:80%">
<h2>Simulating the COVID-19 pandemic in Sri Lanka</h2>
<div class="small" style="color:gray;"><b>Disclaimer</b>: This simulation tool is primarily intended for research and public awareness purposes. There are many uncertainties about the infection and transmission of COVID-19 and there are many limitations to this simple model.</div>
<h3><a href="analysis.html">Click here</a> for more visualizations of the COVID-19 data for Sri Lanka.</h3>
<hr>
<h3>Prediction History for Sri Lanka</h3>
<p>
The table below shows the history of the predictions made by the model and compares the results with officially reported data as they become available.
<br>
New predictions will be added to the table when the model is recalibrated (roughly every week).
</p>
<br>
<div style="height: 240px; overflow: auto;">
<table class="fixed_header" id="table_pred_hist">
<thead>
<tr>
<th colspan="2">Current date</th>
<th>Today</th>
<th>Tomorrow</th>
<th>+2 days</th>
<th>+3 days</th>
<th>+5 days</th>
<th>+7 days</th>
<th>+14 days</th>
</tr>
</thead>
<tbody>
<tr></tr>
</tbody>
</table>
</div>
<hr>
<div class="clearfix">
<div class="column" id="chart_controls" style="width:20%;">
<h3>Chart controls</h3>
<div class="control">
<div style="text-align:left; padding-bottom:3px;">Select country:</div>
<select id="dropdown_country" class="small" style="min-height:30px;" onchange="changeCountry(this.value)"></select>
</div>
<div class="control">
<div style="text-align:left; padding-bottom:3px;">Select start date:</div>
<select id="dropdown_startdate" class="small" style="min-height:30px;" onchange="updateCountryData()"></select>
</div>
<div class="control">
<input type="radio" id="radio_data_diagnosed" name="plot_data_type" value="cat_diag" checked onchange="refreshMainChartData()">
<label for="radio_data_diagnosed">Show diagnosed cases</label>
</div>
<div style="margin-top:5px;">
<input type="radio" id="radio_data_sum" name="plot_data_type" value="cat_sum" onchange="refreshMainChartData()">
<label for="radio_data_sum">Show all cases</label>
</div>
<div class="control">
<input type="checkbox" id="check_log_y" onchange="setLogYAxis(this.checked)">Log-scale y-axis</input>
</div>
<div class="control">
<input type="checkbox" id="check_calibration_mode" onchange="toggleDatasets()">Turn on calibration mode</input>
</div>
<div class="control">
<input type="checkbox" id="check_show_legend" onchange="updateLegend()" checked>Show legend</input>
</div>
<div class="control">
<input type="radio" id="radio_data_daily" name="plot_data_freq" value="daily" checked onchange="refreshMainChartData()">
<label for="radio_data_daily">Show daily new cases</label>
</div>
<div style="margin-top:5px;">
<input type="radio" id="radio_data_cumulative" name="plot_data_freq" value="cumulative" onchange="refreshMainChartData()">
<label for="radio_data_cumulative">Show cumulative cases</label>
</div>
<div class="control">
<button type="button" class="small" id="reset_zoom" onclick="resetZoom()">Default view</button>
</div>
<br>
<hr style="margin-top:10px;">
<h3>Simulation controls</h3>
<div class="control full">
<input class"control" type="range" style="width: 90%;" id="slider_finalT" onmousemove="updateParameters()" min=5 max=270 step=1></input>
<div class="small">Predict for <span id="slider_finalT_value"></span> days</div>
</div>
<div class="control full">
<input class"control" type="range" style="width: 90%;" id="slider_param_IFR" onmousemove="updateParameters()" min=0 max=2 step=0.05></input>
<div class="small">Infection fatality ratio (IFR): <span id="slider_param_IFR_value"></span>%</div>
<div class="small" style="padding-top:5px;">Case fatality ratio (CFR): <span id="estimated_CFR"></span>%</div>
</div>
</div>
<div class="column" style="width:80%;">
<div id="canvas_container">
<canvas class="full" id="chart_canvas"></canvas>
<div class="teeny" id="legend" style="width:28em;">
<center><b></b></center>
<div class="clearfix">
<div class="legend_column" style="width:34%; padding-right:5px;">
<b><div id="legend_date" style="padding-bottom:5px"></div> </b>
<div class="exposed">Exposed</div>
<div class="asymptomatic">Asymptomatic</div>
<div class="recovered">Recovered</div>
<div>Fatal</div>
<div class="infected">Active infected</div>
<div class="mild" style="text-indent:1em;">- Mild</div>
<div class="severe" style="text-indent:1em;">- Severe</div>
<div class="critical" style="text-indent:1em;">- Critical</div>
<hr>
<div>Total cases</div>
</div>
<div class="legend_column" style="width:22%; padding-right:5px;">
<b><div class="legend_value" style="padding-bottom:5px">Predicted<br>unreported</br></div></b>
<div class="legend_value exposed" id="legend_predu0">0</div>
<div class="legend_value asymptomatic" id="legend_predu1">0</div>
<div class="legend_value recovered" id="legend_predu2">0</div>
<div class="legend_value" id="legend_predu3">0</div>
<div class="legend_value infected" id="legend_predu_infected">0</div>
<div class="legend_value mild" id="legend_predu4">0</div>
<div class="legend_value severe" id="legend_predu5">0</div>
<div class="legend_value critical" id="legend_predu6">0</div>
<hr>
<div class="legend_value" id="legend_predu_total">0</div>
</div>
<div class="legend_column" style="width:22%; padding-right:5px;">
<b><div class="legend_value" style="padding-bottom:5px">Predicted<br>reported</br></div></b>
<div class="legend_value exposed" id="legend_pred0">0</div>
<div class="legend_value asymptomatic" id="legend_pred1">0</div>
<div class="legend_value recovered" id="legend_pred2">0</div>
<div class="legend_value" id="legend_pred3">0</div>
<div class="legend_value infected" id="legend_pred_infected">0</div>
<div class="legend_value mild" id="legend_pred4">0</div>
<div class="legend_value severe" id="legend_pred5">0</div>
<div class="legend_value critical" id="legend_pred6">0</div>
<hr>
<div class="legend_value" id="legend_pred_total">0</div>
</div>
<div class="legend_column" style="width:22%;">
<b><div class="legend_value" style="padding-bottom:5px">Actual<br>reported</br></div></b>
<div class="legend_value exposed">-</div>
<div class="legend_value asymptomatic">-</div>
<div class="legend_value recovered" id="legend_true_recovered">0</div>
<div class="legend_value" id="legend_true_fatal">0</div>
<div class="legend_value infected" id="legend_true_infected">0</div>
<div class="legend_value mild">-</div>
<div class="legend_value severe">-</div>
<div class="legend_value critical">-</div>
<hr>
<div class="legend_value" id="legend_true_total">0</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix">
<div class="column" id="chart_controls" style="width:20%;">
<div class="control full">
<div>Select a parameter to edit on graph:</div>
<select id="dropdown_parameter" class="small" style="min-height:30px; margin-top:5px;" onchange="changeControlChartParameter(this.value)">
<option value="b1N">Transmission rate $$\beta$$₁</option>
<option value="b2N">Transmission rate $$\beta$$₂</option>
<option value="b3N">Transmission rate $$\beta$$₃</option>
<option value="ce">Daily diagnosis fraction $$c$$ₑ</option>
<option value="c0">Daily diagnosis fraction $$c$$₀</option>
<option value="c1">Daily diagnosis fraction $$c$$₁</option>
<option value="c2">Daily diagnosis fraction $$c$$₂</option>
<option value="c3">Daily diagnosis fraction $$c$$₃</option>
<option value="vaccine_rate">No. of vaccinations per day</option>
</select>
<!-- <button type="button" class="control small" id="btn_optimize" onclick="optimizeParameters()">Optimize parameters to data</button> -->
<button type="button" class="control small" id="btn_reset_params" onclick="resetParameters()">Reset parameters</button>
</div>
<div class="control full">
<input class"control" type="range" style="width: 90%;" id="slider_param_error" onmousemove="updateParameters()" min=0 max=20 step=0.5></input>
<div class="small">Uncertainty in parameters: <span id="slider_param_error_value"></span>%</div>
</div>
<div class="control full">
<button type="button" class="control small" id="btn_download_data" onclick="downloadData()">Download data</button>
</div>
</div>
<div class="column" style="width:80%;">
<div class="small clearfix" style="color:grey;">
<div class="column" style="width:15%; padding-left:4em;">
<span class="tooltip">R value:
<span class="tiny tooltiptext">Effective reproduction number</span>
</span> <span id="R_value">0.000</span>
</div>
<div class="column" id="control_chart_title" style="width:70%; text-align:center;">
Transmission rate of unreported exposed, asymptomatic, or mildly-infected individuals
</div>
<div class="column" style="width:15%;">
<span style="float:right;">
<span class="tooltip">Prediction error:
<span class="tiny tooltiptext">This is an estimate of the error between the predicted data and the real data. Smaller error values indicate a better fit.</span>
</span> <span id="prediction_error">0.0</span>
</span>
</div>
</div>
<canvas class="full" id="control_chart_canvas"></canvas>
<!-- <br> -->
<center><div class="tiny" style="color:grey">Simulate the effect of interventions such as lockdowns and curfews by clicking and dragging points on the graph.</div></center>
</div>
</div>
<br>
<div class="para">
<p>The COVID-19 pandemic has interrupted the day-to-day life of all Sri Lankans. At the time of writing, the entire country is in lockdown. As of now, due to strict interventions, the disease spread seems to have slowed down. However, it is not completely clear what we should expect in the future, especially when interventions change. To shed some light, we have developed an interactive tool to model the spread of COVID-19 in Sri Lanka using a classical SEIR (<b>S</b>usceptible → <b>E</b>xposed → <b>I</b>nfected → <b>R</b>emoved (i.e recovered and fatal) infectious disease model. We also modified the model to account for the Sri Lankan setting.
</p>
</div>
<br>
<h3>Model description</h3>
<div class="para">
<div class="clearfix">
<div class="column" style="width:50%;">
<p>
In our model, the entire population is divided into the following classes:
<ul>
<li>\(S\) - Susceptible individuals</li>
<li>\(E_0\) - Exposed individuals before they become infectious</li>
<li>\(E_1\) - Exposed individuals after they are infectious</li>
<li>\(I_0\) - Asymptomatic individuals</li>
<li>\(I_1\) - Infected individuals with mild symptoms</li>
<li>\(I_2\) - Infected individuals with severe symptoms (require hospitalization)</li>
<li>\(I_3\) - Infected individuals at critical stage (require ICU admission)</li>
<li>\(R\) - Recovered individuals</li>
<li>\(D\) - Fatalities</li>
</ul>
</p>
</div>
<div class="column" style="width:50%;">
<img src="./model_schematic.png" style="width:100%"></img>
<center><figcaption class="tiny" style="margin-top:10px;">Schematic of model classes and rate parameters</figcaption></center>
</div>
</div>
<p>
Susceptible (\(S\)) individuals contract the disease from infected individuals in the classes \(E_1, I_0, I_1, I_2,\) and \(I_3\). They then move to the exposed class (\(E_0\)). After an incubation period (~3 days) in \(E_0\), they become infectious in the \(E_1\) class, and stay in the infectious-exposed class \(E_1\) for ~2 days. From \(E_1\), they can either move to an asymptomatic class, \(I_0\), or to the mild symptomatic class, \(I_1\). The percentage of asymptomatic vs. symptomatic individuals is captured by the fraction \(f\), and is assumed to be 0.3 (i.e. 30% are asymptomatic). The classes \(E_1, I_0, I_1, I_2,\) and \(I_3\) are further decomposed into two categories: reported and unreported (e.g. \(E_{1R}\) and \(E_{1U}\)). The ratio between the number of reported and unreported individuals in each of these classes is controlled by the time-varying parameters \(c_e(t), c_0(t), c_1(t), c_2(t), c_3(t)\). Each \(c(t)\) fraction represents the percentage of unreported cases that get reported/diagnosed on a given day.
</p>
<p>
According to literature, roughly 81% of the symptomatic individuals (in \(I_1\)) recover after mild symptoms (in ~6 days) and move to the recovered class (\(R\)). The remaining 19% from \(I_1\) develop severe symptoms and move to the \(I_2\) class. These severe cases require hospitalization. About three-fourths from \(I_2\) recover after hospitalization (in ~4 days), but the remaining one-fourth develop critical symptoms and require ICU treatment. About 40% of the critical cases are fatal and the rest recover after ICU treatment (in ~10 days). These numbers were derived from the published literature of the COVID-19 spread in China, and were used to calculate the rate parameters, \(a_0, a_1, f, \gamma_0, \gamma_1, \gamma_2, \gamma_3, p_1, p_2,\) and \(\mu\).
</p>
<p>
Next, we had a significant number of infected individuals (tested positive) who entered the country from abroad, but were strictly quarantined before they could infect others. We assumed that all these cases enter the country at the mildly-infected stage (\(I_{1R}\)), although it is possible that they enter during the exposed period as well. When we run the model, we add these cases to the population based on the date they tested positive.
</p>
<br>
<h4>Governing equations</h4>
<p>
The system of coupled differential equations that model the evolution of the number of individuals in each of the 16 classes (with sub-categories) is given by:
$$
\begin{align}
\dot{S} &= -\left( \beta_e E_{1U} + \beta_0 I_{0U} + \beta_1 I_{1U} + \beta_2 I_{2U} + \beta_3 I_{3U} \right) S \\
\dot{E}_0 &= \left( \beta_e E_{1U} + \beta_0 I_{0U} + \beta_1 I_{1U} + \beta_2 I_{2U} + \beta_3 I_{3U} \right) S - a_0 E_0 \\[1em]
\dot{E}_{1U} &= a_0 E_0 - a_1 E_{1U} - r_e(t) \\
\dot{I}_{0U} &= f a_1 E_{1U} - \gamma_0 I_{0U} - r_0(t) \\
\dot{I}_{1U} &= (1-f) a_1 E_{1U} - (\gamma_1 + p_1) I_{1U} - r_1(t) \\
\dot{I}_{2U} &= p_1 I_{1U} - (\gamma_2 + p_2) I_{2U} - r_2(t) \\
\dot{I}_{3U} &= p_2 I_{2U} - (\gamma_3 + \mu) I_{3U} - r_3(t) \\
\dot{R}_{U} &= \gamma_1 I_{1U} + \gamma_2 I_{2U} + \gamma_3 I_{3U} \\
\dot{D}_{U} &= \mu I_{3U} \\[1em]
\dot{E}_{1R} &= -a_1 E_{1R} + r_e(t) \\
\dot{I}_{0R} &= f a_1 E_{1R} - \gamma_0 I_{0R} + r_0(t) \\
\dot{I}_{1R} &= (1-f) a_1 E_{1R} - (\gamma_1 + p_1) I_{1R} + r_1(t) + q_{entry}(t) \\
\dot{I}_{2R} &= p_1 I_{1R} - (\gamma_2 + p_2) I_{2R} + r_2(t) \\
\dot{I}_{3R} &= p_2 I_{2R} - (\gamma_3 + \mu) I_{3R} + r_3(t) \\
\dot{R}_{R} &= \gamma_1 I_{1R} + \gamma_2 I_{2R} + \gamma_3 I_{3R} \\
\dot{D}_{R} &= \mu I_{3R}
\end{align}
$$
The time-varying functions \(r_e(t), r_0(t), r_1(t), r_2(t),\) and \(r_3(t)\) simulate the act of "reporting" by transferring individuals from the unreported classes to the reported classes, based on the corresponding daily reporting fractions \(c_e(t), c_0(t)\) etc.
</p>
</div>
<br>
<h3>Data sources</h3>
<p class="small">
<a href="http://www.epid.gov.lk/web/index.php?option=com_content&view=article&id=225&Itemid=518&lang=en" target="_blank">Situation reports</a> - Epidemiology unit, Ministry of Health, Sri Lanka
<br><br>
<a href="https://alhill.shinyapps.io/COVID19seir/" target="_blank">COVID-10 modeling app by Allison Hill</a>
<br><br>
<a href="https://pomber.github.io/covid19/timeseries.json" target="_blank">JSON time-series by pomber</a>
</p>
<br>
<h3>About</h3>
<p class="small">
This model was developed by <a href="https://wadduwagelab.com/" target="_blank">Dushan Wadduwage</a> (<a href="mailto:wadduwage@fas.harvard.edu">wadduwage@fas.harvard.edu</a>), <a href="https://www.linkedin.com/in/savithru/" target="_blank">Savithru Jayasinghe</a> (<a href="mailto:savithru@mit.edu">savithru@mit.edu</a>), and <a href="https://medicine.yale.edu/profile/suneth_agampodi/" target="_blank">Suneth Agampodi</a> (<a href="mailto:suneth.agampodi@yale.edu">suneth.agampodi@yale.edu</a>).
<br><br>
The Javascript code behind this web application is available on <a href="https://github.com/savithru-j/COVID-19-SL" target="_blank">Github</a> under an <a href="https://opensource.org/licenses/MIT" target="_blank">MIT license</a>.
<br><br>
Findings from this model were published in the <a href="https://www.slcovidmodel.com/docs/Covid19_Model_Newsletter_Feb_2021.pdf" target="_blank">February 2021 newsletter</a> of the College of General Practitioners in Sri Lanka.
</p>
<br>
<b>Acknowledgements</b>
<ul style="padding-top:0px">
<li><a href="https://twitter.com/alison_l_hill" target="_blank">Allison Hill</a> for her advice and feedback on early versions of the model.</li>
<li>Buddhi Prabhath for integrating data from all countries into the code.</li>
<li><a href="https://alt.army.lk/covid19/" target="_blank">National Operation Centre for Prevention of COVID-19 Outbreak</a> in Sri Lanka for sharing data and strategy related detail.</li>
</ul>
<br>
<div class="tiny" style="text-align:right; color:grey">This simulation tool is intended for research purposes, and is provided freely without warranty of any kind.</div>
</div>
<div style="height:30px"></div>
</body>
</html>