-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor of the filter panel #851
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduces changes necessary to handle the new Filter Panel API coming from [this PR](insightsengineering/teal.slice#222). --------- Co-authored-by: Dawid Kałędkowski <[email protected]> Co-authored-by: Andrew Bates <[email protected]> Co-authored-by: asbates <[email protected]> Co-authored-by: chlebowa <[email protected]> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
The follow-up after insightsengineering/coredev-tasks#235 The current spelling-check output is below. `omics` is a part of `multi-omics`. `pre-selected` is treated as spelling mistake either if it's written `pre-selected` or `preselected`. `themer` and `theming` are a part of subject-language about themes. `tabsetted` does not seem to be an English word, even though TabSet class became of common word around developers. ```{R} spelling::spell_check_package() WORD FOUND IN Forkers README.md:75,85,87 funder teal-package.Rd:32 Hoffmann teal-package.Rd:32 omics README.md:29 including-mae-data-in-teal.Rmd:13 preselected teal.Rmd:101 programmatically NEWS.md:118 repo README.md:9,15,83,87 reproducibility init.Rd:24,25 srv_teal_with_splash.Rd:23,24 ui_teal_with_splash.Rd:25,26 NEWS.md:71,91,282 README.md:44 adding-support-for-reporting.Rmd:238 including-adam-data-in-teal.Rmd:16,104 including-general-data-in-teal.Rmd:80 including-mae-data-in-teal.Rmd:41 preprocessing-data.Rmd:87 teal.Rmd:75 tabsetted ui_teal.Rd:43 themer teal-bs-themes.Rmd:188,222 theming teal-bs-themes.Rmd:39,108 TLG README.md:53 UI init.Rd:5 srv_teal.Rd:103 ui_nested_tabs.Rd:8,35,42 ui_tabs_with_filters.Rd:25 ui_teal.Rd:5,19,20,35,38,41,43,46 ui_teal_with_splash.Rd:5 NEWS.md:118,194,210,313,317,366 creating-custom-modules.Rmd:47,49,52 teal-options.Rmd:89 teal.Rmd:59 UIs ui_tabs_with_filters.Rd:5 uncheck teal-bs-themes.Rmd:175 UX teal-options.Rmd:89 ```
Code Coverage Summary
Diff against main
Results for commit: e3b3a42 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
this fixes insightsengineering/teal.slice#330 Here in this PR , parameter module_add is being added to teal::teal_filters() which passes parameter value to teal.slice::filter_settings() function. Testing code: ``` options(teal.log_level = "TRACE", teal.show_js_log = TRUE) # options("teal.bs_theme" = bslib::bs_theme(version = 5)) # options(shiny.trace = TRUE) # todo: change groupCheckbox to include locked (not able to interact with) # change groupCheckbox to have some colors (instead of grey) # todo: available filter should present information about selected values (for example tooltip) library(shiny) library(scda) library(scda.2022) library(teal.data) library(teal.transform) library(teal.modules.general) pkgload::load_all() funny_module <- function (label = "Filter states", datanames = "all") { checkmate::assert_string(label) module( label = label, filters = datanames, ui = function(id, ...) { ns <- NS(id) div( h2("The following filter calls are generated:"), verbatimTextOutput(ns("filter_states")), verbatimTextOutput(ns("filter_calls")), actionButton(ns("reset"), "reset_to_default") ) }, server = function(input, output, session, data, filter_panel_api) { checkmate::assert_class(data, "tdata") observeEvent(input$reset, set_filter_state(filter_panel_api, default_filters)) output$filter_states <- renderPrint({ logger::log_trace("rendering text1") filter_panel_api %>% get_filter_state() }) output$filter_calls <- renderText({ logger::log_trace("rendering text2") attr(data, "code")() }) } ) } ADSL <- synthetic_cdisc_data("latest")$adsl ADSL$empty <- NA ADSL$logical1 <- FALSE ADSL$logical <- sample(c(TRUE, FALSE), size = nrow(ADSL), replace = TRUE) ADSL$numeric <- rnorm(nrow(ADSL)) ADSL$categorical2 <- sample(letters[1:10], size = nrow(ADSL), replace = TRUE) ADSL$categorical <- sample(letters[1:3], size = nrow(ADSL), replace = TRUE, prob = c(.1, .3, .6)) ADSL$date <- Sys.Date() + seq_len(nrow(ADSL)) ADSL$date2 <- rep(Sys.Date() + 1:3, length.out = nrow(ADSL)) ADSL$datetime <- Sys.time() + seq_len(nrow(ADSL)) * 3600 * 12 ADSL$datetime2 <- rep(Sys.time() + 1:3 * 43200, length.out = nrow(ADSL)) ADSL$numeric[sample(1:nrow(ADSL), size = 10)] <- NA ADSL$numeric[sample(1:nrow(ADSL), size = 10)] <- Inf ADSL$logical[sample(1:nrow(ADSL), size = 10)] <- NA ADSL$date[sample(1:nrow(ADSL), size = 10)] <- NA ADSL$datetime[sample(1:nrow(ADSL), size = 10)] <- NA ADSL$categorical2[sample(1:nrow(ADSL), size = 10)] <- NA ADSL$categorical[sample(1:nrow(ADSL), size = 10)] <- NA ADTTE <- synthetic_cdisc_data("latest")$adtte ADRS <- synthetic_cdisc_data("latest")$adrs ADTTE$numeric <- rnorm(nrow(ADTTE)) ADTTE$numeric[sample(1:nrow(ADTTE), size = 10,)] <- NA default_filters <- teal::teal_filters( filter_var(dataname = "ADSL", varname = "categorical", selected = c("a", "b"), id = "categorical", locked = TRUE), filter_var(dataname = "ADSL", varname = "categorical2", selected = c("a", "b"), locked = TRUE), filter_var(dataname = "ADSL", varname = "numeric", selected = c(0, 140), keep_na = TRUE, keep_inf = TRUE), filter_var(dataname = "ADSL", varname = "logical", selected = c(T), keep_na = TRUE, keep_inf = TRUE), filter_var(dataname = "ADSL", varname = "datetime"), filter_var(dataname = "ADSL", varname = "date2"), filter_expr(id = "AF", title = "ADULT FEMALE", dataname = "ADSL", expr = "SEX %in% 'F' & AGE >= 18L"), filter_expr(id = "SE", title = "Safety-Evaluable", dataname = "ADSL", expr = "SAFFL == 'Y'"), filter_var(dataname = "ADSL", varname = "COUNTRY", selected = c("USA", "CAN", "JPN"), fixed = TRUE), count_type = "all", include_varnames = list(ADSL = c("SEX", "categorical", "categorical2", "numeric", "logical", "date", "datetime", "date2", "datetime2", "COUNTRY")), exclude_varnames = list( ADTTE = intersect(colnames(ADSL), colnames(ADTTE)), ADRS = colnames(ADSL) ), mapping = list( `table` = "categorical" ), module_specific = TRUE, module_add = FALSE # set it to true for seeing filter add module ) app <- init( data = cdisc_data( cdisc_dataset("ADSL", ADSL), cdisc_dataset("ADTTE", ADTTE), cdisc_dataset("ADRS", ADRS) ), modules = modules( tm_data_table( "table", variables_selected = list(ADSL = c("STUDYID", "USUBJID", "SUBJID", "SITEID", "AGE", "SEX")), dt_args = list(caption = "ADSL Table Caption") ), modules( label = "tab1", funny_module("funny", datanames = NULL), funny_module("funny2", datanames = "ADTTE") # will limit datanames to ADTTE and ADSL (parent) ) ), filter = default_filters ) runApp(app) ``` Co-authored-by: kartikeya <[email protected]>
Closes insightsengineering/teal.slice#368 Description in insightsengineering/teal.slice#370
update DESCRIPTION fix checks error
Code Coverage Summary
Diff against main
Results for commit: 803994b Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Part of insightsengineering/teal.slice#52 --------- Co-authored-by: Aleksander Chlebowski <[email protected]>
chlebowa
approved these changes
Jul 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To observe checks