-
-
Notifications
You must be signed in to change notification settings - Fork 2
📑 Reporter Refactor: Adds support for new teal_report and teal_card class
#353
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 18 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
74e72d8
set Remotes
m7pr b0063a9
remove unneeded reporter code
m7pr f6cf348
[skip style] [skip vbump] Restyle files
github-actions[bot] e7d0f45
add inheritsection
m7pr 707e2bf
add teal_cards
m7pr 1e9b712
[skip style] [skip vbump] Restyle files
github-actions[bot] d9fb7dd
Merge branch 'main' into teal_reportable
m7pr 7c6f94a
final cleanup
m7pr c9eb0f6
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr 90271fb
add Descriptive Statistics section
m7pr d8613e3
Update R/tm_g_gh_spaghettiplot.R
m7pr 649a7b1
Update R/tm_g_gh_correlationplot.R
m7pr 0720f14
Update R/tm_g_gh_lineplot.R
m7pr 697c9cf
Update R/tm_g_gh_scatterplot.R
m7pr f74c86e
build teal_report on top of the previous one, so we dont duplicate te…
m7pr 3d435bd
substitute append.teal_card with c.teal_card
m7pr 6bf7413
[skip style] [skip vbump] Restyle files
github-actions[bot] 11a67a2
Merge branch 'main' into teal_reportable
m7pr 109c80d
Merge branch 'main' into teal_reportable
m7pr ce72477
remove whitespaces from code
m7pr 7b89791
Update DESCRIPTION
averissimo f0799c9
update teal and teal.reporter
m7pr 2119ddc
main is default branch
m7pr 4a28f5c
set_dims for plots
m7pr 6eeb8d8
[skip style] [skip vbump] Restyle files
github-actions[bot] 189c4e1
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] e3c4ca8
old version of set_attrs
m7pr 8eca03d
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr 7a0f979
bring back constrains for boxplot
m7pr 86d9d7d
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] ed95681
fixes for tm_g_gh_density
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,8 @@ | |
| #' @author Jeff Tomlinson (tomlinsj) [email protected] | ||
| #' @author Balazs Toth (tothb2) [email protected] | ||
| #' | ||
| #' @inheritSection teal::example_module Reporting | ||
| #' | ||
| #' @return an \code{\link[teal]{module}} object | ||
| #' | ||
| #' @export | ||
|
|
@@ -240,9 +242,6 @@ ui_g_boxplot <- function(id, ...) { | |
| ) | ||
| ), | ||
| encoding = tags$div( | ||
| ### Reporter | ||
| teal.reporter::simple_reporter_ui(ns("simple_reporter")), | ||
| ### | ||
| templ_ui_dataname(a$dataname), | ||
| uiOutput(ns("axis_selections")), | ||
| templ_ui_constraint(ns, label = "Data Constraint"), # required by constr_anl_q | ||
|
|
@@ -286,8 +285,6 @@ ui_g_boxplot <- function(id, ...) { | |
|
|
||
| srv_g_boxplot <- function(id, | ||
| data, | ||
| reporter, | ||
| filter_panel_api, | ||
| dataname, | ||
| param_var, | ||
| trt_group, | ||
|
|
@@ -298,8 +295,6 @@ srv_g_boxplot <- function(id, | |
| hline_vars_colors, | ||
| hline_vars_labels, | ||
| module_args) { | ||
| 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") | ||
|
|
||
|
|
@@ -382,7 +377,6 @@ srv_g_boxplot <- function(id, | |
|
|
||
| create_plot <- debounce(reactive({ | ||
| teal::validate_inputs(iv_r()) | ||
|
|
||
| req(anl_q()) | ||
| # nolint start | ||
| param <- input$xaxis_param | ||
|
|
@@ -425,7 +419,15 @@ srv_g_boxplot <- function(id, | |
| ) | ||
| } | ||
|
|
||
| anl_q()$qenv %>% teal.code::eval_code( | ||
| obj <- anl_q()$qenv | ||
| teal.reporter::teal_card(obj) <- | ||
| c( | ||
| teal.reporter::teal_card("# Box Plot"), | ||
| teal.reporter::teal_card(obj), | ||
| teal.reporter::teal_card("## Plot") | ||
| ) | ||
|
|
||
| obj %>% teal.code::eval_code( | ||
| code = bquote({ | ||
| p <- goshawk::g_boxplot( | ||
| data = ANL, | ||
m7pr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
@@ -511,40 +513,7 @@ srv_g_boxplot <- function(id, | |
|
|
||
| code <- reactive(teal.code::get_code(joined_qenvs())) | ||
|
|
||
| ### REPORTER | ||
| if (with_reporter) { | ||
| card_fun <- function(comment, label) { | ||
| constraint_description <- paste( | ||
| "\nFacet By:", | ||
| if (length(input$facet_var) != 0) input$facet_var else "None", | ||
| "\nSelect an X-axis Variable:", | ||
| input$xaxis_var | ||
| ) | ||
| card <- report_card_template_goshawk( | ||
| title = "Box Plot", | ||
| label = label, | ||
| with_filter = with_filter, | ||
| filter_panel_api = filter_panel_api, | ||
| constraint_list = list( | ||
| constraint_var = input$constraint_var, | ||
| constraint_range_min = input$constraint_range_min, | ||
| constraint_range_max = input$constraint_range_max | ||
| ), | ||
m7pr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| constraint_description = constraint_description, | ||
| style = "verbatim" | ||
| ) | ||
| card$append_text("Plot", "header3") | ||
| card$append_plot(plot_r(), dim = boxplot_data$dim()) | ||
| if (!comment == "") { | ||
| card$append_text("Comment", "header3") | ||
| card$append_text(comment) | ||
| } | ||
| card$append_src(code()) | ||
| card | ||
| } | ||
| teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) | ||
| } | ||
| ### | ||
|
|
||
|
|
||
| # highlight plot area | ||
| reactive_df <- debounce(reactive({ | ||
|
|
@@ -583,5 +552,6 @@ srv_g_boxplot <- function(id, | |
| verbatim_content = reactive(code()), | ||
| title = "Show R Code for Boxplot" | ||
| ) | ||
| create_plot | ||
| }) | ||
| } | ||
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 |
|---|---|---|
|
|
@@ -50,6 +50,9 @@ | |
| #' @author Nick Paszty (npaszty) [email protected] | ||
| #' @author Balazs Toth (tothb2) [email protected] | ||
| #' | ||
| #' @inheritSection teal::example_module Reporting | ||
| #' | ||
| #' | ||
| #' @examples | ||
| #' # Example using ADaM structure analysis dataset. | ||
| #' data <- teal_data() | ||
|
|
@@ -278,9 +281,6 @@ ui_g_correlationplot <- function(id, ...) { | |
| teal.widgets::standard_layout( | ||
| output = templ_ui_output_datatable(ns), | ||
| encoding = tags$div( | ||
| ### Reporter | ||
| teal.reporter::simple_reporter_ui(ns("simple_reporter")), | ||
| ### | ||
| templ_ui_dataname(a$dataname), | ||
| uiOutput(ns("axis_selections")), | ||
| templ_ui_constraint(ns, "X-Axis Data Constraint"), # required by constr_anl_q | ||
|
|
@@ -351,8 +351,6 @@ ui_g_correlationplot <- function(id, ...) { | |
|
|
||
| srv_g_correlationplot <- function(id, | ||
| data, | ||
| reporter, | ||
| filter_panel_api, | ||
| dataname, | ||
| param_var, | ||
| trt_group, | ||
|
|
@@ -366,8 +364,6 @@ srv_g_correlationplot <- function(id, | |
| vline_vars_colors, | ||
| vline_vars_labels, | ||
| module_args) { | ||
| 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") | ||
|
|
||
|
|
@@ -774,8 +770,16 @@ srv_g_correlationplot <- function(id, | |
| validate(need(input$trt_group, "Please select a treatment variable")) | ||
| trt_group <- input$trt_group | ||
|
|
||
| obj <- plot_data_transpose()$qenv | ||
| teal.reporter::teal_card(obj) <- | ||
| c( | ||
| teal.reporter::teal_card("# Correlation Plot"), | ||
| teal.reporter::teal_card(obj), | ||
| teal.reporter::teal_card("## Plot") | ||
| ) | ||
|
|
||
| teal.code::eval_code( | ||
| object = plot_data_transpose()$qenv, | ||
| object = obj, | ||
| code = bquote({ | ||
| # re-establish treatment variable label | ||
| p <- goshawk::g_correlationplot( | ||
|
|
@@ -835,40 +839,7 @@ srv_g_correlationplot <- function(id, | |
|
|
||
| code <- reactive(teal.code::get_code(plot_q())) | ||
|
|
||
| ### REPORTER | ||
| if (with_reporter) { | ||
| card_fun <- function(comment, label) { | ||
| constraint_description <- paste( | ||
| "\nTreatment Variable Faceting:", | ||
| input$trt_facet, | ||
| "\nRegression Line:", | ||
| input$reg_line | ||
| ) | ||
| card <- report_card_template_goshawk( | ||
| title = "Correlation Plot", | ||
| label = label, | ||
| with_filter = with_filter, | ||
| filter_panel_api = filter_panel_api, | ||
| constraint_list = list( | ||
| constraint_var = input$constraint_var, | ||
| constraint_range_min = input$constraint_range_min, | ||
| constraint_range_max = input$constraint_range_max | ||
| ), | ||
| constraint_description = constraint_description, | ||
| style = "verbatim" | ||
| ) | ||
| card$append_text("Plot", "header3") | ||
| card$append_plot(plot_r(), dim = plot_data$dim()) | ||
| if (!comment == "") { | ||
| card$append_text("Comment", "header3") | ||
| card$append_text(comment) | ||
| } | ||
| card$append_src(code()) | ||
| card | ||
| } | ||
| teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) | ||
| } | ||
| ### | ||
|
|
||
|
|
||
| reactive_df <- debounce(reactive({ | ||
| req(iv_r()$is_valid()) | ||
|
|
@@ -900,5 +871,6 @@ srv_g_correlationplot <- function(id, | |
| verbatim_content = reactive(code()), | ||
| title = "Show R Code for Correlation Plot" | ||
| ) | ||
| plot_q | ||
| }) | ||
| } | ||
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 |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |
| #' | ||
| #' @author Nick Paszty (npaszty) [email protected] | ||
| #' @author Balazs Toth (tothb2) [email protected] | ||
| #' @inheritSection teal::example_module Reporting | ||
| #' | ||
| #' @details None | ||
| #' | ||
|
|
@@ -191,9 +192,6 @@ ui_g_density_distribution_plot <- function(id, ...) { | |
| ) | ||
| ), | ||
| encoding = tags$div( | ||
| ### Reporter | ||
| teal.reporter::simple_reporter_ui(ns("simple_reporter")), | ||
| ### | ||
| templ_ui_dataname(a$dataname), | ||
| uiOutput(ns("axis_selections")), | ||
| templ_ui_constraint(ns, label = "Data Constraint"), | ||
|
|
@@ -237,8 +235,6 @@ ui_g_density_distribution_plot <- function(id, ...) { | |
|
|
||
| srv_g_density_distribution_plot <- function(id, # nolint | ||
| data, | ||
| reporter, | ||
| filter_panel_api, | ||
| dataname, | ||
| param_var, | ||
| param, | ||
|
|
@@ -248,8 +244,6 @@ srv_g_density_distribution_plot <- function(id, # nolint | |
| plot_height, | ||
| plot_width, | ||
| module_args) { | ||
| 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") | ||
|
|
||
|
|
@@ -341,8 +335,16 @@ srv_g_density_distribution_plot <- function(id, # nolint | |
| # nolint end | ||
|
|
||
|
|
||
| obj <- anl_q()$qenv | ||
| teal.reporter::teal_card(obj) <- | ||
| c( | ||
| teal.reporter::teal_card("# Density Distribution Plot"), | ||
| teal.reporter::teal_card(obj), | ||
| teal.reporter::teal_card("## Plot") | ||
| ) | ||
|
|
||
| teal.code::eval_code( | ||
| object = anl_q()$qenv, | ||
| object = obj, | ||
| code = bquote({ | ||
| p <- goshawk::g_density_distribution_plot( | ||
| data = ANL, | ||
|
|
@@ -370,14 +372,16 @@ srv_g_density_distribution_plot <- function(id, # nolint | |
|
|
||
| create_table <- debounce(reactive({ | ||
| req(iv_r()$is_valid()) | ||
| req(anl_q()) | ||
| req(create_plot()) | ||
| param <- input$xaxis_param | ||
| xaxis_var <- input$xaxis_var | ||
| font_size <- input$font_size | ||
| trt_group <- input$trt_group | ||
|
|
||
| obj <- create_plot() | ||
m7pr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| teal.reporter::teal_card(obj) <- c(teal.reporter::teal_card(obj), "## Descriptive Statistics") | ||
| teal.code::eval_code( | ||
| object = anl_q()$qenv, | ||
| object = obj, | ||
| code = bquote({ | ||
| tbl <- goshawk::t_summarytable( | ||
| data = ANL, | ||
|
|
@@ -414,48 +418,14 @@ srv_g_density_distribution_plot <- function(id, # nolint | |
| DT::formatRound(numeric_cols, 2) | ||
| }) | ||
|
|
||
| joined_qenvs <- reactive({ | ||
| req(create_plot(), create_table()) | ||
| c(create_plot(), create_table()) | ||
| }) | ||
|
|
||
| code <- reactive(teal.code::get_code(joined_qenvs())) | ||
| code <- reactive(teal.code::get_code(create_table())) | ||
|
|
||
| teal.widgets::verbatim_popup_srv( | ||
| id = "rcode", | ||
| verbatim_content = reactive(code()), | ||
| title = "Show R Code for Density Distribution Plot" | ||
| ) | ||
|
|
||
| ### REPORTER | ||
| if (with_reporter) { | ||
| card_fun <- function(comment, label) { | ||
| card <- report_card_template_goshawk( | ||
| title = "Density Distribution Plot", | ||
| label = label, | ||
| with_filter = with_filter, | ||
| filter_panel_api = filter_panel_api, | ||
| constraint_list = list( | ||
| constraint_var = input$constraint_var, | ||
| constraint_range_min = input$constraint_range_min, | ||
| constraint_range_max = input$constraint_range_max | ||
| ) | ||
| ) | ||
| card$append_text("Plot", "header3") | ||
| card$append_plot(plot_r(), dim = plot_data$dim()) | ||
| card$append_text("Descriptive Statistics", "header3") | ||
| card$append_table( | ||
| create_table()[["tbl"]] %>% dplyr::mutate_if(is.numeric, round, 2) | ||
| ) | ||
| if (!comment == "") { | ||
| card$append_text("Comment", "header3") | ||
| card$append_text(comment) | ||
| } | ||
| card$append_src(code()) | ||
| card | ||
| } | ||
| teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) | ||
| } | ||
| ### | ||
| create_table | ||
| }) | ||
| } | ||
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.