Skip to contents

Create a representation of a target_metadata item as a list object of class target_metadata_item. This can be combined with additional target_metadata items using function create_target_metadata() to create a target_metadata object for a given model_task. Such building blocks can ultimately be combined and then written out as or appended to tasks.json Hub config files.

Usage

create_target_metadata_item(
  target_id,
  target_name,
  target_units,
  target_keys = NULL,
  description = NULL,
  target_type,
  is_step_ahead,
  time_unit = NULL,
  schema_version = "latest",
  branch = "main"
)

Arguments

target_id

character string. Short description that uniquely identifies the target.

target_name

character string. A longer human readable target description that could be used, for example, as a visualisation axis label.

target_units

character string. Unit of observation of the target.

target_keys

named list or NULL. Should be NULL, in the case where the target is not specified as a task_id but is specified solely through the target_id argument. Otherwise, should be a named list of one or more character strings. The name of each element should match a task_id variable within the same model_tasks object. Each element should be of length 1. Each value, or the combination of values if multiple keys are specified, define a single target value.

description

character string (optional). An optional verbose description of the target that might include information such as definitions of a 'rate' or similar.

target_type

character string. Target statistical data type. Consult the appropriate version of the hub schema for potential values.

is_step_ahead

logical. Whether the target is part of a sequence of values

time_unit

character string. If is_step_ahead is TRUE, then this argument is required and defines the unit of time steps. if is_step_ahead is FALSE, then this argument is not required and will be ignored if given.

schema_version

Character string specifying the json schema version to be used for validation. The default value "latest" will use the latest version available in the Infectious Disease Modeling Hubs schemas repository. Alternatively, a specific version of a schema (e.g. "v0.0.1") can be specified.

branch

The branch of the Infectious Disease Modeling Hubs schemas repository from which to fetch schema. Defaults to "main".

Value

a named list of class target_metadata_item.

Details

For more details consult the documentation on tasks.json Hub config files.

Examples

create_target_metadata_item(
  target_id = "inc hosp",
  target_name = "Weekly incident influenza hospitalizations",
  target_units = "rate per 100,000 population",
  target_keys = list(target = "inc hosp"),
  target_type = "discrete",
  is_step_ahead = TRUE,
  time_unit = "week"
)
#> $target_id
#> [1] "inc hosp"
#> 
#> $target_name
#> [1] "Weekly incident influenza hospitalizations"
#> 
#> $target_units
#> [1] "rate per 100,000 population"
#> 
#> $target_keys
#> $target_keys$target
#> [1] "inc hosp"
#> 
#> 
#> $target_type
#> [1] "discrete"
#> 
#> $is_step_ahead
#> [1] TRUE
#> 
#> $time_unit
#> [1] "week"
#> 
#> attr(,"class")
#> [1] "target_metadata_item" "list"                
#> attr(,"schema_id")
#> [1] "https://raw.githubusercontent.com/Infectious-Disease-Modeling-Hubs/schemas/main/v2.0.1/tasks-schema.json"