Skip to content

Commit b584934

Browse files
elray1hubdashboard[bot]
authored andcommitted
deploy
0 parents  commit b584934

24 files changed

Lines changed: 6938 additions & 0 deletions

.nojekyll

Whitespace-only changes.

eval.html

Lines changed: 610 additions & 0 deletions
Large diffs are not rendered by default.

forecast.html

Lines changed: 610 additions & 0 deletions
Large diffs are not rendered by default.

index.html

Lines changed: 644 additions & 0 deletions
Large diffs are not rendered by default.

resources/css/styles.css

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
.navbar {
2+
background-color: #003a80;
3+
}
4+
5+
body {
6+
font-family: "Source Sans Pro", "Helvetica Neue", Helvetica Neue, Helvetica, Arial, sans-serif;
7+
}
8+
9+
a {
10+
color: #0073ff;
11+
}
12+
13+
a:hover,
14+
a:focus {
15+
color: #0073ff;
16+
}
17+
18+
.navbar-inverse .navbar-nav > li > a:hover {
19+
background-color: #002858;
20+
}
21+
22+
.navbar-inverse .navbar-nav > li > a:focus {
23+
background-color: #002858;
24+
}
25+
26+
.navbar-inverse .navbar-nav > .active > a,
27+
.navbar-inverse .navbar-nav > .active > a:hover,
28+
.navbar-inverse .navbar-nav > .active > a:focus {
29+
background-color: #002858;
30+
}
31+
32+
.button {
33+
color: #ffffff;
34+
padding: 20px 40px;
35+
font-size: 20px;
36+
border: none;
37+
38+
border-radius: 5px;
39+
40+
margin: 5px;
41+
}
42+
43+
.button.forecasts {
44+
color: #fff;
45+
background-color: #003a80;
46+
}
47+
48+
.button.reports {
49+
color: #fff;
50+
background-color: #64a621;
51+
}
52+
53+
.list-group-item.active,
54+
.list-group-item.active:hover,
55+
.list-group-item.active:focus {
56+
background-color: #003a80;
57+
}
58+
59+
@media (min-width: 768px) and (max-width: 991px) {
60+
header {
61+
padding-bottom: 89.2px !important;
62+
}
63+
}

resources/predevals_interface.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import App from "https://cdn.jsdelivr.net/gh/hubverse-org/predevals@1.0.2/dist/predevals.bundle.js";
2+
import * as d3 from "https://cdn.jsdelivr.net/npm/d3@7/+esm";
3+
4+
document.predevals = App; // for debugging
5+
document.d3m = d3; // for debugging
6+
7+
function replace_chars(the_string) {
8+
// replace all non-alphanumeric characters, except dashes and underscores, with a dash
9+
return the_string.replace(/[^a-zA-Z0-9-_]/g, '-');
10+
}
11+
12+
const root = "https://raw.githubusercontent.com/reichlab/flusight-dashboard/refs/heads/predevals/data/";
13+
14+
async function _fetchData(target, eval_window, disaggregate_by) {
15+
// ex taskIDs: {"scenario_id": "A-2022-05-09", "location": "US"} . NB: key order not sorted
16+
console.info("_fetchData(): entered.", `"${target}"`, `"${eval_window}"`, `"${disaggregate_by}"`);
17+
18+
let target_path;
19+
if (disaggregate_by === '(None)') {
20+
target_path = `${root}scores/${target}/${eval_window}/scores.csv`;
21+
} else {
22+
target_path = `${root}scores/${target}/${eval_window}/${disaggregate_by}/scores.csv`;
23+
}
24+
return d3.csv(target_path);
25+
}
26+
27+
28+
// load options and then initialize the component
29+
fetch(`${root}/predevals-options.json`)
30+
.then(response => response.json())
31+
.then((data) => {
32+
console.info("fetch(): done. calling App.initialize().", data);
33+
34+
// componentDiv, _fetchData, options:
35+
App.initialize('predEval_row', _fetchData, data);
36+
})
37+
.then(function() {
38+
// ZNK 2024-09-16: update for bootstrap 5
39+
var divs = document.querySelectorAll("div[class^='col-md']");
40+
for (var div of divs) {
41+
if (div.className.match("g-col") == null) {
42+
var n = div.className.match("col-md-(.{1,2})")[1];
43+
div.classList.add("g-col-"+n);
44+
}
45+
}
46+
});
47+
48+
window.addEventListener('DOMContentLoaded', function() {
49+
var divs = document.querySelectorAll("div[class^='col-md']");
50+
for (var div of divs) {
51+
if (div.className.match("g-col") == null) {
52+
var n = div.className.match("col-md-(.{1,2})")[1];
53+
div.classList.add("g-col-"+n);
54+
}
55+
}
56+
});

