From 70d7cc1c4a176405796739d3e2b87b036f8f694a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zxBIB=20Lech=C3=B3n=2CMiguel=20=28MED=20BDS=29=20EXTERNAL?= Date: Fri, 17 Jan 2025 16:33:54 +0100 Subject: [PATCH] Remove support for data dispatchers. --- R/mod_edish.R | 35 +++++------------------------ man/mod_edish.Rd | 10 ++------- vignettes/disp.Rmd | 56 ---------------------------------------------- 3 files changed, 8 insertions(+), 93 deletions(-) delete mode 100644 vignettes/disp.Rmd diff --git a/R/mod_edish.R b/R/mod_edish.R index 61a5acb..0e63fc6 100644 --- a/R/mod_edish.R +++ b/R/mod_edish.R @@ -297,7 +297,7 @@ edish_server <- function( #' A unique module ID. #' @param dataset_names `[character(1+)]` #' -#' Name(s) of the dataset(s) that will be displayed. Can not be used together with the parameter `dataset_disp`. +#' Name(s) of the dataset(s) that will be displayed. #' @param subjectid_var `[character(1)]` #' #' Name of the variable containing the unique subject IDs. Defaults to `"USUBJID"`. @@ -370,42 +370,19 @@ mod_edish <- function( lb_test_default_x_val = "Aspartate Aminotransferase", lb_test_default_y_val = "Bilirubin", lb_result_var = "LBSTRESN", - ref_range_upper_lim_var = "LBSTNRHI", - dataset_disp) { + ref_range_upper_lim_var = "LBSTNRHI") { # Check validity of parameters # Note: Skip assertions for module_id and _vars/_vals since they are checked in the server - if (!missing(dataset_names)) { - checkmate::assert_character(dataset_names) - } - if (!missing(dataset_disp)) { - ac <- checkmate::makeAssertCollection() - checkmate::assert_list(dataset_disp, types = "character", add = ac) - checkmate::assert_class(dataset_disp, "mm_dispatcher", add = ac) - checkmate::assert_names(names(dataset_disp), identical.to = c("from", "selection"), add = ac) - checkmate::reportAssertions(ac) - } - - # Check correct use of dispatcher - if (!missing(dataset_names) && !missing(dataset_disp)) { - stop("`dataset_names` and `dataset_disp` cannot be used at the same time, use one or the other.") - } - if (missing(dataset_names) && missing(dataset_disp)) { - stop("Neither `dataset_names` nor `dataset_disp` is specified, please specify one of them.") - } - use_disp <- !missing(dataset_disp) + checkmate::assert_character(dataset_names) mod <- list( ui = function(module_id) { edish_UI(module_id = module_id) }, server = function(afmm) { - dataset_list <- if (use_disp) { - dv.manager::mm_resolve_dispatcher(dataset_disp, afmm) - } else { - shiny::reactive({ - afmm$filtered_dataset()[dataset_names] - }) - } + dataset_list <- shiny::reactive({ + afmm$filtered_dataset()[dataset_names] + }) edish_server( module_id = module_id, diff --git a/man/mod_edish.Rd b/man/mod_edish.Rd index 2bfc507..cdac9c3 100644 --- a/man/mod_edish.Rd +++ b/man/mod_edish.Rd @@ -18,8 +18,7 @@ mod_edish( lb_test_default_x_val = "Aspartate Aminotransferase", lb_test_default_y_val = "Bilirubin", lb_result_var = "LBSTRESN", - ref_range_upper_lim_var = "LBSTNRHI", - dataset_disp + ref_range_upper_lim_var = "LBSTNRHI" ) } \arguments{ @@ -29,7 +28,7 @@ A unique module ID.} \item{dataset_names}{\verb{[character(1+)]} -Name(s) of the dataset(s) that will be displayed. Can not be used together with the parameter \code{dataset_disp}.} +Name(s) of the dataset(s) that will be displayed.} \item{subjectid_var}{\verb{[character(1)]} @@ -81,11 +80,6 @@ will cause a value of NA to be returned as maximum value.} Name of the variable containing the reference range upper limits. Defaults to \code{"LBSTNRHI"}.} - -\item{dataset_disp}{\verb{[dv.manager::mm_dispatch()]} - -This is only for advanced usage. An mm_dispatch object. -Cannot be used together with the parameter \code{dataset_names}.} } \value{ A list containing the following elements to be used by the diff --git a/vignettes/disp.Rmd b/vignettes/disp.Rmd deleted file mode 100644 index c5b273d..0000000 --- a/vignettes/disp.Rmd +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: "Usage of {dv.manager} dispatchers" -output: rmarkdown::html_vignette -vignette: > - %\VignetteIndexEntry{Usage of {dv.manager} dispatchers} - %\VignetteEngine{knitr::rmarkdown} - %\VignetteEncoding{UTF-8} ---- - -```{r, include = FALSE} -knitr::opts_chunk$set( - eval = FALSE, - collapse = TRUE, - comment = "#>" -) -``` - -## How to set up an eDISH module using dispatchers - -**Dispatchers** are helper functions that allow accessing data and utility functions inside module manager -in a dynamic way. Refer to `?dv.manager::mm_dispatch` for more information about their functionalities. -Below, you can find two examples on how they can be used to set up an eDISH module. -Note that it is not possible to use both arguments, `dataset_names` and `dataset_disp`, -at the same time in a `mod_edish()` call. - -### a. Filtered data - -This code piece produces essentially the same app behavior as using the `dataset_names` argument. -That is, any selection made by the user in the global filter menu affects the module display. - -```{r filtered, eval = FALSE} -mod_edish( - module_id = "edish_a", - dataset_disp = dv.manager::mm_dispatch( - from = "filtered_dataset", - selection = c("dm", "lb") - ) -) -``` - - -### b. Unfiltered data - -In case it is undesirable that global filter settings affect the listings displayed in the eDISH module, -it is possible to define the dispatcher such that it delivers always unfiltered data. -This means that [any global filter will be ignored]{.ul}! - -```{r unfiltered, eval = FALSE} -mod_edish( - module_id = "edish_b", - dataset_disp = dv.manager::mm_dispatch( - from = "unfiltered_dataset", - selection = c("dm", "lb") - ) -) -```