-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
553 introduce internal log_shiny_input_changes
function
#84
Conversation
CLA Assistant Lite bot ✅ All contributors have signed the CLA |
I have read the CLA Document and I hereby sign the CLA |
recheck |
Code Coverage Summary
Diff against main
Results for commit: 049e630 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Tests Summary 1 files 3 suites 0s ⏱️ Results for commit 049e630. ♻️ This comment has been updated with latest results. |
@pawelru if we want to have our own implementation of |
Merge branch '553_log_shiny_input_changes@main' of https://github.com/insightsengineering/teal.logger into 553_log_shiny_input_changes@main # Conflicts: # R/log_shiny_input_changes.R
Co-authored-by: Pawel Rucki <[email protected]> Signed-off-by: Marcin <[email protected]>
Co-authored-by: Pawel Rucki <[email protected]> Signed-off-by: Marcin <[email protected]>
Co-authored-by: Pawel Rucki <[email protected]> Signed-off-by: Marcin <[email protected]>
…/insightsengineering/teal.logger into 553_log_shiny_input_changes@main
For a simple input change in UI I see 5 logs displayed in the console [TRACE] 2024-06-19 09:55:27.7176 pid:24656 token:[31ad1df8] teal.modules.clinical teal-main_ui-root-adae_analysis-module Shiny input change detected in fill-dataset_ADSL_singleextract-select_open: NULL -> TRUE
[TRACE] 2024-06-19 09:55:35.0600 pid:24656 token:[31ad1df8] teal.modules.clinical teal-main_ui-root-adae_analysis-module Shiny input change detected in fill-dataset_ADSL_singleextract-select: SEX -> ACTARM
[TRACE] 2024-06-19 09:55:35.0645 pid:24656 token:[31ad1df8] teal.modules.clinical teal-main_ui-root-adae_analysis-module Shiny input change detected in fill-dataset_ADSL_singleextract-select_open: NULL -> TRUE
[TRACE] 2024-06-19 09:55:35.0780 pid:24656 token:[31ad1df8] teal.modules.clinical teal-main_ui-root-adae_analysis-module Shiny input change detected in fill-dataset_ADSL_singleextract-select: SEX -> ACTARM
[TRACE] 2024-06-19 09:55:35.0830 pid:24656 token:[31ad1df8] teal.modules.clinical teal-main_ui-root-adae_analysis-module Shiny input change detected in fill-dataset_ADSL_singleextract-select_open: NULL -> FALSE Where first two and another two are the same, which made me think we have some duplicates. This was not the case while this feature was using |
When I brought back the usage of [TRACE] 2024-06-19 10:06:20.3276 pid:17336 token:[37e75bcf] teal.modules.clinical teal-main_ui-root-adae_analysis-module Shiny input change detected in fill-dataset_ADSL_singleextract-select_open: NULL -> TRUE
[TRACE] 2024-06-19 10:06:23.9033 pid:17336 token:[37e75bcf] teal.modules.clinical teal-main_ui-root-adae_analysis-module Shiny input change detected in fill-dataset_ADSL_singleextract-select: SEX -> RACE
[TRACE] 2024-06-19 10:06:24.3814 pid:17336 token:[37e75bcf] teal.modules.clinical teal-main_ui-root-adae_analysis-module Shiny input change detected in fill-dataset_ADSL_singleextract-select_open: TRUE -> FALSE
Surprisingly I see many more logs that poped-up during this input change [TRACE] 2024-06-19 10:06:22.0966 pid:17336 token:[37e75bcf] teal.transform data_extract_read_srv@2 dataname: ADSL; select: RACE.
[TRACE] 2024-06-19 10:06:22.1528 pid:17336 token:[37e75bcf] teal.transform merge_datasets called with: ADSL, ADAE datasets; x, fill, x_facet, y_facet selectors; dplyr::full_join merge function.
[TRACE] 2024-06-19 10:06:22.1560 pid:17336 token:[37e75bcf] teal.transform merge_selectors called with: x, fill, x_facet, y_facet selectors.
[TRACE] 2024-06-19 10:06:22.1596 pid:17336 token:[37e75bcf] teal.transform get_dplyr_call_data called with: x, x_facet selectors.
[TRACE] 2024-06-19 10:06:22.1628 pid:17336 token:[37e75bcf] teal.transform get_merge_key_grid called with: x, x_facet selectors.
[TRACE] 2024-06-19 10:06:22.1808 pid:17336 token:[37e75bcf] teal.transform get_merge_key_pair called with: x, x selectors; STUDYID, USUBJID keys.
[TRACE] 2024-06-19 10:06:22.1838 pid:17336 token:[37e75bcf] teal.transform get_dropped_filters called with x selector.
[TRACE] 2024-06-19 10:06:22.1863 pid:17336 token:[37e75bcf] teal.transform get_merge_key_pair returns STUDYID, USUBJID merge keys.
[TRACE] 2024-06-19 10:06:22.1973 pid:17336 token:[37e75bcf] teal.transform get_merge_key_pair called with: x, x_facet selectors; STUDYID, USUBJID keys.
[TRACE] 2024-06-19 10:06:22.2010 pid:17336 token:[37e75bcf] teal.transform get_merge_key_pair returns STUDYID, USUBJID merge keys.
[TRACE] 2024-06-19 10:06:22.2109 pid:17336 token:[37e75bcf] teal.transform get_merge_key_pair called with: x_facet, x selectors; STUDYID, USUBJID keys.
[TRACE] 2024-06-19 10:06:22.2159 pid:17336 token:[37e75bcf] teal.transform get_merge_key_pair returns STUDYID, USUBJID merge keys.
[TRACE] 2024-06-19 10:06:22.2251 pid:17336 token:[37e75bcf] teal.transform get_merge_key_pair called with: x_facet, x_facet selectors; STUDYID, USUBJID, ASTDTM, AETERM, AESEQ keys.
[TRACE] 2024-06-19 10:06:22.2287 pid:17336 token:[37e75bcf] teal.transform get_dropped_filters called with x_facet selector.
[TRACE] 2024-06-19 10:06:22.2311 pid:17336 token:[37e75bcf] teal.transform get_merge_key_pair returns STUDYID, USUBJID, ASTDTM, AETERM, AESEQ merge keys.
[TRACE] 2024-06-19 10:06:22.2406 pid:17336 token:[37e75bcf] teal.transform get_dplyr_call called with: ADSL, ADAE datasets; x, x_facet selectors.
[TRACE] 2024-06-19 10:06:22.2463 pid:17336 token:[37e75bcf] teal.transform get_filter_call called with: ADSL dataset; filters.
[TRACE] 2024-06-19 10:06:22.2496 pid:17336 token:[37e75bcf] teal.transform get_select_call called with: STUDYID, USUBJID, ACTARM, RACE columns.
[TRACE] 2024-06-19 10:06:22.2521 pid:17336 token:[37e75bcf] teal.transform get_rename_call called with: x selector; ACTARM, RACE renamed columns.
[TRACE] 2024-06-19 10:06:22.2551 pid:17336 token:[37e75bcf] teal.transform get_dplyr_call called with: ADSL, ADAE datasets; x, x_facet selectors.
[TRACE] 2024-06-19 10:06:22.2595 pid:17336 token:[37e75bcf] teal.transform get_filter_call called with: ADAE dataset; filters.
[TRACE] 2024-06-19 10:06:22.2635 pid:17336 token:[37e75bcf] teal.transform get_select_call called with: STUDYID, USUBJID, AETOXGR, AESEV columns.
[TRACE] 2024-06-19 10:06:22.2658 pid:17336 token:[37e75bcf] teal.transform get_rename_call called with: x_facet selector; AETOXGR, AESEV renamed columns.
[TRACE] 2024-06-19 10:06:22.2681 pid:17336 token:[37e75bcf] teal.transform get_merge_call called with: x, x_facet selectors; dplyr::full_join merge function.
[TRACE] 2024-06-19 10:06:22.2707 pid:17336 token:[37e75bcf] teal.transform get_merge_key_i called with x, x_facet selectors; idx = 2.
[TRACE] 2024-06-19 10:06:22.2738 pid:17336 token:[37e75bcf] teal.transform get_merge_key_i returns STUDYID USUBJID unique keys.
[TRACE] 2024-06-19 10:06:22.2793 pid:17336 token:[37e75bcf] teal.transform parse_merge_key_i called with STUDYID USUBJID keys.
[TRACE] 2024-06-19 10:06:22.2835 pid:17336 token:[37e75bcf] teal.transform get_relabel_cols called with: x, fill, x_facet, y_facet columns_source.
[TRACE] 2024-06-19 10:06:22.2857 pid:17336 token:[37e75bcf] teal.transform get_anl_relabel_call called with: x, fill, x_facet, y_facet columns_source; ANL merged dataset.
[TRACE] 2024-06-19 10:06:22.2934 pid:17336 token:[37e75bcf] teal.transform get_relabel_call called with: Description of Actual Arm Race Analysis Toxicity Grade Severity/Intensity labels.
[TRACE] 2024-06-19 10:06:22.2973 pid:17336 token:[37e75bcf] teal.transform merge_datasets merge code executed resulting in ANL dataset.
[TRACE] 2024-06-19 10:06:22.3974 pid:17336 token:[37e75bcf] teal.transform get_anl_relabel_call called with: x, fill, x_facet, y_facet columns_source; counts merged dataset.
[TRACE] 2024-06-19 10:06:22.4046 pid:17336 token:[37e75bcf] teal.transform get_relabel_call called with: Description of Actual Arm Race Analysis Toxicity Grade Severity/Intensity labels. |
But this is the regular amount of logs that we have on App for testing:options(teal.log_level = "TRACE", teal.show_js_log = TRUE)
library(nestcolor)
library(dplyr)
#library(teal.modules.clinical)
devtools::load_all("../teal.logger/")
devtools::load_all(".")
ADSL <- tmc_ex_adsl %>%
mutate(ITTFL = factor("Y") %>%
with_label("Intent-To-Treat Population Flag"))
ADAE <- tmc_ex_adae %>%
filter(!((AETOXGR == 1) & (AESEV == "MILD") & (ARM == "A: Drug X")))
app <- init(
data = cdisc_data(
ADSL = ADSL,
ADAE = ADAE,
code = "ADSL <- tmc_ex_adsl %>%
mutate(ITTFL = factor(\"Y\") %>%
with_label(\"Intent-To-Treat Population Flag\"))
ADAE <- tmc_ex_adae %>%
filter(!((AETOXGR == 1) & (AESEV == \"MILD\") & (ARM == \"A: Drug X\")))"
),
modules = modules(
tm_g_barchart_simple(
label = "ADAE Analysis",
x = data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(
ADSL,
c(
"ARM", "ACTARM", "SEX",
"RACE", "ITTFL", "SAFFL", "STRATA2"
)
),
selected = "ACTARM",
multiple = FALSE
)
),
fill = list(
data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(
ADSL,
c(
"ARM", "ACTARM", "SEX",
"RACE", "ITTFL", "SAFFL", "STRATA2"
)
),
selected = "SEX",
multiple = FALSE
)
),
data_extract_spec(
dataname = "ADAE",
select = select_spec(
choices = variable_choices(ADAE, c("AETOXGR", "AESEV", "AESER")),
selected = NULL,
multiple = FALSE
)
)
),
x_facet = list(
data_extract_spec(
dataname = "ADAE",
select = select_spec(
choices = variable_choices(ADAE, c("AETOXGR", "AESEV", "AESER")),
selected = "AETOXGR",
multiple = FALSE
)
),
data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(
ADSL,
c(
"ARM", "ACTARM", "SEX",
"RACE", "ITTFL", "SAFFL", "STRATA2"
)
),
selected = NULL,
multiple = FALSE
)
)
),
y_facet = list(
data_extract_spec(
dataname = "ADAE",
select = select_spec(
choices = variable_choices(ADAE, c("AETOXGR", "AESEV", "AESER")),
selected = "AESEV",
multiple = FALSE
)
),
data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(
ADSL,
c(
"ARM", "ACTARM", "SEX",
"RACE", "ITTFL", "SAFFL", "STRATA2"
)
),
selected = NULL,
multiple = FALSE
)
)
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
|
@pawelru I needed to bring back If this PR is fine, then I'll start merging PRs in module packages and in
|
…/insightsengineering/teal.logger into 553_log_shiny_input_changes@main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this is good to go 👍
Part of https://github.com/insightsengineering/coredev-tasks/issues/553 and https://github.com/insightsengineering/coredev-tasks/issues/568
Function is an extended copy of
logger::log_shiny_input_changes
but curated to our needs.Currently features comparison to what's included in
logger
excluded_patterns
parameter that allows to exclude inputs from logging based on grep patterns - we are excluding plot resizing by defaultsession
object to detect that the session is a mocked session