-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
177 lines (150 loc) · 7.89 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Visualization - COVID-19 Forecast Hub</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.png">
<!-- Bootstrap 4 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<!-- https://www.daterangepicker.com/ -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
<!-- predtimechart -->
<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
<!-- this page's styles -->
<link rel="stylesheet" href="/styles.css">
</head>
<body>
<div class="container-fluid">
<!-- navbar: [icon] Home Visualization Reports Data Community About (GitHub) -->
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand" href="https://covid19forecasthub.org/">
<img style="display: inline-block; height: 55px; margin-top: -10px"
src="https://covid19forecasthub.org/images/forecast-hub-logo_DARKBLUE.png"
alt="Viz - COVID-19 Forecast Hub"/>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="nav navbar-nav ml-auto nav-pills">
<li class="nav-item active"><a class="nav-link" href="https://covid19forecasthub.org/">Home</a></li>
<li class="nav-item active"><a class="nav-link" href="https://viz.covid19forecasthub.org/">Visualization</a></li>
<li class="nav-item active"><a class="nav-link" href="https://covid19forecasthub.org/doc/reports/">Reports</a></li>
<li class="nav-item active"><a class="nav-link" href="https://covid19forecasthub.org/data/">Data</a></li>
<li class="nav-item active"><a class="nav-link" href="https://covid19forecasthub.org/community/">Community</a></li>
<li class="nav-item active"><a class="nav-link" href="https://covid19forecasthub.org/doc/">About</a>
</li>
<li class="nav-item active px-2">
<a id="github-link" class="nav-link badge-primary" target="_blank"
href="https://github.com/reichlab/covid19-forecast-hub">GitHub</a>
</li>
</ul>
</div>
</nav>
<!-- hack to put vertical spacing above row, https://stackoverflow.com/questions/12273588/add-vertical-blank-space-using-twitter-bootstrap -->
<ol style="visibility:hidden;"></ol>
<!-- the div passed to zoltar_viz.js initialize(), which populates all DOM elements -->
<div id="forecastViz_row" class="row">
</div>
<script type="module">
import App from 'https://cdn.jsdelivr.net/gh/reichlab/[email protected]/dist/predtimechart.bundle.js';
document.predtimechart = App; // for debugging
// _fetchData()
function _fetchData(isForecast, targetKey, taskIDs, referenceDate) {
const unitAbbrev = taskIDs['location']; // see note below re: only one task ID ('location')
let target_path;
if (isForecast) {
target_path = `./static/data/forecasts/${targetKey}_${unitAbbrev}_${referenceDate}.json`;
} else {
target_path = `./static/data/truth/${targetKey}_${unitAbbrev}_${referenceDate}.json`;
}
return fetch(target_path); // Promise
}
// load static (i.e., non-data) json files
let targetVariables = null;
let locations = null;
let availableAsOfs = null;
let models = null;
let initial_as_of = null;
const promises = [
fetch('assets/target_variables.json')
.then(response => response.json())
.then((data) => {
targetVariables = data;
}),
fetch('assets/locations.json')
.then(response => response.json())
.then((data) => {
locations = data;
}),
fetch('static/data/available_as_ofs.json')
.then(response => response.json())
.then((data) => {
availableAsOfs = data;
}),
fetch('static/data/initial_as_of.json')
.then(response => response.json())
.then((data) => {
initial_as_of = data['initial_as_of'];
}),
fetch('static/data/models.json')
.then(response => response.json())
.then((data) => {
models = data;
})
];
// initialize the viz component. Recall that taskIDs is an object with keys for each task ID and corresponding
// values. For this project, there is always only one task ID: 'location', e.g., {"location": "48"}
Promise.all(promises).then((values) => {
const options = {
'target_variables': targetVariables,
'initial_target_var': 'hosp',
'task_ids': {'location': locations},
'initial_task_ids': {'location': 'US'},
'intervals': ['0%', '50%', '95%'],
'initial_interval': '95%',
'available_as_ofs': availableAsOfs,
'initial_as_of': initial_as_of,
'current_date': availableAsOfs.death[availableAsOfs.death.length - 1],
'models': models,
'initial_checked_models': ['COVIDhub-ensemble'],
'disclaimer': 'Most forecasts have failed to reliably predict rapid changes in the trends of reported cases and hospitalizations. Due to this limitation, they should not be relied upon for decisions about the possibility or timing of rapid changes in trends. Ensemble case forecasts were discontinued as of February 20, 2023 and death forecasts were discontinued as of March 6, 2023.',
"initial_xaxis_range": null,
}
// componentDiv, _fetchData, isIndicateRedraw, options:
App.initialize('forecastViz_row', _fetchData, false, options);
});
</script>
</div>
<!-- Default Statcounter code for Covid19-forecast-hub https://viz.covid19forecasthub.org/ -->
<script type="text/javascript">
var sc_project = 12239903;
var sc_invisible = 1;
var sc_security = "3c7ad044";
</script>
<script type="text/javascript" src="https://www.statcounter.com/counter/counter.js" async></script>
<noscript>
<div class="statcounter">
<a title="Web Analytics" href="https://statcounter.com/" target="_blank">
<img class="statcounter"
src="https://c.statcounter.com/12239903/0/3c7ad044/1/"
alt="Web Analytics"
referrerPolicy="no-referrer-when-downgrade">
</a>
</div>
</noscript>
<!-- End of Statcounter Code -->
<!-- Netlify credit -->
<footer class="footer text-center mt-5 py-3 bg-light">
<div class="container">
<span class="text-muted">This site is powered by <a href="https://www.netlify.com" class="text-muted">Netlify</a></span>
</div>
</footer>
</body>
</html>