From 6be71cb93d02591d1d3ba37ba6896badf441febc Mon Sep 17 00:00:00 2001 From: vedhav Date: Mon, 6 Nov 2023 18:29:31 +0530 Subject: [PATCH 01/14] fix: make join_keys related changes due to refactor --- R/init.R | 2 +- R/module_teal_with_splash.R | 4 ++-- R/tdata.R | 15 +++++++++++++++ R/utils.R | 2 +- man/get_join_keys.Rd | 14 +++++++++++--- vignettes/creating-custom-modules.Rmd | 2 +- 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/R/init.R b/R/init.R index b697e2829b..cdd7bb6580 100644 --- a/R/init.R +++ b/R/init.R @@ -144,7 +144,7 @@ init <- function(data, # resolve modules datanames datanames <- teal.data::get_dataname(data) - join_keys <- teal.data::get_join_keys(data) + join_keys <- teal.data::join_keys(data) modules <- resolve_modules_datanames(modules = modules, datanames = datanames, join_keys = join_keys) if (!inherits(filter, "teal_slices")) { diff --git a/R/module_teal_with_splash.R b/R/module_teal_with_splash.R index 01348381b2..02a3d9fb32 100644 --- a/R/module_teal_with_splash.R +++ b/R/module_teal_with_splash.R @@ -74,7 +74,7 @@ srv_teal_with_splash <- function(id, data, modules, filter = teal_slices()) { c( lapply(data$get_datasets(), function(x) x$get_raw_data()), code = data$get_code(), - join_keys = data$get_join_keys() + join_keys = teal.data::join_keys(data) ) ) reactiveVal(new_data) # will trigger by setting it @@ -90,7 +90,7 @@ srv_teal_with_splash <- function(id, data, modules, filter = teal_slices()) { c( lapply(data$get_datasets(), function(x) x$get_raw_data()), code = data$get_code(), - join_keys = data$get_join_keys() + join_keys = teal.data::join_keys(data) ) ) } diff --git a/R/tdata.R b/R/tdata.R index d3fe151b95..ecfc1abd15 100644 --- a/R/tdata.R +++ b/R/tdata.R @@ -123,6 +123,13 @@ get_code_tdata <- function(data) { get_code(data) } +#' Temporary generic method till we support tdata. As `teal.data` deprecated the method +#' @rdname get_join_keys +#' @keywords internal +get_join_keys <- function(data) { + UseMethod("get_join_keys", data) +} + #' Extract `JoinKeys` from `tdata` #' @rdname get_join_keys #' @param data (`tdata`) object @@ -132,6 +139,14 @@ get_join_keys.tdata <- function(data) { attr(data, "join_keys") } + +#' @param data object to extract the join keys from +#' @rdname get_join_keys +#' @keywords internal +get_join_keys.default <- function(data) { + teal.data::get_join_keys(data) +} + #' Function to get metadata from a `tdata` object #' @param data `tdata` - object to extract the data from #' @param dataname `character(1)` the dataset name whose metadata is requested diff --git a/R/utils.R b/R/utils.R index a4a31f2a5d..39008fdfd7 100644 --- a/R/utils.R +++ b/R/utils.R @@ -38,7 +38,7 @@ include_parent_datanames <- function(dataname, join_keys) { parents <- character(0) for (i in dataname) { while (length(i) > 0) { - parent_i <- join_keys$get_parent(i) + parent_i <- teal.data::parent(join_keys, i) parents <- c(parent_i, parents) i <- parent_i } diff --git a/man/get_join_keys.Rd b/man/get_join_keys.Rd index 977a4b3145..5e6a0fc153 100644 --- a/man/get_join_keys.Rd +++ b/man/get_join_keys.Rd @@ -1,15 +1,23 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/tdata.R -\name{get_join_keys.tdata} +\name{get_join_keys} +\alias{get_join_keys} \alias{get_join_keys.tdata} -\title{Extract \code{JoinKeys} from \code{tdata}} +\alias{get_join_keys.default} +\title{Temporary generic method till we support tdata. As \code{teal.data} deprecated the method} \usage{ +get_join_keys(data) + \method{get_join_keys}{tdata}(data) + +\method{get_join_keys}{default}(data) } \arguments{ -\item{data}{(\code{tdata}) object} +\item{data}{object to extract the join keys from} } \description{ +Temporary generic method till we support tdata. As \code{teal.data} deprecated the method + Extract \code{JoinKeys} from \code{tdata} } \keyword{internal} diff --git a/vignettes/creating-custom-modules.Rmd b/vignettes/creating-custom-modules.Rmd index 9e68150c0e..dbaa62b1e4 100644 --- a/vignettes/creating-custom-modules.Rmd +++ b/vignettes/creating-custom-modules.Rmd @@ -114,7 +114,7 @@ srv_histogram_example <- function(id, data, histogram_var) { id = "histogram_var", datasets = data, data_extract_spec = histogram_var, - join_keys = get_join_keys(data) + join_keys = teal.data::join_keys(data) ) dataname <- reactive(extracted()$dataname) From cfa2be77c69629c154aee4f607707622bba583d6 Mon Sep 17 00:00:00 2001 From: vedhav Date: Tue, 7 Nov 2023 14:25:49 +0530 Subject: [PATCH 02/14] chore: export get_join_keys method to support external calls --- NAMESPACE | 2 ++ R/tdata.R | 2 ++ 2 files changed, 4 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 242ffaf984..51ae8f93df 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,7 @@ S3method(c,teal_slices) S3method(get_code,tdata) +S3method(get_join_keys,default) S3method(get_join_keys,tdata) S3method(get_metadata,default) S3method(get_metadata,tdata) @@ -20,6 +21,7 @@ export(TealReportCard) export(as.teal_slices) export(example_module) export(get_code_tdata) +export(get_join_keys) export(get_metadata) export(init) export(landing_popup_module) diff --git a/R/tdata.R b/R/tdata.R index ecfc1abd15..5e027ff8e7 100644 --- a/R/tdata.R +++ b/R/tdata.R @@ -126,6 +126,7 @@ get_code_tdata <- function(data) { #' Temporary generic method till we support tdata. As `teal.data` deprecated the method #' @rdname get_join_keys #' @keywords internal +#' @export get_join_keys <- function(data) { UseMethod("get_join_keys", data) } @@ -143,6 +144,7 @@ get_join_keys.tdata <- function(data) { #' @param data object to extract the join keys from #' @rdname get_join_keys #' @keywords internal +#' @export get_join_keys.default <- function(data) { teal.data::get_join_keys(data) } From a3a3b621b6cf9b086b613c25047d94963a9ea2bf Mon Sep 17 00:00:00 2001 From: vedhav Date: Wed, 8 Nov 2023 12:27:13 +0530 Subject: [PATCH 03/14] chore: fix spellchecks --- R/tdata.R | 2 +- man/get_join_keys.Rd | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/tdata.R b/R/tdata.R index 5e027ff8e7..06d2a5d161 100644 --- a/R/tdata.R +++ b/R/tdata.R @@ -123,7 +123,7 @@ get_code_tdata <- function(data) { get_code(data) } -#' Temporary generic method till we support tdata. As `teal.data` deprecated the method +#' Temporary generic method until we support `tdata`. Since `teal.data` has deprecated the method. #' @rdname get_join_keys #' @keywords internal #' @export diff --git a/man/get_join_keys.Rd b/man/get_join_keys.Rd index 5e6a0fc153..e948593754 100644 --- a/man/get_join_keys.Rd +++ b/man/get_join_keys.Rd @@ -4,7 +4,7 @@ \alias{get_join_keys} \alias{get_join_keys.tdata} \alias{get_join_keys.default} -\title{Temporary generic method till we support tdata. As \code{teal.data} deprecated the method} +\title{Temporary generic method until we support \code{tdata}. Since \code{teal.data} has deprecated the method.} \usage{ get_join_keys(data) @@ -16,7 +16,7 @@ get_join_keys(data) \item{data}{object to extract the join keys from} } \description{ -Temporary generic method till we support tdata. As \code{teal.data} deprecated the method +Temporary generic method until we support \code{tdata}. Since \code{teal.data} has deprecated the method. Extract \code{JoinKeys} from \code{tdata} } From 9e93d4be38b145cf017a492f29398d7054751feb Mon Sep 17 00:00:00 2001 From: vedhav Date: Wed, 8 Nov 2023 19:31:12 +0530 Subject: [PATCH 04/14] feat: add a join_keys getter for tdata --- NAMESPACE | 4 +--- R/tdata.R | 21 ++------------------- man/get_join_keys.Rd | 23 ----------------------- man/join_keys.Rd | 14 ++++++++++++++ 4 files changed, 17 insertions(+), 45 deletions(-) delete mode 100644 man/get_join_keys.Rd create mode 100644 man/join_keys.Rd diff --git a/NAMESPACE b/NAMESPACE index 51ae8f93df..7ec9257460 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,10 +2,9 @@ S3method(c,teal_slices) S3method(get_code,tdata) -S3method(get_join_keys,default) -S3method(get_join_keys,tdata) S3method(get_metadata,default) S3method(get_metadata,tdata) +S3method(join_keys,tdata) S3method(print,teal_module) S3method(print,teal_modules) S3method(srv_nested_tabs,default) @@ -21,7 +20,6 @@ export(TealReportCard) export(as.teal_slices) export(example_module) export(get_code_tdata) -export(get_join_keys) export(get_metadata) export(init) export(landing_popup_module) diff --git a/R/tdata.R b/R/tdata.R index 06d2a5d161..f3cbfb977d 100644 --- a/R/tdata.R +++ b/R/tdata.R @@ -123,32 +123,15 @@ get_code_tdata <- function(data) { get_code(data) } -#' Temporary generic method until we support `tdata`. Since `teal.data` has deprecated the method. -#' @rdname get_join_keys -#' @keywords internal -#' @export -get_join_keys <- function(data) { - UseMethod("get_join_keys", data) -} - #' Extract `JoinKeys` from `tdata` -#' @rdname get_join_keys +#' @rdname join_keys #' @param data (`tdata`) object -#' @keywords internal #' @export -get_join_keys.tdata <- function(data) { +join_keys.tdata <- function(data) { # nolint attr(data, "join_keys") } -#' @param data object to extract the join keys from -#' @rdname get_join_keys -#' @keywords internal -#' @export -get_join_keys.default <- function(data) { - teal.data::get_join_keys(data) -} - #' Function to get metadata from a `tdata` object #' @param data `tdata` - object to extract the data from #' @param dataname `character(1)` the dataset name whose metadata is requested diff --git a/man/get_join_keys.Rd b/man/get_join_keys.Rd deleted file mode 100644 index e948593754..0000000000 --- a/man/get_join_keys.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/tdata.R -\name{get_join_keys} -\alias{get_join_keys} -\alias{get_join_keys.tdata} -\alias{get_join_keys.default} -\title{Temporary generic method until we support \code{tdata}. Since \code{teal.data} has deprecated the method.} -\usage{ -get_join_keys(data) - -\method{get_join_keys}{tdata}(data) - -\method{get_join_keys}{default}(data) -} -\arguments{ -\item{data}{object to extract the join keys from} -} -\description{ -Temporary generic method until we support \code{tdata}. Since \code{teal.data} has deprecated the method. - -Extract \code{JoinKeys} from \code{tdata} -} -\keyword{internal} diff --git a/man/join_keys.Rd b/man/join_keys.Rd new file mode 100644 index 0000000000..648dbf4241 --- /dev/null +++ b/man/join_keys.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tdata.R +\name{join_keys.tdata} +\alias{join_keys.tdata} +\title{Extract \code{JoinKeys} from \code{tdata}} +\usage{ +\method{join_keys}{tdata}(data) +} +\arguments{ +\item{data}{(\code{tdata}) object} +} +\description{ +Extract \code{JoinKeys} from \code{tdata} +} From 091efb1c33387634ab6a1f8912d2dd745993f38f Mon Sep 17 00:00:00 2001 From: vedhav Date: Wed, 8 Nov 2023 19:38:03 +0530 Subject: [PATCH 05/14] fix: update tests --- tests/testthat/test-module_nested_tabs.R | 2 +- tests/testthat/test-tdata.R | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/testthat/test-module_nested_tabs.R b/tests/testthat/test-module_nested_tabs.R index 74aea0ecd8..07f21e0422 100644 --- a/tests/testthat/test-module_nested_tabs.R +++ b/tests/testthat/test-module_nested_tabs.R @@ -451,7 +451,7 @@ testthat::test_that(".datasets_to_data returns tdata object", { # join_keys testthat::expect_equal( - get_join_keys(data), + join_keys(data), teal.data::join_keys(teal.data::join_key("d1", "d2", c("pk" = "id"))) ) diff --git a/tests/testthat/test-tdata.R b/tests/testthat/test-tdata.R index 7f486f3c9f..09224528ff 100644 --- a/tests/testthat/test-tdata.R +++ b/tests/testthat/test-tdata.R @@ -200,12 +200,12 @@ testthat::test_that("tdata2env throws error if argument is not tdata", { }) # ---- get_join_keys ---- -testthat::test_that("get_join_keys returns NULL if no JoinKeys object exists inside tdata", { +testthat::test_that("join_keys returns NULL if no JoinKeys object exists inside tdata", { my_tdata <- new_tdata(data = list(iris = iris, mae = reactive(miniACC))) - testthat::expect_null(get_join_keys(my_tdata)) + testthat::expect_null(join_keys(my_tdata)) }) -testthat::test_that("get_join_keys returns JoinKeys object if it exists inside tdata", { +testthat::test_that("join_keys returns JoinKeys object if it exists inside tdata", { jk <- teal.data::join_keys(teal.data::join_key("A", "B", c("id" = "fk"))) my_tdata <- new_tdata( @@ -216,5 +216,5 @@ testthat::test_that("get_join_keys returns JoinKeys object if it exists inside t join_keys = jk ) - testthat::expect_equal(get_join_keys(my_tdata), jk) + testthat::expect_equal(join_keys(my_tdata), jk) }) From 8de177a1645f9573fe575e66730ac214856c44db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:48:40 +0100 Subject: [PATCH 06/14] fix: rename JoinKeys class to join_keys from upstream --- R/module_nested_tabs.R | 2 +- R/tdata.R | 6 +++--- R/utils.R | 2 +- man/dot-datasets_to_data.Rd | 2 +- man/resolve_modules_datanames.Rd | 2 +- man/tdata.Rd | 4 ++-- tests/testthat/test-tdata.R | 10 +++++----- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/R/module_nested_tabs.R b/R/module_nested_tabs.R index 0a012f32dd..c2fc92e830 100644 --- a/R/module_nested_tabs.R +++ b/R/module_nested_tabs.R @@ -288,7 +288,7 @@ srv_nested_tabs.teal_module <- function(id, datasets, modules, is_module_specifi #' @param trigger_data (`reactiveVal`) to trigger getting the filtered data #' @return list of reactive datasets with following attributes: #' - `code` (`character`) containing datasets reproducible code. -#' - `join_keys` (`JoinKeys`) containing relationships between datasets. +#' - `join_keys` (`join_keys`) containing relationships between datasets. #' - `metadata` (`list`) containing metadata of datasets. #' #' @keywords internal diff --git a/R/tdata.R b/R/tdata.R index f3cbfb977d..a2c303a188 100644 --- a/R/tdata.R +++ b/R/tdata.R @@ -4,7 +4,7 @@ #' (or `MultiAssayExperiment`), with attributes: #' \itemize{ #' \item{`code` (`reactive`) containing code used to generate the data} -#' \item{join_keys (`JoinKeys`) containing the relationships between the data} +#' \item{join_keys (`join_keys`) containing the relationships between the data} #' \item{metadata (`named list`) containing any metadata associated with the data frames} #' } #' @name tdata @@ -15,7 +15,7 @@ #' the code used to generate the data. This should be `reactive` if the code is changing #' during a reactive context (e.g. if filtering changes the code). Inside this #' object `code` will be made reactive -#' @param join_keys A `teal.data::JoinKeys` object containing relationships between the +#' @param join_keys A `teal.data::join_keys` object containing relationships between the #' datasets. #' @param metadata A `named list` each element contains a list of metadata about the named data.frame #' Each element of these list should be atomic and length one. @@ -46,7 +46,7 @@ new_tdata <- function(data, code = "", join_keys = NULL, metadata = NULL) { any.missing = FALSE, names = "unique", types = c("data.frame", "reactive", "MultiAssayExperiment") ) - checkmate::assert_class(join_keys, "JoinKeys", null.ok = TRUE) + checkmate::assert_class(join_keys, "join_keys", null.ok = TRUE) checkmate::assert_multi_class(code, c("character", "reactive")) checkmate::assert_list(metadata, names = "unique", null.ok = TRUE) diff --git a/R/utils.R b/R/utils.R index 39008fdfd7..99e0d1a684 100644 --- a/R/utils.R +++ b/R/utils.R @@ -106,7 +106,7 @@ report_card_template <- function(title, label, description = NULL, with_filter, #' When `datanames` is set to `"all"` it is replaced with all available datasets names. #' @param modules (`teal_modules`) object #' @param datanames (`character`) names of datasets available in the `data` object -#' @param join_keys (`JoinKeys`) object +#' @param join_keys (`join_keys`) object #' @return `teal_modules` with resolved `datanames` #' @keywords internal resolve_modules_datanames <- function(modules, datanames, join_keys) { diff --git a/man/dot-datasets_to_data.Rd b/man/dot-datasets_to_data.Rd index 56b078b7db..c484adeb75 100644 --- a/man/dot-datasets_to_data.Rd +++ b/man/dot-datasets_to_data.Rd @@ -17,7 +17,7 @@ list of reactive datasets with following attributes: \itemize{ \item \code{code} (\code{character}) containing datasets reproducible code. -\item \code{join_keys} (\code{JoinKeys}) containing relationships between datasets. +\item \code{join_keys} (\code{join_keys}) containing relationships between datasets. \item \code{metadata} (\code{list}) containing metadata of datasets. } } diff --git a/man/resolve_modules_datanames.Rd b/man/resolve_modules_datanames.Rd index 0509844daf..928a381884 100644 --- a/man/resolve_modules_datanames.Rd +++ b/man/resolve_modules_datanames.Rd @@ -11,7 +11,7 @@ resolve_modules_datanames(modules, datanames, join_keys) \item{datanames}{(\code{character}) names of datasets available in the \code{data} object} -\item{join_keys}{(\code{JoinKeys}) object} +\item{join_keys}{(\code{join_keys}) object} } \value{ \code{teal_modules} with resolved \code{datanames} diff --git a/man/tdata.Rd b/man/tdata.Rd index 1fb33f1e25..d686b0f621 100644 --- a/man/tdata.Rd +++ b/man/tdata.Rd @@ -20,7 +20,7 @@ the code used to generate the data. This should be \code{reactive} if the code i during a reactive context (e.g. if filtering changes the code). Inside this object \code{code} will be made reactive} -\item{join_keys}{A \code{teal.data::JoinKeys} object containing relationships between the +\item{join_keys}{A \code{teal.data::join_keys} object containing relationships between the datasets.} \item{metadata}{A \verb{named list} each element contains a list of metadata about the named data.frame @@ -38,7 +38,7 @@ Create a new object called \code{tdata} which contains \code{data}, a \code{reac (or \code{MultiAssayExperiment}), with attributes: \itemize{ \item{\code{code} (\code{reactive}) containing code used to generate the data} -\item{join_keys (\code{JoinKeys}) containing the relationships between the data} +\item{join_keys (\code{join_keys}) containing the relationships between the data} \item{metadata (\verb{named list}) containing any metadata associated with the data frames} } } diff --git a/tests/testthat/test-tdata.R b/tests/testthat/test-tdata.R index 09224528ff..6511a35bc6 100644 --- a/tests/testthat/test-tdata.R +++ b/tests/testthat/test-tdata.R @@ -62,14 +62,14 @@ testthat::test_that("new_tdata accepts character and reactive characters for cod ) }) -testthat::test_that("new_tdata throws error if join_keys is not of class JoinKeys", { +testthat::test_that("new_tdata throws error if join_keys is not of class join_keys", { testthat::expect_error( new_tdata(list(x = iris), join_keys = "x"), - "Assertion on 'join_keys' failed: Must inherit from class 'JoinKeys'" + "Assertion on 'join_keys' failed: Must inherit from class 'join_keys'" ) }) -testthat::test_that("new_tdata throws no error if join_keys is of class JoinKeys", { +testthat::test_that("new_tdata throws no error if join_keys is of class join_keys", { testthat::expect_error( new_tdata(list(x = iris), join_keys = teal.data::join_keys()), NA @@ -200,12 +200,12 @@ testthat::test_that("tdata2env throws error if argument is not tdata", { }) # ---- get_join_keys ---- -testthat::test_that("join_keys returns NULL if no JoinKeys object exists inside tdata", { +testthat::test_that("join_keys returns NULL if no join_keys object exists inside tdata", { my_tdata <- new_tdata(data = list(iris = iris, mae = reactive(miniACC))) testthat::expect_null(join_keys(my_tdata)) }) -testthat::test_that("join_keys returns JoinKeys object if it exists inside tdata", { +testthat::test_that("join_keys returns join_keys object if it exists inside tdata", { jk <- teal.data::join_keys(teal.data::join_key("A", "B", c("id" = "fk"))) my_tdata <- new_tdata( From 16d7585ee656d6bfb19fd52a6fde94ff1c7621e2 Mon Sep 17 00:00:00 2001 From: vedhav Date: Thu, 9 Nov 2023 17:57:11 +0530 Subject: [PATCH 07/14] docs: add join_keys to pkgdown --- R/tdata.R | 3 +-- _pkgdown.yml | 1 + man/{join_keys.Rd => join_keys.tdata.Rd} | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename man/{join_keys.Rd => join_keys.tdata.Rd} (71%) diff --git a/R/tdata.R b/R/tdata.R index a2c303a188..2e48e2db92 100644 --- a/R/tdata.R +++ b/R/tdata.R @@ -123,8 +123,7 @@ get_code_tdata <- function(data) { get_code(data) } -#' Extract `JoinKeys` from `tdata` -#' @rdname join_keys +#' Extract `join_keys` from `tdata` #' @param data (`tdata`) object #' @export join_keys.tdata <- function(data) { # nolint diff --git a/_pkgdown.yml b/_pkgdown.yml index 01209c9ae4..228409fe24 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -117,6 +117,7 @@ reference: - get_metadata - tdata2env - show_rcode_modal + - join_keys.tdata # - title: Functions Moved to Other Packages # desc: These functions have been moved from teal and will be deprecated # contents: diff --git a/man/join_keys.Rd b/man/join_keys.tdata.Rd similarity index 71% rename from man/join_keys.Rd rename to man/join_keys.tdata.Rd index 648dbf4241..d1cb6858f9 100644 --- a/man/join_keys.Rd +++ b/man/join_keys.tdata.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/tdata.R \name{join_keys.tdata} \alias{join_keys.tdata} -\title{Extract \code{JoinKeys} from \code{tdata}} +\title{Extract \code{join_keys} from \code{tdata}} \usage{ \method{join_keys}{tdata}(data) } @@ -10,5 +10,5 @@ \item{data}{(\code{tdata}) object} } \description{ -Extract \code{JoinKeys} from \code{tdata} +Extract \code{join_keys} from \code{tdata} } From 84f42b87e04d7260b802b5507bc65a5e3dd8e29f Mon Sep 17 00:00:00 2001 From: vedhav Date: Thu, 9 Nov 2023 18:21:14 +0530 Subject: [PATCH 08/14] fix: use the proper arguments as specified by generic --- R/tdata.R | 5 +++-- man/join_keys.tdata.Rd | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/R/tdata.R b/R/tdata.R index 2e48e2db92..1806b68d23 100644 --- a/R/tdata.R +++ b/R/tdata.R @@ -124,9 +124,10 @@ get_code_tdata <- function(data) { } #' Extract `join_keys` from `tdata` -#' @param data (`tdata`) object +#' @param data A `tdata` object +#' @param ... Additional arguments (not used) #' @export -join_keys.tdata <- function(data) { # nolint +join_keys.tdata <- function(data, ...) { attr(data, "join_keys") } diff --git a/man/join_keys.tdata.Rd b/man/join_keys.tdata.Rd index d1cb6858f9..19d022c7c5 100644 --- a/man/join_keys.tdata.Rd +++ b/man/join_keys.tdata.Rd @@ -4,10 +4,12 @@ \alias{join_keys.tdata} \title{Extract \code{join_keys} from \code{tdata}} \usage{ -\method{join_keys}{tdata}(data) +\method{join_keys}{tdata}(data, ...) } \arguments{ -\item{data}{(\code{tdata}) object} +\item{data}{A \code{tdata} object} + +\item{...}{Additional arguments (not used)} } \description{ Extract \code{join_keys} from \code{tdata} From d3dbcf0ce2346844ec5e71d8d3995ee9972665db Mon Sep 17 00:00:00 2001 From: vedhav Date: Thu, 16 Nov 2023 19:41:12 +0530 Subject: [PATCH 09/14] fix: resolve bad conflict resolution --- R/init.R | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/R/init.R b/R/init.R index 86c5106692..ce50780e9d 100644 --- a/R/init.R +++ b/R/init.R @@ -143,20 +143,6 @@ init <- function(data, if (length(landing) > 1L) stop("Only one `landing_popup_module` can be used.") modules <- drop_module(modules, "teal_module_landing") - # resolve modules datanames - datanames <- teal.data::get_dataname(data) - join_keys <- teal.data::join_keys(data) - modules <- resolve_modules_datanames(modules = modules, datanames = datanames, join_keys = join_keys) - - if (!inherits(filter, "teal_slices")) { - checkmate::assert_subset(names(filter), choices = datanames) - # list_to_teal_slices is lifted from teal.slice package, see zzz.R - # This is a temporary measure and will be removed two release cycles from now (now meaning 0.13.0). - filter <- list_to_teal_slices(filter) - } - # convert teal.slice::teal_slices to teal::teal_slices - filter <- as.teal_slices(as.list(filter)) - # Calculate app id that will be used to stamp filter state snapshots. # App id is a hash of the app's data and modules. # See "transferring snapshots" section in ?snapshot. Raw data must be extracted from environments. From f35888caa3a44d9a0c5112a2e395e9a7744b9227 Mon Sep 17 00:00:00 2001 From: Vedha Viyash <49812166+vedhav@users.noreply.github.com> Date: Thu, 16 Nov 2023 19:48:29 +0530 Subject: [PATCH 10/14] Update R/init.R Co-authored-by: Aleksander Chlebowski <114988527+chlebowa@users.noreply.github.com> Signed-off-by: Vedha Viyash <49812166+vedhav@users.noreply.github.com> --- R/init.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/init.R b/R/init.R index ce50780e9d..8035815e7d 100644 --- a/R/init.R +++ b/R/init.R @@ -145,7 +145,7 @@ init <- function(data, # Calculate app id that will be used to stamp filter state snapshots. # App id is a hash of the app's data and modules. - # See "transferring snapshots" section in ?snapshot. Raw data must be extracted from environments. + # See "transferring snapshots" section in ?snapshot. hashables <- mget(c("data", "modules")) hashables$data <- if (inherits(hashables$data, "teal_data")) { as.list(hashables$data@env) From 1bf91121194c3043cd3f8478098751c39dd18f31 Mon Sep 17 00:00:00 2001 From: go_gonzo Date: Thu, 16 Nov 2023 21:29:43 +0100 Subject: [PATCH 11/14] fix backwards compatibility --- R/module_teal_with_splash.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/module_teal_with_splash.R b/R/module_teal_with_splash.R index 07f961e52d..e8a5ae92be 100644 --- a/R/module_teal_with_splash.R +++ b/R/module_teal_with_splash.R @@ -84,8 +84,8 @@ srv_teal_with_splash <- function(id, data, modules, filter = teal_slices()) { teal.data::teal_data, c( lapply(data$get_datasets(), function(x) x$get_raw_data()), - code = data$get_code(), - join_keys = teal.data::join_keys(data) + list(code = data$get_code()), + list(join_keys = teal.data::join_keys(data)) ) ) reactiveVal(new_data) # will trigger by setting it @@ -100,8 +100,8 @@ srv_teal_with_splash <- function(id, data, modules, filter = teal_slices()) { teal.data::teal_data, c( lapply(data$get_datasets(), function(x) x$get_raw_data()), - code = data$get_code(), - join_keys = teal.data::join_keys(data) + list(code = data$get_code()), + list(join_keys = teal.data::join_keys(data)) ) ) } From 8cba826973fb6a8af4dce92f8a0a30d45737f717 Mon Sep 17 00:00:00 2001 From: vedhav Date: Fri, 17 Nov 2023 12:16:39 +0530 Subject: [PATCH 12/14] chore: provide complete arg name --- R/module_nested_tabs.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/module_nested_tabs.R b/R/module_nested_tabs.R index cf7c93ca45..58db81695b 100644 --- a/R/module_nested_tabs.R +++ b/R/module_nested_tabs.R @@ -109,7 +109,7 @@ ui_nested_tabs.teal_modules <- function(id, modules, datasets, depth = 0L, is_mo #' @rdname module_nested_tabs #' @export ui_nested_tabs.teal_module <- function(id, modules, datasets, depth = 0L, is_module_specific = FALSE) { - checkmate::assert_class(datasets, class = "FilteredData") + checkmate::assert_class(datasets, classes = "FilteredData") ns <- NS(id) args <- isolate(teal.transform::resolve_delayed(modules$ui_args, datasets)) From 6b3916dd57ff9ea5e9e7d7d5173ba4484a027dea Mon Sep 17 00:00:00 2001 From: vedhav Date: Fri, 17 Nov 2023 18:03:54 +0530 Subject: [PATCH 13/14] chore: replace `runApp` with `shinyApp` --- R/module_filter_manager.R | 2 +- R/module_nested_tabs.R | 2 +- R/module_tabs_with_filters.R | 2 +- R/module_teal.R | 2 +- R/modules.R | 4 ++-- R/modules_debugging.R | 2 +- R/teal_slices.R | 2 +- man/filter_calls_module.Rd | 2 +- man/module.Rd | 2 +- man/module_filter_manager_modal.Rd | 2 +- man/module_nested_tabs.Rd | 2 +- man/module_tabs_with_filters.Rd | 2 +- man/module_teal.Rd | 2 +- man/modules.Rd | 2 +- man/teal_slices.Rd | 2 +- vignettes/filter-panel.Rmd | 6 +++--- vignettes/teal-bs-themes.Rmd | 2 +- vignettes/teal.Rmd | 2 +- 18 files changed, 21 insertions(+), 21 deletions(-) diff --git a/R/module_filter_manager.R b/R/module_filter_manager.R index 69a31fdc12..1856b6816b 100644 --- a/R/module_filter_manager.R +++ b/R/module_filter_manager.R @@ -37,7 +37,7 @@ #' } #' ) #' if (interactive()) { -#' runApp(app) +#' shinyApp(app$ui, app$server) #' } #' #' @keywords internal diff --git a/R/module_nested_tabs.R b/R/module_nested_tabs.R index 58db81695b..0eb274c0aa 100644 --- a/R/module_nested_tabs.R +++ b/R/module_nested_tabs.R @@ -54,7 +54,7 @@ #' } #' ) #' if (interactive()) { -#' runApp(app) +#' shinyApp(app$ui, app$server) #' } #' @keywords internal NULL diff --git a/R/module_tabs_with_filters.R b/R/module_tabs_with_filters.R index 7f2fca1406..7c42fc2ea0 100644 --- a/R/module_tabs_with_filters.R +++ b/R/module_tabs_with_filters.R @@ -50,7 +50,7 @@ #' } #' ) #' if (interactive()) { -#' runApp(app) +#' shinyApp(app$ui, app$server) #' } #' NULL diff --git a/R/module_teal.R b/R/module_teal.R index 277ccdd198..c3b3028e48 100644 --- a/R/module_teal.R +++ b/R/module_teal.R @@ -54,7 +54,7 @@ #' } #' ) #' if (interactive()) { -#' runApp(app) +#' shinyApp(app$ui, app$server) #' } NULL diff --git a/R/modules.R b/R/modules.R index 789083e669..3f4d191437 100644 --- a/R/modules.R +++ b/R/modules.R @@ -63,7 +63,7 @@ #' ) #' ) #' if (interactive()) { -#' runApp(app) +#' shinyApp(app$ui, app$server) #' } modules <- function(..., label = "root") { checkmate::assert_string(label) @@ -219,7 +219,7 @@ is_arg_used <- function(modules, arg) { #' ) #' ) #' if (interactive()) { -#' runApp(app) +#' shinyApp(app$ui, app$server) #' } module <- function(label = "module", server = function(id, ...) { diff --git a/R/modules_debugging.R b/R/modules_debugging.R index 6260f3908c..66be4e121b 100644 --- a/R/modules_debugging.R +++ b/R/modules_debugging.R @@ -19,7 +19,7 @@ #' header = "Simple teal app" #' ) #' if (interactive()) { -#' runApp(app) +#' shinyApp(app$ui, app$server) #' } filter_calls_module <- function(label = "Filter Calls Module") { # nolint checkmate::assert_string(label) diff --git a/R/teal_slices.R b/R/teal_slices.R index bd3aaf1ce7..fe380a4b78 100644 --- a/R/teal_slices.R +++ b/R/teal_slices.R @@ -60,7 +60,7 @@ #' ) #' #' if (interactive()) { -#' shiny::runApp(app) +#' shinyApp(app$ui, app$server) #' } #' #' @export diff --git a/man/filter_calls_module.Rd b/man/filter_calls_module.Rd index 70383766d1..f7c7cde320 100644 --- a/man/filter_calls_module.Rd +++ b/man/filter_calls_module.Rd @@ -21,7 +21,7 @@ app <- init( header = "Simple teal app" ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } } \keyword{internal} diff --git a/man/module.Rd b/man/module.Rd index d7267630cd..9a81569787 100644 --- a/man/module.Rd +++ b/man/module.Rd @@ -102,6 +102,6 @@ app <- init( ) ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } } diff --git a/man/module_filter_manager_modal.Rd b/man/module_filter_manager_modal.Rd index 4ae0922fba..dea4ad4955 100644 --- a/man/module_filter_manager_modal.Rd +++ b/man/module_filter_manager_modal.Rd @@ -61,7 +61,7 @@ app <- shinyApp( } ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } } diff --git a/man/module_nested_tabs.Rd b/man/module_nested_tabs.Rd index b21eeaa139..e4d2620e15 100644 --- a/man/module_nested_tabs.Rd +++ b/man/module_nested_tabs.Rd @@ -128,7 +128,7 @@ app <- shinyApp( } ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } } \keyword{internal} diff --git a/man/module_tabs_with_filters.Rd b/man/module_tabs_with_filters.Rd index 1be1c16d21..03163535dc 100644 --- a/man/module_tabs_with_filters.Rd +++ b/man/module_tabs_with_filters.Rd @@ -67,7 +67,7 @@ app <- shinyApp( } ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } } diff --git a/man/module_teal.Rd b/man/module_teal.Rd index 50524636c4..5017667dd9 100644 --- a/man/module_teal.Rd +++ b/man/module_teal.Rd @@ -79,7 +79,7 @@ app <- shinyApp( } ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } } \keyword{internal} diff --git a/man/modules.Rd b/man/modules.Rd index c86a83be06..996f468fd9 100644 --- a/man/modules.Rd +++ b/man/modules.Rd @@ -87,6 +87,6 @@ app <- init( ) ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } } diff --git a/man/teal_slices.Rd b/man/teal_slices.Rd index 0036fb8176..9956a44d55 100644 --- a/man/teal_slices.Rd +++ b/man/teal_slices.Rd @@ -103,7 +103,7 @@ app <- teal::init( ) if (interactive()) { - shiny::runApp(app) + shinyApp(app$ui, app$server) } } diff --git a/vignettes/filter-panel.Rmd b/vignettes/filter-panel.Rmd index 009b7f5aae..bf2a3b1be0 100644 --- a/vignettes/filter-panel.Rmd +++ b/vignettes/filter-panel.Rmd @@ -33,7 +33,7 @@ app <- init( ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } ``` @@ -60,7 +60,7 @@ app <- init( ) ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } ``` @@ -111,6 +111,6 @@ app <- init( ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } ``` diff --git a/vignettes/teal-bs-themes.Rmd b/vignettes/teal-bs-themes.Rmd index 6f4be77f9a..7c138def60 100644 --- a/vignettes/teal-bs-themes.Rmd +++ b/vignettes/teal-bs-themes.Rmd @@ -89,7 +89,7 @@ If you want to update the theme in a regular `shiny::fluidPage`-like app, you do ### Interactive Theming Guide -In this section we provide a step-by-step guide to customizing a `teal` application theme interactively with `bslib::run_with_themer()`. We recommend starting with a simple case and once you are satisfied, verifying with your full application. To that end we will use the `teal` application below. For this example we assume that we want to use Bootstrap 5. To start, we launch the app with `bslib::run_with_themer(app$ui, app$server)` instead of `shiny::runApp`. +In this section we provide a step-by-step guide to customizing a `teal` application theme interactively with `bslib::run_with_themer()`. We recommend starting with a simple case and once you are satisfied, verifying with your full application. To that end we will use the `teal` application below. For this example we assume that we want to use Bootstrap 5. To start, we launch the app with `bslib::run_with_themer(app$ui, app$server)` instead of `shiny::shinyApp`. ```{r, eval = FALSE} options("teal.bs_theme" = bslib::bs_theme(version = "5")) diff --git a/vignettes/teal.Rmd b/vignettes/teal.Rmd index 76d47a65e0..5b79234de0 100644 --- a/vignettes/teal.Rmd +++ b/vignettes/teal.Rmd @@ -40,7 +40,7 @@ app <- init( ) if (interactive()) { - runApp(app) + shinyApp(app$ui, app$server) } ``` Example application From 618da3930538c9b667eacfe4242401c62572641d Mon Sep 17 00:00:00 2001 From: vedhav Date: Mon, 20 Nov 2023 16:03:24 +0530 Subject: [PATCH 14/14] chore: vbump --- DESCRIPTION | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a4fa441120..925bbb08c8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,9 +31,9 @@ BugReports: https://github.com/insightsengineering/teal/issues Depends: R (>= 4.0), shiny (>= 1.7.0), - teal.data (>= 0.3.0), - teal.slice (>= 0.4.0.9011), - teal.transform (>= 0.4.0) + teal.data (>= 0.3.0.9010), + teal.slice (>= 0.4.0.9023), + teal.transform (>= 0.4.0.9007) Imports: checkmate, jsonlite,