Skip to content

Commit

Permalink
Merge branch 'main' into 546-fix-verdepcheck@main
Browse files Browse the repository at this point in the history
Signed-off-by: André Veríssimo <[email protected]>
  • Loading branch information
averissimo authored May 16, 2024
2 parents 45c8df2 + f84cd49 commit 0e92c02
Show file tree
Hide file tree
Showing 26 changed files with 59 additions and 26 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ repos:
- dplyr
- DT
- forcats
- ggrepel
- grid
- logger
- scales
Expand Down
28 changes: 14 additions & 14 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: teal.modules.general
Title: General Modules for 'teal' Applications
Version: 0.3.0.9030
Date: 2024-05-10
Version: 0.3.0.9034
Date: 2024-05-16
Authors@R: c(
person("Dawid", "Kaledkowski", , "[email protected]", role = c("aut", "cre")),
person("Pawel", "Rucki", , "[email protected]", role = "aut"),
Expand Down Expand Up @@ -35,6 +35,7 @@ Imports:
DT (>= 0.13),
forcats (>= 1.0.0),
grid,
logger (>= 0.3.0),
scales,
shinyjs,
shinyTree (>= 0.2.8),
Expand Down Expand Up @@ -65,8 +66,7 @@ Suggests:
jsonlite,
knitr (>= 1.42),
lattice (>= 0.18-4),
logger (>= 0.2.0),
MASS,
MASS
nestcolor (>= 0.1.0),
pkgload,
rlang (>= 1.0.0),
Expand All @@ -82,16 +82,16 @@ VignetteBuilder:
Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
rstudio/shiny, insightsengineering/teal,
insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr,
rstudio/DT, tidyverse/forcats, r-lib/scales, daattali/shinyjs,
shinyTree/shinyTree, rstudio/shinyvalidate, dreamRs/shinyWidgets,
tidyverse/stringr, insightsengineering/teal.code,
insightsengineering/teal.data, insightsengineering/teal.logger,
insightsengineering/teal.reporter, insightsengineering/teal.widgets,
insightsengineering/tern, tidyverse/tibble, tidyverse/tidyr,
tidymodels/broom, daattali/colourpicker, daattali/ggExtra,
aphalo/ggpmisc, aphalo/ggpp, slowkow/ggrepel, baddstats/goftest,
gridExtra, ramnathv/htmlwidgets, jeroen/jsonlite, yihui/knitr,
deepayan/lattice, daroczig/logger, MASS,
rstudio/DT, tidyverse/forcats, daroczig/logger, r-lib/scales,
daattali/shinyjs, shinyTree/shinyTree, rstudio/shinyvalidate,
dreamRs/shinyWidgets, tidyverse/stringr,
insightsengineering/teal.code, insightsengineering/teal.data,
insightsengineering/teal.logger, insightsengineering/teal.reporter,
insightsengineering/teal.widgets, insightsengineering/tern,
tidyverse/tibble, tidyverse/tidyr, tidymodels/broom,
daattali/colourpicker, daattali/ggExtra, aphalo/ggpmisc, aphalo/ggpp,
slowkow/ggrepel, baddstats/goftest, gridExtra, ramnathv/htmlwidgets,
jeroen/jsonlite, yihui/knitr, deepayan/lattice, MASS,
insightsengineering/nestcolor, r-lib/rlang, rstudio/rmarkdown,
insightsengineering/rtables, tidyverse/rvest, sparkline,
rstudio/shinytest2, insightsengineering/teal.data, r-lib/testthat,
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# teal.modules.general 0.3.0.9030
# teal.modules.general 0.3.0.9034

* Removed `Show Warnings` modals from modules.

### Enhancements
* Added `logger` functionality for logging changes in shiny inputs in all modules. `logger` was added to Imports.

# teal.modules.general 0.3.0

### Enhancements
Expand Down Expand Up @@ -38,6 +41,7 @@
* Removed `scda` package dependency from examples.
* Replaced deprecated `ggplot2` functions `..count..`, `..density..` and `..prop..`.
* Version bump on `forcats` dependency.
* Replaced `scda` data generation functions with `random.cdisc.data`

# teal.modules.general 0.2.15

Expand Down
2 changes: 2 additions & 0 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

response <- dat

for (i in seq_along(response)) {
Expand Down
2 changes: 2 additions & 0 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ srv_a_regression <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

rule_rvr1 <- function(value) {
Expand Down
2 changes: 2 additions & 0 deletions R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ srv_page_data_table <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

if_filtered <- reactive(as.logical(input$if_filtered))
if_distinct <- reactive(as.logical(input$if_distinct))

Expand Down
2 changes: 2 additions & 0 deletions R/tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ ui_viewer <- function(id, ...) {
# Server function for the file viewer module
srv_viewer <- function(id, input_path) {
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

temp_dir <- tempfile()
if (!dir.exists(temp_dir)) {
dir.create(temp_dir, recursive = TRUE)
Expand Down
2 changes: 2 additions & 0 deletions R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ srv_front_page <- function(id, data, tables, show_metadata) {
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

setBookmarkExclude("metadata_button")
Expand Down
2 changes: 2 additions & 0 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ srv_tm_g_association <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(ref = ref, vars = vars),
datasets = data,
Expand Down
2 changes: 2 additions & 0 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ srv_g_bivariate <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

data_extract <- list(
Expand Down
2 changes: 2 additions & 0 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ srv_distribution <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

setBookmarkExclude("params_reset")

ns <- session$ns
Expand Down
2 changes: 2 additions & 0 deletions R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ srv_g_response <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

data_extract <- list(response = response, x = x, row_facet = row_facet, col_facet = col_facet)

rule_diff <- function(other) {
Expand Down
2 changes: 2 additions & 0 deletions R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ srv_g_scatterplot <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

data_extract <- list(
x = x,
y = y,
Expand Down
2 changes: 2 additions & 0 deletions R/tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(variables = variables),
datasets = data,
Expand Down
2 changes: 2 additions & 0 deletions R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_d
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

datanames <- isolate(teal.data::datanames(data()))
datanames <- Filter(function(name) {
is.data.frame(isolate(data())[[name]])
Expand Down
2 changes: 2 additions & 0 deletions R/tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

vars <- list(outlier_var = outlier_var, categorical_var = categorical_var)
Expand Down
2 changes: 2 additions & 0 deletions R/tm_t_crosstable.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(x = x, y = y),
datasets = data,
Expand Down
2 changes: 2 additions & 0 deletions R/tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ srv_variable_browser <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

# if there are < this number of unique records then a numeric
# variable can be treated as a factor and all factors with < this groups
# have their values plotted
Expand Down
11 changes: 5 additions & 6 deletions data-raw/data.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
## code to prepare `data` for testing examples
library(scda)
rADAE <- synthetic_cdisc_data("latest")$adae
rADAE <- random.cdisc.data::cadae
usethis::use_data(rADAE)

rADLB <- synthetic_cdisc_data("latest")$adlb
rADLB <- random.cdisc.data::cadlb
usethis::use_data(rADLB)

rADRS <- synthetic_cdisc_data("latest")$adrs
rADRS <- random.cdisc.data::cadrs
usethis::use_data(rADRS)

rADSL <- synthetic_cdisc_data("latest")$adsl
rADSL <- random.cdisc.data::cadsl
usethis::use_data(rADSL)

rADTTE <- synthetic_cdisc_data("latest")$adtte
rADTTE <- random.cdisc.data::cadtte
usethis::use_data(rADTTE)
Binary file modified data/rADAE.rda
Binary file not shown.
Binary file modified data/rADLB.rda
Binary file not shown.
Binary file modified data/rADRS.rda
Binary file not shown.
Binary file modified data/rADSL.rda
Binary file not shown.
Binary file modified data/rADTTE.rda
Binary file not shown.
8 changes: 5 additions & 3 deletions tests/testthat/test-shinytest2-tm_file_viewer.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
nest_logo_url <- "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png"

app_driver_tm_file_viewer <- function() {
init_teal_app_driver(
data = simple_teal_data(),
Expand All @@ -7,7 +9,7 @@ app_driver_tm_file_viewer <- function() {
folder = system.file("sample_files", package = "teal.modules.general"),
png = system.file("sample_files/sample_file.png", package = "teal.modules.general"),
txt = system.file("sample_files/sample_file.txt", package = "teal.modules.general"),
url = "https://fda.gov/files/drugs/published/Portable-Document-Format-Specifications.pdf"
url = nest_logo_url
)
),
timeout = 3000
Expand Down Expand Up @@ -84,9 +86,9 @@ test_that("e2e - tm_file_viewer: Shows selected url", {
app_driver$click(selector = "[id= '6_anchor']")
testthat::expect_true(app_driver$is_visible(selector = app_driver$active_module_element("output")))

testthat::expect_match(
testthat::expect_equal(
attr(app_driver$get_active_module_input("tree")$url, "ancestry"),
"pdf$"
nest_logo_url
)

app_driver$stop()
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-shinytest2-tm_misssing_data.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
app_driver_tm_missing_data <- function() {
data <- within(simple_teal_data(), {
set.seed(123)
require(nestcolor)

add_nas <- function(x) {
x[sample(seq_along(x), floor(length(x) * runif(1, .05, .17)))] <- NA
Expand Down

0 comments on commit 0e92c02

Please sign in to comment.