load_forecasts_local_zoltar: Load all available forecasts submitted on 'forecast_dates'...

View source: R/load_forecasts_local_zoltar.R

load_forecasts_local_zoltarR Documentation

Load all available forecasts submitted on forecast_dates from local Zoltar module.

Description

Please follow instructions to set up required environment prior to using this function for the first time See http://reichlab.io/covidHubUtils/articles/covidHubUtils-zoltar_sqlite_setup.htmlvignette for more details.

Usage

load_forecasts_local_zoltar(
  models = NULL,
  forecast_dates = NULL,
  locations = NULL,
  types = NULL,
  targets = NULL,
  as_of = NULL,
  hub = c("US", "ECDC"),
  verbose = TRUE,
  local_zoltpy_path,
  zoltar_sqlite_file
)

Arguments

models

Character vector of model abbreviations. Default all models that submitted forecasts meeting the other criteria.

forecast_dates

A 2 dimensional list of forecast dates to retrieve forecasts. This function will return the latest forecasts for each sub-list of dates. Default to NULL which would include all valid forecast dates in Zoltar.

locations

a vector of strings of fips code or CBSA codes or location names, such as "Hampshire County, MA", "Alabama", "United Kingdom". A US county location names must include state abbreviation. Default to NULL which would include all locations with available forecasts in zoltar_sqlite_file.

types

Character vector specifying type of forecasts to load: "quantile" and/or "point". Default to all valid forecast types in Zoltar.

targets

character vector of targets to retrieve, for example c('1 wk ahead cum death', '2 wk ahead cum death'). Default to all valid targets in Zoltar.

as_of

character for date time to load forecasts submitted as of this time. It could use the format of one of the three examples: ⁠"2021-01-01", "2020-01-01 01:01:01" and "2020-01-01 01:01:01 UTC".⁠ If you would like to set a timezone, it has to be UTC now. If not, helper function will append the default timezone to your input based on hub parameter. Default to NULL to load the latest version.

hub

character vector, where the first element indicates the hub from which to load forecasts. Possible options are "US" and "ECDC".

verbose

logical for printing messages on zoltar job status. Default to TRUE.

local_zoltpy_path

path to local clone of zolpy repository.

zoltar_sqlite_file

an absolute path to local sqlite file.

Details

  • This function will throw an error when no forecasts are submitted on any dates in forecast_dates for selected models, locations, types and target.

  • By default. test-load_forecasts_local_zoltar() is skipped. Please modify local_zoltpy_path and zoltar_sqlite_file on top of the unit test file to run tests.

Value

data.frame with columns model, forecast_date, location, horizon, temporal_resolution, target_variable, target_end_date, type, quantile, value, location_name, population, geo_type, geo_value, abbreviation


reichlab/covidHubUtils documentation built on Feb. 6, 2024, 1:42 p.m.