Skip to content

Commit

Permalink
Rename JoinKeys class to join_keys from upstream {teal.data} (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo authored Nov 8, 2023
1 parent ed7aa88 commit dd6a003
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions R/data_extract_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ data_extract_srv.FilteredData <- function(id, datasets, data_extract_spec, ...)
}

#' @rdname data_extract_srv
#' @param join_keys (`JoinKeys` or `NULL`) of keys per dataset in `datasets`
#' @param join_keys (`join_keys` or `NULL`) of keys per dataset in `datasets`
#' @param select_validation_rule (`NULL` or `function`)
#' Should there be any `shinyvalidate` input validation of the select parts of the `data_extract_ui`.
#' You can use a validation function directly (i.e. `select_validation_rule = shinyvalidate::sv_required()`)
Expand All @@ -443,7 +443,7 @@ data_extract_srv.list <- function(id, datasets, data_extract_spec, join_keys = N
},
...) {
checkmate::assert_list(datasets, types = c("reactive", "data.frame"), names = "named")
checkmate::assert_class(join_keys, "JoinKeys", null.ok = TRUE)
checkmate::assert_class(join_keys, "join_keys", null.ok = TRUE)
checkmate::assert_multi_class(select_validation_rule, classes = c("function", "formula"), null.ok = TRUE)
checkmate::assert_multi_class(filter_validation_rule, classes = c("function", "formula"), null.ok = TRUE)
checkmate::assert_multi_class(dataset_validation_rule, classes = c("function", "formula"), null.ok = TRUE)
Expand Down Expand Up @@ -681,7 +681,7 @@ data_extract_multiple_srv.FilteredData <- function(data_extract, datasets, ...)
}

