Skip to content
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

extend default report previewer #849

Merged
merged 3 commits into from
Jul 7, 2023
Merged

Conversation

gogonzo
Copy link
Contributor

@gogonzo gogonzo commented Jun 13, 2023

closes #848 #638

Done here:

  • on main branch teal automatically appends previewer module to the list of modules. I enabled passing previewer directly to teal::init(modules) to be able to override the default one.
  • exposed server_args argument to customize teal.reporter::report_previewer_srv.

For example

reporter_previewer_module(
  label = "reports", 
  srv_args =  list(
    rmd_yaml_args = list(
    author = "My name is Spartacus", 
    title = "Nice title", 
    date = as.character("2050-01-12"), 
    output = "html_document", 
    toc = FALSE
  )
)
image
library(teal.modules.general)
library(scda)

ADSL <- synthetic_cdisc_data("latest")$adsl
ADTTE <- synthetic_cdisc_data("latest")$adtte

module_variable_browser <- tm_variable_browser(
  label = "Variable browser",
  ggplot2_args = teal.widgets::ggplot2_args(
    labs = list(subtitle = "Plot generated by Variable Browser Module")
  )
)

app <- init(
  data = cdisc_data(
    cdisc_dataset("ADSL", ADSL, code = "ADSL <- synthetic_cdisc_data(\"latest\")$adsl"),
    cdisc_dataset("ADTTE", ADTTE, code = "ADTTE <- synthetic_cdisc_data(\"latest\")$adtte"),
    check = TRUE
  ),
  modules(
    module_variable_browser,
    reporter_previewer_module(
      label = "reports", 
      server_args =  list(
        rmd_yaml_args = list(
          author = "My name is Spartacus", 
          title = "report", 
          date = as.character(Sys.Date()), 
          output = "html_document", 
          toc = FALSE
        )
      )
    )
  )
)


shinyApp(app$ui, app$server)

@gogonzo gogonzo added the core label Jun 13, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 13, 2023

Unit Tests Summary

    1 files    13 suites   14s ⏱️
147 tests 147 ✔️ 0 💤 0
289 runs  289 ✔️ 0 💤 0

Results for commit d49b300.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 13, 2023

badge

Code Coverage Summary

Filename                         Stmts    Miss  Cover    Missing
-----------------------------  -------  ------  -------  ----------------------------------
R/dummy_functions.R                 88      75  14.77%   12-110
R/example_module.R                  18       9  50.00%   23-26, 29-33
R/get_rcode_utils.R                 53       2  96.23%   95, 100
R/get_rcode.R                      137      54  60.58%   74, 81, 86, 211-277
R/include_css_js.R                  24       0  100.00%
R/init.R                            24       2  91.67%   190-191
R/module_nested_tabs.R             161       7  95.65%   57, 97, 101-102, 137, 188, 240
R/module_tabs_with_filters.R        68       1  98.53%   162
R/module_teal_with_splash.R         33       2  93.94%   65, 77
R/module_teal.R                    120      10  91.67%   49, 52, 155-156, 178-181, 183, 187
R/modules_debugging.R               18      18  0.00%    25-44
R/modules.R                        101       8  92.08%   341-366
R/reporter_previewer_module.R       16       2  87.50%   23, 27
R/show_rcode_modal.R                20      20  0.00%    17-38
R/tdata.R                           41       2  95.12%   146, 172
R/utils.R                           13       0  100.00%
R/validate_inputs.R                 32       0  100.00%
R/validations.R                     62      39  37.10%   111-375
R/zzz.R                             11       7  36.36%   3-14
TOTAL                             1040     258  75.19%

Diff against main

Filename                         Stmts    Miss  Cover
-----------------------------  -------  ------  -------
R/module_teal.R                     +9      +5  -3.83%
R/reporter_previewer_module.R       +4       0  +4.17%
TOTAL                              +13      +5  -0.17%

Results for commit: c170ef0

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@kartikeyakirar kartikeyakirar self-assigned this Jul 5, 2023
Copy link
Contributor

@kartikeyakirar kartikeyakirar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@gogonzo gogonzo merged commit d4a911e into main Jul 7, 2023
22 checks passed
@gogonzo gogonzo deleted the 848_custom_report_previewer@main branch July 7, 2023 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add arguments to report_previewer to be able to change default author
2 participants