Skip to contents

This function reads target data from the hub's time-series file using hubData, filters to the latest vintage and specified targets, and writes it to the weekly-summaries directory for use by the visualization webpage. Output includes columns: week_ending_date, location, location_name, target, and value.

Usage

write_viz_target_data(
  reference_date,
  base_hub_path,
  hub_reports_path,
  disease,
  as_of = "latest",
  targets = NULL,
  included_locations = hubhelpr::included_locations,
  output_format = "csv"
)

Arguments

reference_date

Character, the reference date for the forecast in YYYY-MM-DD format (ISO-8601).

base_hub_path

Character, path to the forecast hub directory.

hub_reports_path

Character, path to forecast hub reports directory.

disease

Character, disease name ("covid" or "rsv").

as_of

As of date to filter to, as an object coercible by as.Date(), or "latest" to filter to the most recent available vintage. Default "latest".

targets

Character vector of target names to filter (e.g., "wk inc covid hosp"). If NULL (default), all targets are included.

included_locations

Character vector of location codes to include in the output. Default hubhelpr::included_locations.

output_format

Character, output file format. One of "csv", "tsv", or "parquet". Default: "csv".

Value

Invisibly returns file path where data was written.