📑 Refactor: Adds new teal_report, teal_card class and revamps reporter UI#331
Merged
Conversation
Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com>
Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com>
m7pr
requested changes
Sep 3, 2025
Contributor
There was a problem hiding this comment.
There is 5 last tests failing + then a review of R CMD CHECK.
We should also merge those 2 PRs
Lastly we postponed one TODO into a specific issue
and also we will continue, but on another PR, with vignettes
where we outlined that we will also rethink after function naming and implementaion
…383) # Pull Request - Fixes insightsengineering/coredev-tasks#390 ### Changes description - Adds global option that sets the default size for plots - Allows to customise dimensions on `chunk_output` attributes (`dev.width` and `dev.height`) <details> <summary>Example app (KM + custom sized Histogram in reports)</summary> ```r # Make sure the required branches are checked-out # - teal_reporter (all 4: teal, teal.reporter, teal.code, teal.data) # - redesign@main (teal, teal.reporter, teal.code) pkgload::load_all("../teal.reporter") pkgload::load_all("../teal") example_extended <- function(label = "example teal module", datanames = "all", transformators = list(), decorators = list()) { checkmate::assert_string(label) checkmate::assert_list(decorators, "teal_transform_module") mod <- example_module(label, datanames, transformators, decorators) module( label, server = function(id, data, decorators) { moduleServer(id, function(input, output, session) { result <- mod$server("example", data, decorators) reactive({ q <- result() teal_card(q) <- c(teal_card(q), "### Iris") q <- q |> within( hist(1:10) ) attr(teal_card(q)[[length(teal_card(q))]], "dev.width") <- 200 attr(teal_card(q)[[length(teal_card(q))]], "dev.height") <- 200 q <- q |> within({ something <- iris something }) q }) }) }, ui = function(id, decorators) mod$ui(shiny::NS(id, "example"), decorators), ui_args = mod$ui_args, server_args = mod$server_args, datanames = mod$datanames, transformators = mod$transformators ) } data <- teal_data() data <- within(data, { library(dplyr) ADSL <- teal.modules.clinical::tmc_ex_adsl ADTTE <- teal.modules.clinical::tmc_ex_adtte iris <- iris CO2 <- CO2 }) join_keys(data) <- default_cdisc_join_keys[names(data)] #' ADSL <- data[["ADSL"]] ADTTE <- data[["ADTTE"]] #' arm_ref_comp <- list( ACTARMCD = list( ref = "ARM B", comp = c("ARM A", "ARM C") ), ARM = list( ref = "B: Placebo", comp = c("A: Drug X", "C: Combination") ) ) teal::init( data = data, modules = modules( tm_g_km( label = "Kaplan-Meier Plot", dataname = "ADTTE", arm_var = choices_selected( variable_choices(ADSL, c("ARM", "ARMCD", "ACTARMCD")), "ARM" ), paramcd = choices_selected( value_choices(ADTTE, "PARAMCD", "PARAM"), "OS" ), arm_ref_comp = arm_ref_comp, strata_var = choices_selected( variable_choices(ADSL, c("SEX", "BMRKR2")), "SEX" ), facet_var = choices_selected( variable_choices(ADSL, c("SEX", "BMRKR2")), NULL ) ), example_extended(label = "🆕 Module (extended)") ) ) |> shiny::runApp() ``` </details> --------- Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com> Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> Co-authored-by: Marcin <133694481+m7pr@users.noreply.github.com>
m7pr
reviewed
Sep 3, 2025
2 tasks
This file contains hidden or 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
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.
Pull Request
Fixes:
Built on top of:
teal.reporterCards #307teal.reporterCards #307 will be closed once this PR is stable)Companion PRs:
teal_reportandteal_cardclass teal#1541{teal}module returns ateal_reportobject that extends fromteal_datateal.code#255{teal}module returns ateal_reportobject that extends fromteal_datateal.data#370teal_report,teal_cardclass and revamps reporter UI #331teal_reportandteal_cardclass teal.modules.general#884teal_reportandteal_cardclass teal.modules.clinical#1392Changes description
teal_reportthat extendsteal_dataeval_code()andeval_code(cache = TRUE)report(<teal_report>)report_documenttodoc/document/page(final name TBD)