#' @rdname data_extract_multiple_srv
#' @param join_keys (`JoinKeys` or `NULL`) of join keys per dataset in `datasets`.
#' @param join_keys (`join_keys` or `NULL`) of join keys per dataset in `datasets`.
#' @param select_validation_rule (`NULL`, `function` or `named list` of `function`)
#' Should there be any `shinyvalidate` input validation of the select parts of the `data_extract_ui`
#' If all `data_extract` require the same validation function then this can be used directly (
Expand All @@ -702,7 +702,7 @@ data_extract_multiple_srv.list <- function(data_extract, datasets, join_keys = N
shinyvalidate::sv_required("Please select a dataset")
}, ...) {
checkmate::assert_list(datasets, types = c("reactive", "data.frame"), names = "named")
checkmate::assert_class(join_keys, "JoinKeys", null.ok = TRUE)
checkmate::assert_class(join_keys, "join_keys", null.ok = TRUE)
checkmate::assert(
checkmate::check_multi_class(select_validation_rule, classes = c("function", "formula"), null.ok = TRUE),
checkmate::check_list(select_validation_rule, types = c("function", "formula", "NULL"), null.ok = TRUE)
Expand Down
4 changes: 2 additions & 2 deletions R/get_dplyr_call.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @keywords internal
get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys()) {
logger::log_trace("get_dplyr_call_data called with: { paste(names(selector_list), collapse = ', ') } selectors.")
checkmate::assert_class(join_keys, "JoinKeys")
checkmate::assert_class(join_keys, "join_keys")
lapply(selector_list, check_selector)

all_merge_key_list <- get_merge_key_grid(selector_list, join_keys)
Expand Down Expand Up @@ -211,7 +211,7 @@ get_dplyr_call <- function(selector_list,
)
)
lapply(selector_list, check_selector)
checkmate::assert_class(join_keys, "JoinKeys", null.ok = TRUE)
checkmate::assert_class(join_keys, "join_keys", null.ok = TRUE)
checkmate::assert_integer(idx, len = 1, any.missing = FALSE)

n_selectors <- length(selector_list)
Expand Down
2 changes: 1 addition & 1 deletion R/get_merge_call.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' Returns list of calls depending on selector(s) and type of the merge
#' Order of merge is the same as in selectors passed to the function.
#' @inheritParams merge_datasets
#' @param join_keys (`JoinKeys`) nested list of keys used for joining
#' @param join_keys (`join_keys`) nested list of keys used for joining
#' @param dplyr_call_data (`list`) simplified selectors with aggregated set of filters,
#'
#' @return (`list` with `call` elements)
Expand Down
4 changes: 2 additions & 2 deletions R/merge_datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function =
checkmate::assert_list(selector_list, min.len = 1)
checkmate::assert_string(anl_name)
checkmate::assert_list(datasets, names = "named")
checkmate::assert_class(join_keys, "JoinKeys")
checkmate::assert_class(join_keys, "join_keys")
stopifnot(attr(regexec("[A-Za-z0-9\\_]*", anl_name)[[1]], "match.length") == nchar(anl_name))
lapply(selector_list, check_selector)
merge_selectors_out <- merge_selectors(selector_list)
Expand Down Expand Up @@ -241,7 +241,7 @@ check_data_merge_selectors <- function(selector_list) {
#' `merged_selector_list` come from datasets, which don't have the
#' appropriate join keys in `join_keys`.
#'
#' @param join_keys (`JoinKeys`) the provided join keys
#' @param join_keys (`join_keys`) the provided join keys
#' @param merged_selector_list (`list`) the specification of datasets' slices to merge
#'
#' @return `TRUE` if the provided keys meet the requirements; the `shiny`
Expand Down
6 changes: 3 additions & 3 deletions R/merge_expression_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @param datasets (named `list` of `reactive` or non-`reactive` `data.frame`)\cr
#' object containing data as a list of `data.frame`. When passing a list of non-reactive `data.frame` objects, they are
#' converted to reactive `data.frame` objects internally.
#' @param join_keys (`JoinKeys`)\cr
#' @param join_keys (`join_keys`)\cr
#' of variables used as join keys for each of the datasets in `datasets`.
#' This will be used to extract the `keys` of every dataset.
#' @param data_extract (named `list` of `data_extract_spec`)\cr
Expand Down Expand Up @@ -171,7 +171,7 @@ merge_expression_module <- function(datasets,
#' @param datasets (named `list` of `reactive` or non-`reactive` `data.frame`)\cr
#' object containing data as a list of `data.frame`. When passing a list of non-reactive `data.frame` objects, they are
#' converted to reactive `data.frame` objects internally.
#' @param join_keys (`JoinKeys`)\cr
#' @param join_keys (`join_keys`)\cr
#' of variables used as join keys for each of the datasets in `datasets`.
#' This will be used to extract the `keys` of every dataset.
#' @param selector_list (`reactive`)\cr
Expand Down Expand Up @@ -315,7 +315,7 @@ merge_expression_srv <- function(id = "merge_id",
stopifnot(make.names(anl_name) == anl_name)
checkmate::assert_class(selector_list, "reactive")
checkmate::assert_list(datasets, types = c("reactive", "data.frame"), names = "named")
checkmate::assert_class(join_keys, "JoinKeys")
checkmate::assert_class(join_keys, "join_keys")

moduleServer(
id,
Expand Down
2 changes: 1 addition & 1 deletion man/are_needed_keys_provided.Rd

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

2 changes: 1 addition & 1 deletion man/data_extract_multiple_srv.Rd

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

2 changes: 1 addition & 1 deletion man/data_extract_srv.Rd

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

2 changes: 1 addition & 1 deletion man/get_dplyr_call.Rd

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

2 changes: 1 addition & 1 deletion man/get_dplyr_call_data.Rd

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

2 changes: 1 addition & 1 deletion man/get_merge_call.Rd

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

2 changes: 1 addition & 1 deletion man/get_merge_key_grid.Rd

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

2 changes: 1 addition & 1 deletion man/get_rename_call.Rd

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

2 changes: 1 addition & 1 deletion man/get_reshape_call.Rd

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

2 changes: 1 addition & 1 deletion man/merge_datasets.Rd

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

2 changes: 1 addition & 1 deletion man/merge_expression_module.Rd

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

2 changes: 1 addition & 1 deletion man/merge_expression_srv.Rd

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

2 changes: 1 addition & 1 deletion man/validate_keys_sufficient.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-data_extract_multiple_srv.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ testthat::test_that(
)

testthat::test_that(
desc = "data_extract_multiple_srv accepts throws error when join_keys argument is not JoinKeys object",
desc = "data_extract_multiple_srv accepts throws error when join_keys argument is not join_keys object",
code = {
shiny::withReactiveDomain(
domain = shiny::MockShinySession$new(),
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-data_extract_srv.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ testthat::test_that(
)

testthat::test_that(
desc = "data_extract_srv accepts throws error when join_keys argument is not a JoinKeys object",
desc = "data_extract_srv accepts throws error when join_keys argument is not a join_keys object",
code = {
shiny::withReactiveDomain(
domain = shiny::MockShinySession$new(),
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-merge_expression_srv.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,14 @@ testthat::test_that("merge_expression_srv throws error if datasets is not a name
)
})

testthat::test_that("merge_expression_srv throws error if join_keys is not a JoinKeys object", {
testthat::test_that("merge_expression_srv throws error if join_keys is not a join_keys object", {
testthat::expect_error(
shiny::testServer(
merge_expression_srv,
args = list(selector_list = selector_list, datasets = data_list, join_keys = list("USUBJID")),
expr = NULL
),
"class 'JoinKeys', but has class 'list'"
"class 'join_keys', but has class 'list'"
)
})

Expand Down

0 comments on commit dd6a003

Please sign in to comment.