Skip to content

Commit

Permalink
Merge pull request #74 from Infectious-Disease-Modeling-Hubs/split-hu…
Browse files Browse the repository at this point in the history
…butils

Split hubutils - Release v0.0.1
  • Loading branch information
annakrystalli authored Mar 6, 2024
2 parents 2eb6b10 + 7f6dc2a commit e6aaba6
Show file tree
Hide file tree
Showing 52 changed files with 109 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
extra-packages: any::rcmdcheck, any::tzdb
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
14 changes: 9 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hubValidations
Title: Testing framework for hubverse hub validations
Version: 0.0.0.9008
Version: 0.0.1
Authors@R: c(
person(
given = "Anna",
Expand Down Expand Up @@ -37,7 +37,9 @@ Imports:
dplyr,
fs,
gh,
hubUtils (>= 0.0.0.9016),
hubAdmin,
hubData,
hubUtils (>= 0.0.1),
jsonlite,
jsonvalidate,
lubridate,
Expand All @@ -58,13 +60,15 @@ Suggests:
testthis,
withr
Remotes:
Infectious-Disease-Modeling-Hubs/hubUtils,
Infectious-Disease-Modeling-Hubs/hubUtils#143,
Infectious-Disease-Modeling-Hubs/hubData#1,
Infectious-Disease-Modeling-Hubs/hubAdmin#1,
assignUser/octolog
Config/testthat/edition: 3
Config/Needs/website:pkgdown, Infectious-Disease-Modeling-Hubs/hubStyle
Config/Needs/website: pkgdown, Infectious-Disease-Modeling-Hubs/hubStyle
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
URL: https://github.com/Infectious-Disease-Modeling-Hubs/hubValidations,
https://infectious-disease-modeling-hubs.github.io/hubValidations/
BugReports: https://github.com/Infectious-Disease-Modeling-Hubs/hubValidations/issues
Expand Down
2 changes: 1 addition & 1 deletion R/check_config_hub_valid.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#'
#' @export
check_config_hub_valid <- function(hub_path) {
valid_config <- hubUtils::validate_hub_config(hub_path) %>%
valid_config <- hubAdmin::validate_hub_config(hub_path) %>%
suppressMessages() %>%
suppressWarnings()

Expand Down
2 changes: 1 addition & 1 deletion R/check_metadata_file_exists.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' @param file_path character string. Path to the file being validated relative to
#' the hub's model-metadata directory.
#' @inheritParams hubUtils::connect_hub
#' @inheritParams hubData::connect_hub
#'
#' @inherit check_valid_round_id return
#'
Expand Down
2 changes: 1 addition & 1 deletion R/check_tbl_col_types.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
check_tbl_col_types <- function(tbl, file_path, hub_path) {
config_tasks <- hubUtils::read_config(hub_path, "tasks")

schema <- hubUtils::create_hub_schema(config_tasks,
schema <- hubData::create_hub_schema(config_tasks,
partitions = NULL,
r_schema = TRUE
)[names(tbl)]
Expand Down
2 changes: 1 addition & 1 deletion R/check_tbl_colnames.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @param round_id character string. The round identifier.
#' @param file_path character string. Path to the file being validated relative to
#' the hub's model-output directory.
#' @inheritParams hubUtils::connect_hub
#' @inheritParams hubData::connect_hub
#' @return
#' Depending on whether validation has succeeded, one of:
#' - `<message/check_success>` condition class object.
Expand Down
4 changes: 2 additions & 2 deletions R/check_tbl_value_col.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
check_tbl_value_col <- function(tbl, round_id, file_path, hub_path) {
config_tasks <- hubUtils::read_config(hub_path, "tasks")

tbl[, names(tbl) != "value"] <- hubUtils::coerce_to_character(
tbl[, names(tbl) != "value"] <- hubData::coerce_to_character(
tbl[, names(tbl) != "value"]
)

full <- hubUtils::expand_model_out_val_grid(
full <- hubData::expand_model_out_val_grid(
config_tasks,
round_id = round_id,
required_vals_only = FALSE,
Expand Down
2 changes: 1 addition & 1 deletion R/check_tbl_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ check_tbl_values <- function(tbl, round_id, file_path, hub_path) {
# working with larger files but currently arrow does not match NAs as dplyr
# does, returning false positives for mean & median rows which contain NA in
# output type ID column.
accepted_vals <- hubUtils::expand_model_out_val_grid(
accepted_vals <- hubData::expand_model_out_val_grid(
config_tasks = config_tasks,
round_id = round_id,
all_character = TRUE
Expand Down
6 changes: 3 additions & 3 deletions R/check_tbl_values_required.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
check_tbl_values_required <- function(tbl, round_id, file_path, hub_path) {
tbl[["value"]] <- NULL
config_tasks <- hubUtils::read_config(hub_path, "tasks")
req <- hubUtils::expand_model_out_val_grid(
req <- hubData::expand_model_out_val_grid(
config_tasks,
round_id = round_id,
required_vals_only = TRUE,
all_character = TRUE,
bind_model_tasks = FALSE
)

full <- hubUtils::expand_model_out_val_grid(
full <- hubData::expand_model_out_val_grid(
config_tasks,
round_id = round_id,
required_vals_only = FALSE,
Expand All @@ -41,7 +41,7 @@ check_tbl_values_required <- function(tbl, round_id, file_path, hub_path) {
if (check) {
details <- NULL
} else {
missing_df <- hubUtils::coerce_to_hub_schema(missing_df, config_tasks)
missing_df <- hubData::coerce_to_hub_schema(missing_df, config_tasks)
details <- cli::format_inline("See {.var missing} attribute for details.")
}

Expand Down
5 changes: 0 additions & 5 deletions R/hub_validations_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ validate_internal_class <- function(x, class = c(
invisible(TRUE)
}

summary.hub_validations <- function(x, ...) {
# TODO
NULL
}

# TODO: Code to consider implementing more hierarchical printing of messages.
# Currently not implemented as pr_hub_validations class not implemented.
#' Print results of `validate_pr()` function as a bullet list
Expand Down
2 changes: 1 addition & 1 deletion R/opt_check_metadata_team_max_model_n.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ opt_check_metadata_team_max_model_n <- function(file_path, hub_path, n_max = 2L)
file_path,
file_type = "model_metadata"
)$team_abbr
all_model_meta <- hubUtils::load_model_metadata(hub_path)
all_model_meta <- hubData::load_model_metadata(hub_path)

team_models <- all_model_meta[["model_abbr"]][all_model_meta[["team_abbr"]] == team_abbr]
n_models <- length(team_models)
Expand Down
2 changes: 1 addition & 1 deletion R/opt_check_tbl_col_timediff.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ opt_check_tbl_col_timediff <- function(tbl, file_path, hub_path,
checkmate::assert_choice(t1_colname, choices = names(tbl))

config_tasks <- hubUtils::read_config(hub_path, "tasks")
schema <- hubUtils::create_hub_schema(config_tasks,
schema <- hubData::create_hub_schema(config_tasks,
partitions = NULL,
r_schema = TRUE
)
Expand Down
2 changes: 1 addition & 1 deletion R/opt_check_tbl_horizon_timediff.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ opt_check_tbl_horizon_timediff <- function(tbl, file_path, hub_path, t0_colname,
checkmate::assert_choice(horizon_colname, choices = names(tbl))

config_tasks <- hubUtils::read_config(hub_path, "tasks")
schema <- hubUtils::create_hub_schema(config_tasks,
schema <- hubData::create_hub_schema(config_tasks,
partitions = NULL,
r_schema = TRUE
)
Expand Down
10 changes: 5 additions & 5 deletions R/read_model_out_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ read_model_out_file <- function(file_path, hub_path = ".",
parquet = {
if (coerce_types == "hub") {
arrow::read_parquet(full_path) %>%
hubUtils::coerce_to_hub_schema(
hubData::coerce_to_hub_schema(
config_tasks = hubUtils::read_config(hub_path, "tasks")
)
} else if (coerce_types == "chr") {
arrow::read_parquet(full_path) %>%
hubUtils::coerce_to_character()
hubData::coerce_to_character()
} else {
arrow::read_parquet(full_path)
}
},
arrow = {
if (coerce_types == "hub") {
arrow::read_feather(full_path) %>%
hubUtils::coerce_to_hub_schema(
hubData::coerce_to_hub_schema(
config_tasks = hubUtils::read_config(hub_path, "tasks")
)
} else if (coerce_types == "chr") {
arrow::read_feather(full_path) %>%
hubUtils::coerce_to_character()
hubData::coerce_to_character()
} else {
arrow::read_feather(full_path)
}
Expand All @@ -72,7 +72,7 @@ read_model_out_file <- function(file_path, hub_path = ".",
create_model_out_schema <- function(hub_path,
col_types = c("hub", "chr")) {
col_types <- rlang::arg_match(col_types)
schema <- hubUtils::create_hub_schema(
schema <- hubData::create_hub_schema(
config_tasks = hubUtils::read_config(hub_path, "tasks"),
partitions = NULL
)
Expand Down
4 changes: 2 additions & 2 deletions man/check_config_hub_valid.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_file_exists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_file_format.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_file_read.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_metadata_file_exists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_metadata_file_name.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_metadata_matches_schema.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_metadata_schema_exists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_submission_metadata_file_exists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_submission_time.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_tbl_col_types.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_tbl_colnames.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_tbl_match_round_id.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_tbl_rows_unique.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_tbl_unique_round_id.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/check_tbl_value_col.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e6aaba6

Please sign in to comment.