-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Feature branch PR #1253
Merged
Merged
Feature branch PR #1253
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
✅ All contributors have signed the CLA |
vedhav
force-pushed
the
669_insertUI@main
branch
from
June 27, 2024 09:06
b101156
to
8e78255
Compare
- mapping_matrix works - initializing filters works - restoring filters after data reload works
averissimo
reviewed
Aug 9, 2024
Changed the way how datanames are passed between teal_data instances
Changes: 1. Adds the section on how to place the transform UI in the custom position inside the module. 2. Formats the `_pkgdown.yml` file (No change made to the file, just styling) 3. Extend the `example_module()` to handle the selection when datasets change (This can happen when using DDL to change datasets completely, such an example will be added to `teal.gallery`) --------- Signed-off-by: Vedha Viyash <[email protected]> Co-authored-by: Marcin <[email protected]> Co-authored-by: m7pr <[email protected]> Co-authored-by: Dony Unardi <[email protected]>
Part of #1253 ### Changes description - `check_modules_datanames` returns a string and HTML generator for: - **string**: to be used with logger - **HTML**: function to be used in teal UI - Message is generated in the same way. This adds complexity, but is consistent - `c("one", "two", "three")` renders as "one, two and three" (note the comma and `and`) - In the module context it doesn't show the current module label <details> <summary>Sample app</summary> ```r options( teal.log_level = "TRACE", teal.show_js_log = TRUE, # teal.bs_theme = bslib::bs_theme(version = 5), shiny.bookmarkStore = "server" ) pkgload::load_all("teal.data") pkgload::load_all("teal.slice") pkgload::load_all("teal") my_transformers <- list( teal_transform_module( label = "reactive ADSL", ui = function(id) { ns <- NS(id) tagList( div("Some UI for transform (merge)"), actionButton(ns("btn"), "Reload data") ) }, server = function(id, data) { moduleServer(id, function(input, output, session) { eventReactive(input$btn, { data() }) }) } ), teal_transform_module( label = "Keep first 6 from IRIS", ui = function(id) { ns <- NS(id) div( span("Some UI for transform (1)"), textInput(ns("obs"), label = "Number of rows", value = 6) ) }, server = function(id, data) { moduleServer(id, function(input, output, session) { reactive({ req(data()) obs <- as.numeric(input$obs) if (!is.finite(obs)) stop("NOT NUMERIC.") within(data(), iris <- head(iris, n), n = as.numeric(input$obs)) }) }) } ), teal_transform_module( label = "Keep first 6 from ADTTE", ui = function(id) div("Some UI for transform 2"), server = function(id, data) { moduleServer(id, function(input, output, session) { reactive({ req(data()) within(data(), ADTTE <- head(ADTTE)) }) }) } ) ) data <- teal_data_module( once = FALSE, ui = function(id) { ns <- NS(id) tagList( numericInput(ns("obs"), "Number of observations to show", 1000), actionButton(ns("submit"), label = "Submit") ) }, server = function(id, ...) { moduleServer(id, function(input, output, session) { logger::log_trace("example_module_transform2 initializing.") eventReactive(input$submit, { data <- teal_data() |> within( { logger::log_trace("Loading data") ADSL <- head(teal.data::rADSL, n = n) ADTTE <- teal.data::rADTTE iris <- iris CO2 <- CO2 factors <- names(Filter(isTRUE, vapply(CO2, is.factor, logical(1L)))) CO2[factors] <- lapply(CO2[factors], as.character) }, n = as.numeric(input$obs) ) join_keys(data) <- default_cdisc_join_keys[c("ADSL", "ADTTE")] teal.data::datanames(data) <- c("ADSL", "ADTTE", "iris", "CO2") data }) }) } ) teal::init( data = data, modules = list( example_module("mod-1", datanames = "all"), example_module("mod-2", transformers = my_transformers, datanames = c("ADSL", "ADTTE", "iris", "elo")), modules( label = "sub-modules", example_module("mod-2-sub1", transformers = my_transformers, datanames = c("ADSL", "ADTTE", "iris", "elo", "elo2")), example_module("mod-2-sub2", transformers = my_transformers, datanames = c("ADSL", "ADTTE", "iris", "elo")) ), example_module("mod-2", transformers = my_transformers[2:3]) ), filter = teal_slices( teal_slice("ADSL", "SEX"), teal_slice("ADSL", "AGE", selected = c(18L, 65L)) ) ) |> runApp() ``` </details> ![image](https://github.com/user-attachments/assets/9a6c09a6-2ce4-4c2b-b7f6-0cce7ab8670c) ![image](https://github.com/user-attachments/assets/2b4a8dd1-f7e7-44f8-80d3-9cb45dd3909b)
m7pr
added a commit
to insightsengineering/teal.data
that referenced
this pull request
Aug 12, 2024
…`datanames()` with parent dataset when it is provided in `join_keys` (#319) Part of insightsengineering/teal#1253 This PR introduced below changes - `teal_data()` constructor does not put `names(join_keys)` in default `datanames(teal_data())` to maintain consistency with other features, where we do not allow `datanames()` to contain names of objects that do not exist in `@env` - `datanames()` now sorts names topologically based on provided `join_keys()` - each time `datanames()` and `join_keys()` is overwritten the sort is applied to `teal_data()@datanames` - provided few more tests - adjusted 2 tests that assumed extraction of `datanames()` from `join_keys` is fine - but it's not right now as we do not allow `datanames()` to contain names of objects that do not exists in `@env` Will provide testing in this PR in teal as well https://github.com/insightsengineering/teal/pull/1280/files --------- Signed-off-by: Marcin <[email protected]> Co-authored-by: André Veríssimo <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: go_gonzo <[email protected]>
- supersede tdata - set next version to 0.16 (at this moment)
averissimo
approved these changes
Aug 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go!
Fixed one small error on tests
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #669 #860 insightsengineering/teal.slice#62 #1228
teal.slice
branch669_insertUI@main
to check:
tm_front_page
(similar toreporter_previewer
) 1287 Do not show filter panel for modules without datanames #1292tm_outliers
can not create a report card /Error : Can't subset columns that don't exist. ✖ Column order doesn't exist.
teal.modules.general#768ggplot2_args
for caption or subtitle be applied to all plots intm_g_association
teal.modules.general#769warning('Code was not verified for reproducibility.')
shown twice inShow R Code
#1286 do not duplicate verification warning message, if it already existed in@code
teal.data#322teal.connector.harbour
@m7pr (also tested by @vedhav on week 30)teal.connector.cdse
@averissimoteal.connector.rice
@averissimo (tested by @vedhav on week 30)teal.connector.ssh
@averissimo Adds prefix onssh_authenticator
call fromwithin
teal.connectors.ssh#8ui_teal
andsrv_teal
in any application (see teal as a module example below)teal_data_module
doesn't work on main branch. On main, ddl apps can't be restored. On the feature branch, apps are restored after clicking "submit" inteal_data_module
teal_bookmarkable = TRUE
are still bookmarkable.data
module away from modal Data module as tab@669 insert UI@main #1273shinytest2
data_summary
@m7prlanding_popup
- @vedhav Add landing popup argument ininit
and soft deprecate calling it as a normal module #1284filter_panel
@m7pr AdjustTealAppDriver
methods forfilter_panel
shinytest2
tests #1281reporter
@m7prutils
@m7prinit
modules
- 1 not fixed, rest will be fixed with AdjustTealAppDriver
methods forfilter_panel
shinytest2
tests #1281show_r_code
@m7prteal_data_module
2 tests fail because of this issue Feature branch PR #1253 (comment)teal_data_module
tests. It is initialized with other tabs disabled. There is aonce
argument to change the behavior of the data tab. @vedhav Adds tests to check the new features of teal_data_module #1293teal_slices
@m7pr AdjustTealAppDriver
methods forfilter_panel
shinytest2
tests #1281wunder_bar
module_bookmark_manager
topological_sort
ondatanames()
#1280test-module_teal.R
@m7pronce = TRUE
inteal_data_module
so that data can be pulled only once. It should be a default value as normally people would read static data. @vedhavback
andreset
JS buttons are made visible during module init if the same filter cards are present in other module that was initialized. The private$state_history() is changed because of other module, have to change the if condition for the toggle.icon("fas fa-grip")
@averissimoteal_data_module
andteal_transform_module
can't use the same constructor as they differ or we should better define their common features. On mainteal_data_module
asserts that server function has onlyid
as formal, while transformers havedata
as well. Also,once
option is dedicated only toteal_data_module
. Have different constructor for "Data" module and "Transform" module #1283landing_page_popup
included in amodules
list - make a new argument inteal::init
. Not handled inmodule_teal
Add landing popup argument ininit
and soft deprecate calling it as a normal module #1284module$datanames
isNULL
. For example inreport_previewer
orfront_page_module
@m7pr 1287 Do not show filter panel for modules without datanames #1292ddl app
teal as a module
Example transformers
Run one or more of the chunks below and use with
example_module(transformer = list(...))
Using it on other modules needs a redefinition of the module with extra
transformer
argument. That is it.Full example extending `tmg::tm_g_scatterplot` to support transformers
Individual transformer definitions
ANL merge transform
Head transformer
Error transformer
Dummy transformer