-
-
Notifications
You must be signed in to change notification settings - Fork 2
📑 Reporter Refactor: Adds support for new teal_report and teal_card class
#308
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
Merged
Merged
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
44ab94d
set Remotes and vbump packages
m7pr dbc0f5d
initial attempt
m7pr 3493b5d
substitute card_fun with teal_card
m7pr 6e82948
[skip style] [skip vbump] Restyle files
github-actions[bot] c001116
add selected_options
m7pr 97751af
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr 198218a
[skip style] [skip vbump] Restyle files
github-actions[bot] 4639631
Merge branch 'main' into teal_reportable
m7pr 683ec62
Update DESCRIPTION
m7pr eb550c1
missing )
m7pr 1c35d66
[skip style] [skip vbump] Restyle files
github-actions[bot] 00d99cc
remove extra plot calls
m7pr d8d0712
[skip style] [skip vbump] Restyle files
github-actions[bot] 2887192
Empty-Commit
m7pr fc3de33
vbump teal and teal.reporter
m7pr e3e221e
revert back expression(library to 'library'
m7pr b3201c1
add support for plots size
m7pr 701a7e6
[skip style] [skip vbump] Restyle files
github-actions[bot] 0b086be
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] 3aa11ec
indirect pws setup throug srv_g_decorate
m7pr c88d97a
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr 28de182
Update R/tm_g_spiderplot.R
m7pr a1a28b8
Update R/utils.R
m7pr f67875c
[skip style] [skip vbump] Restyle files
github-actions[bot] 88116b9
add plot settings for heat_bygrade
m7pr 97c0d2b
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr 8180fd8
Apply suggestions from code review
m7pr 9d20593
replace the way we call dplyr in modules
m7pr 4b8603c
remove filter_var from waterfall
m7pr 0a8de78
typo
m7pr 7267f78
last changes for waterfall plot
m7pr dd96ec0
lintr
m7pr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| #' @author Molly He (hey59) \email{[email protected]} | ||
| #' | ||
| #' @inherit argument_convention return | ||
| #' @inheritSection teal::example_module Reporting | ||
| #' | ||
| #' @export | ||
| #' | ||
|
|
@@ -104,10 +105,6 @@ ui_g_ae_sub <- function(id, ...) { | |
| plot_decorate_output(id = ns(NULL)) | ||
| ), | ||
| encoding = tags$div( | ||
| ### Reporter | ||
| teal.reporter::add_card_button_ui(ns("add_reporter"), label = "Add Report Card"), | ||
| tags$br(), tags$br(), | ||
| ### | ||
| tags$label("Encodings", class = "text-primary"), | ||
| helpText("Analysis data:", tags$code("ADAE")), | ||
| teal.widgets::optionalSelectInput( | ||
|
|
@@ -175,14 +172,10 @@ ui_g_ae_sub <- function(id, ...) { | |
|
|
||
| srv_g_ae_sub <- function(id, | ||
| data, | ||
| filter_panel_api, | ||
| reporter, | ||
| dataname, | ||
| label, | ||
| plot_height, | ||
| plot_width) { | ||
| with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") | ||
| with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") | ||
| checkmate::assert_class(data, "reactive") | ||
| checkmate::assert_class(shiny::isolate(data()), "teal_data") | ||
|
|
||
|
|
@@ -317,8 +310,16 @@ srv_g_ae_sub <- function(id, | |
| output_q <- shiny::debounce( | ||
| millis = 200, | ||
| r = reactive({ | ||
| ANL <- data()[[dataname]] | ||
| ADSL <- data()[["ADSL"]] | ||
| obj <- data() | ||
| teal.reporter::teal_card(obj) <- | ||
| c( | ||
| teal.reporter::teal_card("# AE by Subgroups"), | ||
| teal.reporter::teal_card(obj), | ||
| teal.reporter::teal_card("## Module's code") | ||
| ) | ||
|
|
||
| ANL <- obj[[dataname]] | ||
| ADSL <- obj[["ADSL"]] | ||
|
|
||
| teal::validate_has_data(ANL, min_nrow = 10, msg = sprintf("%s has not enough data", dataname)) | ||
|
|
||
|
|
@@ -347,29 +348,33 @@ srv_g_ae_sub <- function(id, | |
| bquote(group_labels <- setNames(.(group_labels), .(input$groups))) | ||
| } | ||
|
|
||
| teal.code::eval_code(data(), code = group_labels_call) %>% | ||
| teal.code::eval_code(code = "") %>% | ||
| teal.code::eval_code( | ||
| code = as.expression(c( | ||
| bquote( | ||
| plot <- osprey::g_ae_sub( | ||
| id = .(as.name(dataname))$USUBJID, | ||
| arm = as.factor(.(as.name(dataname))[[.(input$arm_var)]]), | ||
| arm_sl = as.character(ADSL[[.(input$arm_var)]]), | ||
| trt = .(input$arm_trt), | ||
| ref = .(input$arm_ref), | ||
| subgroups = .(as.name(dataname))[.(input$groups)], | ||
| subgroups_sl = ADSL[.(input$groups)], | ||
| subgroups_levels = group_labels, | ||
| conf_level = .(input$conf_level), | ||
| diff_ci_method = .(input$ci), | ||
| fontsize = .(font_size()), | ||
| arm_n = .(input$arm_n), | ||
| draw = TRUE | ||
| ) | ||
| q1 <- teal.code::eval_code(obj, code = group_labels_call) %>% | ||
| teal.code::eval_code(code = "") | ||
|
|
||
| teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") | ||
|
|
||
| teal.code::eval_code( | ||
| q1, | ||
| code = as.expression(c( | ||
| bquote( | ||
| plot <- osprey::g_ae_sub( | ||
| id = .(as.name(dataname))$USUBJID, | ||
| arm = as.factor(.(as.name(dataname))[[.(input$arm_var)]]), | ||
| arm_sl = as.character(ADSL[[.(input$arm_var)]]), | ||
| trt = .(input$arm_trt), | ||
| ref = .(input$arm_ref), | ||
| subgroups = .(as.name(dataname))[.(input$groups)], | ||
| subgroups_sl = ADSL[.(input$groups)], | ||
| subgroups_levels = group_labels, | ||
| conf_level = .(input$conf_level), | ||
| diff_ci_method = .(input$ci), | ||
| fontsize = .(font_size()), | ||
| arm_n = .(input$arm_n), | ||
| draw = TRUE | ||
| ) | ||
| )) | ||
| ) | ||
| ) | ||
| )) | ||
| ) | ||
| }) | ||
| ) | ||
|
|
||
|
|
@@ -380,26 +385,6 @@ srv_g_ae_sub <- function(id, | |
| verbatim_content = reactive(teal.code::get_code(output_q())), | ||
| title = paste("R code for", label), | ||
| ) | ||
|
|
||
| ### REPORTER | ||
| if (with_reporter) { | ||
| card_fun <- function(comment, label) { | ||
| card <- teal::report_card_template( | ||
| title = "AE Subgroups", | ||
| label = label, | ||
| with_filter = with_filter, | ||
| filter_panel_api = filter_panel_api | ||
| ) | ||
| card$append_text("Plot", "header3") | ||
| card$append_plot(plot_r(), dim = pws$dim()) | ||
| if (!comment == "") { | ||
| card$append_text("Comment", "header3") | ||
| card$append_text(comment) | ||
| } | ||
| card$append_src(teal.code::get_code(output_q())) | ||
| card | ||
| } | ||
| teal.reporter::add_card_button_srv("add_reporter", reporter = reporter, card_fun = card_fun) | ||
| } | ||
| set_chunk_dims(pws, output_q) | ||
m7pr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.