resources/predtimechart.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import App from 'https://cdn.jsdelivr.net/gh/reichlab/predtimechart@3.0.0/dist/predtimechart.bundle.js';
2+
document.predtimechart = App; // for debugging
3+
4+
function replace_chars(the_string) {
5+
// replace all non-alphanumeric characters, except dashes and underscores, with a dash
6+
return the_string.replace(/[^a-zA-Z0-9-_]/g, '-');
7+
}
8+
9+
const root = "https://raw.githubusercontent.com/reichlab/flusight-dashboard/refs/heads/ptc/data/";
10+
11+
function _fetchData(isForecast, targetKey, taskIDs, referenceDate) {
12+
// ex taskIDs: {"scenario_id": "A-2022-05-09", "location": "US"} . NB: key order not sorted
13+
console.info("_fetchData(): entered.", isForecast, `"${targetKey}"`, taskIDs, `"${referenceDate}"`);
14+
15+
const targetKeyStr = replace_chars(targetKey);
16+
17+
// get .json file name: 1) get taskIDs values ordered by sorted keys, 2) clean up ala `json_file_name()`
18+
const taskIDsValsSorted = Object.keys(taskIDs).sort().map(key => taskIDs[key]);
19+
const taskIDsValsStr = replace_chars(taskIDsValsSorted.join(' '));
20+
21+
let target_path;
22+
const file_name = `${targetKeyStr}_${taskIDsValsStr}_${referenceDate}.json`;
23+
if (isForecast) {
24+
target_path = `${root}/forecasts/${file_name}`;
25+
} else {
26+
target_path = `${root}/targets/${file_name}`;
27+
}
28+
return fetch(target_path); // Pwomise?
29+
}
30+
31+
32+
// load options and then initialize the component
33+
fetch(`${root}/predtimechart-options.json`)
34+
.then(response => response.json())
35+
.then((data) => {
36+
console.info("fetch(): done. calling App.initialize().", data);
37+
38+
// componentDiv, _fetchData, isIndicateRedraw, options, _calcUemForecasts:
39+
App.initialize('forecastViz_row', _fetchData, false, data, null);
40+
})
41+
.then(function() {
42+
// ZNK 2024-09-16: update for bootstrap 5
43+
var divs = document.querySelectorAll("div[class^='col-md']");
44+
for (var div of divs) {
45+
if (div.className.match("g-col") == null) {
46+
var n = div.className.match("col-md-(.{1,2})")[1];
47+
div.classList.add("g-col-"+n);
48+
}
49+
}
50+
});
51+
52+
window.addEventListener('DOMContentLoaded', function() {
53+
var divs = document.querySelectorAll("div[class^='col-md']");
54+
for (var div of divs) {
55+
if (div.className.match("g-col") == null) {
56+
var n = div.className.match("col-md-(.{1,2})")[1];
57+
div.classList.add("g-col-"+n);
58+
}
59+
}
60+
});
61+
62+
63+

search.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[
2+
{
3+
"objectID": "forecast.html",
4+
"href": "forecast.html",
5+
"title": "FluSight Forecast Hub Dashboard",
6+
"section": "",
7+
"text": "this is replaced"
8+
},
9+
{
10+
"objectID": "eval.html",
11+
"href": "eval.html",
12+
"title": "FluSight Forecast Hub Dashboard",
13+
"section": "",
14+
"text": "this is replaced"
15+
},
16+
{
17+
"objectID": "index.html",
18+
"href": "index.html",
19+
"title": "Introduction",
20+
"section": "",
21+
"text": "This is a dashboard for the FluSight forecasting challenge that is organized by the US CDC.\n\nView The Latest Forecasts\n\nThe target data for the FluSight challenge is hospitalizations with influenza as reported to the National Healthcare Safety Network (NHSN); this data is publicly available through the CDC’s Weekly Hospital Respiratory Data (HRD) Metrics dataset.\nFor the evaluations, we have excluded predictions for two reference dates that were substantively impacted by NHSN reporting issues: 2024-11-23 and 2025-01-25.\n\n\n\n\n\n\nNote\n\n\n\nThe CDC notes that:\n\nData for reporting dates through April 30, 2024 represent data reported during a previous mandated reporting period as specified by the HHS Secretary. Data for reporting dates May 1, 2024–October 31, 2024 represent voluntarily reported data in the absence of a mandate. Data for reporting dates beginning November 1, 2024 represent data reported during a current mandated reporting period."
22+
}
23+
]

0 commit comments

Comments
 (0)