Skip to content

Commit

Permalink
Merge pull request #14 from Infectious-Disease-Modeling-Hubs/update_e…
Browse files Browse the repository at this point in the history
…xample_simple_forecast_hub

Github Actions build update example-simple-forecast-hub: 18
  • Loading branch information
elray1 committed Jun 16, 2023
2 parents 7454c4e + 425ab88 commit 5a6d92c
Show file tree
Hide file tree
Showing 15 changed files with 71,561 additions and 1,611 deletions.
38 changes: 38 additions & 0 deletions inst/example-data/example-simple-forecast-hub/README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# Example Simple Forecast Hub

**This repository is under construction.**

This repository is designed as an example modeling Hub that follows the infrastructure guidelines laid out by the [Consortium of Infectious Disease Modeling Hubs](https://github.com/Infectious-Disease-Modeling-Hubs/). The example is documented in more detail [here](https://hubdocs.readthedocs.io/en/latest/format/intro-data-formats.html#running-examples).

The example model outputs that are provided here are adapted from forecasts submitted to the US COVID-19 Forecast Hub, but have been modified to provide examples of nowcasts. They should be viewed only as illustrations of the data formats, not as realistic examples of nowcasts and forecasts. In particular, scores calculated by comparing the model outputs to the target data will not give a meaningul measure of predictive skill.

## Working with the data

To work with the data in R, you can use code like the following:

```{r}
library(hubUtils)
library(dplyr)
model_outputs <- hubUtils::connect_hub(hub_path = ".") %>%
dplyr::collect()
head(model_outputs)
target_data <- read.csv("target-data/covid-hospitalizations.csv")
head(target_data)
```
52 changes: 50 additions & 2 deletions inst/example-data/example-simple-forecast-hub/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
# Example simple forecast hub

<!-- README.md is generated from README.Rmd. Please edit that file -->

# Example Simple Forecast Hub

**This repository is under construction.**

This repository is designed as an example modeling Hub that follows the infrastructure guidelines laid out by the [Consortium of Infectious Disease Modeling Hubs](https://github.com/Infectious-Disease-Modeling-Hubs/). The example is documented in more detail [here](https://hubdocs.readthedocs.io/en/latest/format/intro-data-formats.html#running-examples).
This repository is designed as an example modeling Hub that follows the
infrastructure guidelines laid out by the [Consortium of Infectious
Disease Modeling
Hubs](https://github.com/Infectious-Disease-Modeling-Hubs/). The example
is documented in more detail
[here](https://hubdocs.readthedocs.io/en/latest/format/intro-data-formats.html#running-examples).

The example model outputs that are provided here are adapted from
forecasts submitted to the US COVID-19 Forecast Hub, but have been
modified to provide examples of nowcasts. They should be viewed only as
illustrations of the data formats, not as realistic examples of nowcasts
and forecasts. In particular, scores calculated by comparing the model
outputs to the target data will not give a meaningul measure of
predictive skill.

## Working with the data

To work with the data in R, you can use code like the following:

``` r
library(hubUtils)
library(dplyr)

model_outputs <- hubUtils::connect_hub(hub_path = ".") %>%
dplyr::collect()
head(model_outputs)
#> # A tibble: 6 × 8
#> origin_date horizon location target output_type output_type_id value model_id
#> <date> <int> <chr> <chr> <chr> <dbl> <int> <chr>
#> 1 2022-12-05 -6 20 inc co… quantile 0.01 22 UMass-ar
#> 2 2022-12-05 -6 20 inc co… quantile 0.025 24 UMass-ar
#> 3 2022-12-05 -6 20 inc co… quantile 0.05 26 UMass-ar
#> 4 2022-12-05 -6 20 inc co… quantile 0.1 28 UMass-ar
#> 5 2022-12-05 -6 20 inc co… quantile 0.15 30 UMass-ar
#> 6 2022-12-05 -6 20 inc co… quantile 0.2 32 UMass-ar

target_data <- read.csv("target-data/covid-hospitalizations.csv")
head(target_data)
#> time_idx location value target
#> 1 2021-03-21 46 12 inc covid hosp
#> 2 2021-03-04 45 82 inc covid hosp
#> 3 2021-02-26 46 7 inc covid hosp
#> 4 2021-02-20 44 21 inc covid hosp
#> 5 2021-02-09 44 19 inc covid hosp
#> 6 2021-01-25 25 224 inc covid hosp
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
"task_ids": {
"origin_date": {
"required": null,
"optional": ["2023-06-05", "2023-06-06", "2023-06-07", "2023-06-08", "2023-06-09", "2023-06-10"]
"optional": ["2022-11-28", "2022-12-05", "2022-12-12"]
},
"target": {
"required": ["inc flu hosp"],
"required": ["inc covid hosp"],
"optional": null
},
"horizon": {
"required": null,
"optional": [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
"optional": [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
},
"location": {
"required": null,
Expand Down Expand Up @@ -121,33 +121,20 @@
"type": "integer",
"minimum": 0
}
},
"target_metadata": [
{
"target_id": "inc flu hosp",
"target_name": "daily incident influenza hospitalizations",
"target_units": "count",
"target_keys": {
"target": ["inc flu hosp"]
},
"description": "This target represents a count of the number of new hospitalizations per day in a given location.",
"is_step_ahead": true,
"time_unit": "day"
}
]
}
},
"target_metadata": [
{
"target_id": "inc flu hosp",
"target_name": "Incident influenza hospitalizations",
"target_id": "inc covid hosp",
"target_name": "Daily incident COVID hospitalizations",
"target_units": "count",
"target_keys": {
"target": "inc flu hosp"
"target": "inc covid hosp"
},
"description": "Weekly newly reported hospitalizations where the patient has influenza, as reported by hospital facilities and aggregated in the HHS Protect data collection system.",
"description": "Daily newly reported hospitalizations where the patient has COVID, as reported by hospital facilities and aggregated in the HHS Protect data collection system.",
"target_type": "discrete",
"is_step_ahead": true,
"time_unit": "week"
"time_unit": "day"
}
]
}],
Expand All @@ -157,6 +144,5 @@
"end": 1
}
}

]
}
Loading

0 comments on commit 5a6d92c

Please sign in to comment.