From a7f1b321bc97c932cab9de1eab4942185f8d7d22 Mon Sep 17 00:00:00 2001 From: Anna Krystalli Date: Fri, 22 Nov 2024 09:48:49 +0200 Subject: [PATCH] Rename get_derived_task_ids to get_hub_derived_task_ids. Resolves #169 --- NAMESPACE | 2 +- R/check_tbl_spl_compound_taskid_set.R | 4 ++-- R/check_tbl_spl_compound_tid.R | 2 +- R/check_tbl_spl_n.R | 2 +- R/check_tbl_spl_non_compound_tid.R | 2 +- R/check_tbl_value_col.R | 2 +- R/check_tbl_values.R | 2 +- R/check_tbl_values_required.R | 2 +- R/imports-hubUtils.R | 2 +- R/validate_model_data.R | 4 ++-- man/check_tbl_spl_compound_taskid_set.Rd | 4 ++-- man/check_tbl_spl_compound_tid.Rd | 4 ++-- man/check_tbl_spl_n.Rd | 4 ++-- man/check_tbl_spl_non_compound_tid.Rd | 4 ++-- man/check_tbl_value_col.Rd | 4 ++-- man/check_tbl_values.Rd | 4 ++-- man/check_tbl_values_required.Rd | 4 ++-- man/validate_model_data.Rd | 2 +- man/validate_pr.Rd | 2 +- man/validate_submission.Rd | 2 +- tests/testthat/_snaps/expand_model_out_grid.md | 2 +- tests/testthat/test-expand_model_out_grid.R | 2 +- 22 files changed, 31 insertions(+), 31 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index b5254704..b9709e7e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -78,7 +78,7 @@ importFrom(dplyr,"%>%") importFrom(hubAdmin,validate_hub_config) importFrom(hubData,coerce_to_hub_schema) importFrom(hubData,create_hub_schema) -importFrom(hubUtils,get_derived_task_ids) +importFrom(hubUtils,get_hub_derived_task_ids) importFrom(hubUtils,get_hub_file_formats) importFrom(hubUtils,get_hub_model_output_dir) importFrom(hubUtils,get_hub_timezone) diff --git a/R/check_tbl_spl_compound_taskid_set.R b/R/check_tbl_spl_compound_taskid_set.R index ba1409bd..3e425238 100644 --- a/R/check_tbl_spl_compound_taskid_set.R +++ b/R/check_tbl_spl_compound_taskid_set.R @@ -11,7 +11,7 @@ #' @param derived_task_ids Character vector of derived task ID names (task IDs whose #' values depend on other task IDs) to ignore. Columns for such task ids will #' contain `NA`s. Defaults to extracting derived task IDs from hub `task.json`. See -#' [get_derived_task_ids()] for more details. +#' [get_hub_derived_task_ids()] for more details. #' @inheritParams expand_model_out_grid #' @details If the check fails, the output of the check includes an `errors` element, #' a list of items, one for each modeling task failing validation. @@ -38,7 +38,7 @@ #' @export check_tbl_spl_compound_taskid_set <- function( tbl, round_id, file_path, hub_path, - derived_task_ids = get_derived_task_ids(hub_path)) { + derived_task_ids = get_hub_derived_task_ids(hub_path)) { config_tasks <- read_config(hub_path, "tasks") if (isFALSE(has_spls_tbl(tbl)) || isFALSE(hubUtils::is_v3_config(config_tasks))) { diff --git a/R/check_tbl_spl_compound_tid.R b/R/check_tbl_spl_compound_tid.R index 7535197d..30ad266c 100644 --- a/R/check_tbl_spl_compound_tid.R +++ b/R/check_tbl_spl_compound_tid.R @@ -20,7 +20,7 @@ #' @export check_tbl_spl_compound_tid <- function(tbl, round_id, file_path, hub_path, compound_taskid_set = NULL, - derived_task_ids = get_derived_task_ids(hub_path, round_id)) { + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id)) { if (!is.null(compound_taskid_set) && isTRUE(is.na(compound_taskid_set))) { cli::cli_abort("Valid {.var compound_taskid_set} must be provided.") } diff --git a/R/check_tbl_spl_n.R b/R/check_tbl_spl_n.R index 1798490b..ffdc1168 100644 --- a/R/check_tbl_spl_n.R +++ b/R/check_tbl_spl_n.R @@ -17,7 +17,7 @@ #' @export check_tbl_spl_n <- function(tbl, round_id, file_path, hub_path, compound_taskid_set = NULL, - derived_task_ids = get_derived_task_ids(hub_path, round_id)) { + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id)) { if (!is.null(compound_taskid_set) && isTRUE(is.na(compound_taskid_set))) { cli::cli_abort("Valid {.var compound_taskid_set} must be provided.") } diff --git a/R/check_tbl_spl_non_compound_tid.R b/R/check_tbl_spl_non_compound_tid.R index 447d72f7..c8eb46d2 100644 --- a/R/check_tbl_spl_non_compound_tid.R +++ b/R/check_tbl_spl_non_compound_tid.R @@ -18,7 +18,7 @@ #' @export check_tbl_spl_non_compound_tid <- function(tbl, round_id, file_path, hub_path, compound_taskid_set = NULL, - derived_task_ids = get_derived_task_ids(hub_path, round_id)) { + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id)) { if (!is.null(compound_taskid_set) && isTRUE(is.na(compound_taskid_set))) { cli::cli_abort("Valid {.var compound_taskid_set} must be provided.") } diff --git a/R/check_tbl_value_col.R b/R/check_tbl_value_col.R index df3062a2..69b9f0fc 100644 --- a/R/check_tbl_value_col.R +++ b/R/check_tbl_value_col.R @@ -9,7 +9,7 @@ #' @inheritParams expand_model_out_grid #' @export check_tbl_value_col <- function(tbl, round_id, file_path, hub_path, - derived_task_ids = get_derived_task_ids(hub_path, round_id)) { + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id)) { config_tasks <- read_config(hub_path, "tasks") tbl[, names(tbl) != "value"] <- hubData::coerce_to_character( diff --git a/R/check_tbl_values.R b/R/check_tbl_values.R index 35e7f3bc..bf596f09 100644 --- a/R/check_tbl_values.R +++ b/R/check_tbl_values.R @@ -6,7 +6,7 @@ #' @inherit check_tbl_colnames return #' @export check_tbl_values <- function(tbl, round_id, file_path, hub_path, - derived_task_ids = get_derived_task_ids(hub_path, round_id)) { + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id)) { config_tasks <- read_config(hub_path, "tasks") valid_tbl <- tbl %>% diff --git a/R/check_tbl_values_required.R b/R/check_tbl_values_required.R index a08c11d5..9e360cac 100644 --- a/R/check_tbl_values_required.R +++ b/R/check_tbl_values_required.R @@ -12,7 +12,7 @@ #' task ID values will result in **false validation errors when validating #' required values**. check_tbl_values_required <- function(tbl, round_id, file_path, hub_path, - derived_task_ids = get_derived_task_ids(hub_path)) { + derived_task_ids = get_hub_derived_task_ids(hub_path)) { tbl[["value"]] <- NULL config_tasks <- read_config(hub_path, "tasks") diff --git a/R/imports-hubUtils.R b/R/imports-hubUtils.R index 3c0b2865..17e549b8 100644 --- a/R/imports-hubUtils.R +++ b/R/imports-hubUtils.R @@ -7,5 +7,5 @@ NULL #' @importFrom hubUtils get_hub_model_output_dir NULL -#' @importFrom hubUtils get_derived_task_ids +#' @importFrom hubUtils get_hub_derived_task_ids NULL diff --git a/R/validate_model_data.R b/R/validate_model_data.R index 14ff333d..6a3ab062 100644 --- a/R/validate_model_data.R +++ b/R/validate_model_data.R @@ -4,7 +4,7 @@ #' values depend on other task IDs) to ignore. Columns for such task ids will #' contain `NA`s. #' If `NULL`, defaults to extracting derived task IDs from hub `task.json`. See -#' [get_derived_task_ids()] for more details. +#' [get_hub_derived_task_ids()] for more details. #' @inheritParams check_tbl_unique_round_id #' @inheritParams validate_model_file #' @inheritParams hubData::create_hub_schema @@ -118,7 +118,7 @@ validate_model_data <- function(hub_path, file_path, round_id_col = NULL, # Get derived task IDs if not specified if (is.null(derived_task_ids)) { - derived_task_ids <- get_derived_task_ids( + derived_task_ids <- get_hub_derived_task_ids( hub_path, round_id ) } else { diff --git a/man/check_tbl_spl_compound_taskid_set.Rd b/man/check_tbl_spl_compound_taskid_set.Rd index 091385a2..1561540c 100644 --- a/man/check_tbl_spl_compound_taskid_set.Rd +++ b/man/check_tbl_spl_compound_taskid_set.Rd @@ -10,7 +10,7 @@ check_tbl_spl_compound_taskid_set( round_id, file_path, hub_path, - derived_task_ids = get_derived_task_ids(hub_path) + derived_task_ids = get_hub_derived_task_ids(hub_path) ) } \arguments{ @@ -35,7 +35,7 @@ files within the \code{hub-config} directory.} \item{derived_task_ids}{Character vector of derived task ID names (task IDs whose values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. Defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ Depending on whether validation has succeeded, one of: diff --git a/man/check_tbl_spl_compound_tid.Rd b/man/check_tbl_spl_compound_tid.Rd index 3e561870..cb7382f4 100644 --- a/man/check_tbl_spl_compound_tid.Rd +++ b/man/check_tbl_spl_compound_tid.Rd @@ -11,7 +11,7 @@ check_tbl_spl_compound_tid( file_path, hub_path, compound_taskid_set = NULL, - derived_task_ids = get_derived_task_ids(hub_path, round_id) + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id) ) } \arguments{ @@ -39,7 +39,7 @@ for example, when validating coarser samples.} \item{derived_task_ids}{Character vector of derived task ID names (task IDs whose values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. Defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ Depending on whether validation has succeeded, one of: diff --git a/man/check_tbl_spl_n.Rd b/man/check_tbl_spl_n.Rd index 23ad24c9..e5533bb2 100644 --- a/man/check_tbl_spl_n.Rd +++ b/man/check_tbl_spl_n.Rd @@ -11,7 +11,7 @@ check_tbl_spl_n( file_path, hub_path, compound_taskid_set = NULL, - derived_task_ids = get_derived_task_ids(hub_path, round_id) + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id) ) } \arguments{ @@ -39,7 +39,7 @@ for example, when validating coarser samples.} \item{derived_task_ids}{Character vector of derived task ID names (task IDs whose values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. Defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ Depending on whether validation has succeeded, one of: diff --git a/man/check_tbl_spl_non_compound_tid.Rd b/man/check_tbl_spl_non_compound_tid.Rd index b9dce41b..8c2ef45f 100644 --- a/man/check_tbl_spl_non_compound_tid.Rd +++ b/man/check_tbl_spl_non_compound_tid.Rd @@ -11,7 +11,7 @@ check_tbl_spl_non_compound_tid( file_path, hub_path, compound_taskid_set = NULL, - derived_task_ids = get_derived_task_ids(hub_path, round_id) + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id) ) } \arguments{ @@ -39,7 +39,7 @@ for example, when validating coarser samples.} \item{derived_task_ids}{Character vector of derived task ID names (task IDs whose values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. Defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ Depending on whether validation has succeeded, one of: diff --git a/man/check_tbl_value_col.Rd b/man/check_tbl_value_col.Rd index 1f7e5861..3bd0f201 100644 --- a/man/check_tbl_value_col.Rd +++ b/man/check_tbl_value_col.Rd @@ -9,7 +9,7 @@ check_tbl_value_col( round_id, file_path, hub_path, - derived_task_ids = get_derived_task_ids(hub_path, round_id) + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id) ) } \arguments{ @@ -33,7 +33,7 @@ files within the \code{hub-config} directory.} \item{derived_task_ids}{Character vector of derived task ID names (task IDs whose values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. Defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ Depending on whether validation has succeeded, one of: diff --git a/man/check_tbl_values.Rd b/man/check_tbl_values.Rd index dba0d72a..860195b1 100644 --- a/man/check_tbl_values.Rd +++ b/man/check_tbl_values.Rd @@ -9,7 +9,7 @@ check_tbl_values( round_id, file_path, hub_path, - derived_task_ids = get_derived_task_ids(hub_path, round_id) + derived_task_ids = get_hub_derived_task_ids(hub_path, round_id) ) } \arguments{ @@ -33,7 +33,7 @@ files within the \code{hub-config} directory.} \item{derived_task_ids}{Character vector of derived task ID names (task IDs whose values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. Defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ Depending on whether validation has succeeded, one of: diff --git a/man/check_tbl_values_required.Rd b/man/check_tbl_values_required.Rd index 160c2272..d89254ef 100644 --- a/man/check_tbl_values_required.Rd +++ b/man/check_tbl_values_required.Rd @@ -10,7 +10,7 @@ check_tbl_values_required( round_id, file_path, hub_path, - derived_task_ids = get_derived_task_ids(hub_path) + derived_task_ids = get_hub_derived_task_ids(hub_path) ) } \arguments{ @@ -34,7 +34,7 @@ files within the \code{hub-config} directory.} \item{derived_task_ids}{Character vector of derived task ID names (task IDs whose values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. Defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ Depending on whether validation has succeeded, one of: diff --git a/man/validate_model_data.Rd b/man/validate_model_data.Rd index dbdb2ec3..58003cf9 100644 --- a/man/validate_model_data.Rd +++ b/man/validate_model_data.Rd @@ -56,7 +56,7 @@ defaults to \code{hub-config/validations.yml}.} values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. If \code{NULL}, defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ An object of class \code{hub_validations}. Each named element contains diff --git a/man/validate_pr.Rd b/man/validate_pr.Rd index a97547a3..7565a163 100644 --- a/man/validate_pr.Rd +++ b/man/validate_pr.Rd @@ -90,7 +90,7 @@ provided in the hub's config.} values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. If \code{NULL}, defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ An object of class \code{hub_validations}. diff --git a/man/validate_submission.Rd b/man/validate_submission.Rd index 453e466e..70c28b7e 100644 --- a/man/validate_submission.Rd +++ b/man/validate_submission.Rd @@ -73,7 +73,7 @@ provided in the hub's config.} values depend on other task IDs) to ignore. Columns for such task ids will contain \code{NA}s. If \code{NULL}, defaults to extracting derived task IDs from hub \code{task.json}. See -\code{\link[=get_derived_task_ids]{get_derived_task_ids()}} for more details.} +\code{\link[=get_hub_derived_task_ids]{get_hub_derived_task_ids()}} for more details.} } \value{ An object of class \code{hub_validations}. Each named element contains diff --git a/tests/testthat/_snaps/expand_model_out_grid.md b/tests/testthat/_snaps/expand_model_out_grid.md index bc99a41a..6ecf9679 100644 --- a/tests/testthat/_snaps/expand_model_out_grid.md +++ b/tests/testthat/_snaps/expand_model_out_grid.md @@ -890,7 +890,7 @@ Code suppressWarnings(expand_model_out_grid(config_tasks = config_tasks, round_id = round_id, - output_types = "pmf", derived_task_ids = get_derived_task_ids(hub_path))) + output_types = "pmf", derived_task_ids = get_hub_derived_task_ids(hub_path))) Output # A tibble: 540 x 7 forecast_date target horizon target_date location output_type output_type_id diff --git a/tests/testthat/test-expand_model_out_grid.R b/tests/testthat/test-expand_model_out_grid.R index 25a8fdcd..b7296255 100644 --- a/tests/testthat/test-expand_model_out_grid.R +++ b/tests/testthat/test-expand_model_out_grid.R @@ -745,7 +745,7 @@ test_that("v4 required output type ID values extracted correctly", { config_tasks = config_tasks, round_id = round_id, output_types = "pmf", - derived_task_ids = get_derived_task_ids(hub_path) + derived_task_ids = get_hub_derived_task_ids(hub_path) ) ) )