From 0b55444649e73e62d885e294127aec565f1fbbfd Mon Sep 17 00:00:00 2001 From: walkowif <59475134+walkowif@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:30:01 +0200 Subject: [PATCH 1/6] Workflow propagations (#305) --- .github/workflows/check.yaml | 3 +++ .github/workflows/release.yaml | 3 +++ .github/workflows/scheduled.yaml | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index af5c7d9c..6b8f56fa 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -67,6 +67,9 @@ jobs: uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + with: + additional-env-vars: | + NOT_CRAN=true linter: if: github.event_name != 'push' name: SuperLinter πŸ¦Έβ€β™€οΈ diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e56418bb..aa3e7bb4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -52,6 +52,9 @@ jobs: uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} + with: + additional-env-vars: | + NOT_CRAN=true wasm: name: Build WASM packages πŸ§‘β€πŸ­ needs: release diff --git a/.github/workflows/scheduled.yaml b/.github/workflows/scheduled.yaml index dc1f7e5f..3ce04bb5 100644 --- a/.github/workflows/scheduled.yaml +++ b/.github/workflows/scheduled.yaml @@ -5,9 +5,26 @@ on: schedule: - cron: '45 3 * * 0' workflow_dispatch: + inputs: + chosen-workflow: + description: | + Select which workflow you'd like to run + required: true + type: choice + default: rhub + options: + - rhub + - dependency-test + - branch-cleanup + - revdepcheck jobs: dependency-test: + if: > + github.event_name == 'schedule' || ( + github.event_name == 'workflow_dispatch' && + inputs.chosen-workflow == 'dependency-test' + ) strategy: fail-fast: false matrix: @@ -22,14 +39,29 @@ jobs: additional-env-vars: | PKG_SYSREQS_DRY_RUN=true branch-cleanup: + if: > + github.event_name == 'schedule' || ( + github.event_name == 'workflow_dispatch' && + inputs.chosen-workflow == 'branch-cleanup' + ) name: Branch Cleanup 🧹 uses: insightsengineering/r.pkg.template/.github/workflows/branch-cleanup.yaml@main secrets: REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} revdepcheck: + if: > + github.event_name == 'schedule' || ( + github.event_name == 'workflow_dispatch' && + inputs.chosen-workflow == 'revdepcheck' + ) name: revdepcheck ↩️ uses: insightsengineering/r.pkg.template/.github/workflows/revdepcheck.yaml@main rhub: + if: > + github.event_name == 'schedule' || ( + github.event_name == 'workflow_dispatch' && + inputs.chosen-workflow == 'rhub' + ) name: R-hub 🌐 uses: insightsengineering/r.pkg.template/.github/workflows/rhub.yaml@main with: From 09bc0464967b234ae24c00cb013938424c22949a Mon Sep 17 00:00:00 2001 From: walkowif Date: Mon, 16 Sep 2024 14:31:01 +0000 Subject: [PATCH 2/6] [skip actions] Bump version to 0.2.0.9004 --- .pre-commit-config.yaml | 2 +- DESCRIPTION | 4 ++-- NEWS.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea5d99f0..25adfa53 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ default_language_version: python: python3 repos: - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.3 + rev: v0.4.3.9001 hooks: - id: style-files name: Style code with `styler` diff --git a/DESCRIPTION b/DESCRIPTION index ac1b182a..810006a9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: teal.goshawk Title: Longitudinal Visualization `teal` Modules -Version: 0.2.0.9003 -Date: 2024-08-29 +Version: 0.2.0.9004 +Date: 2024-09-16 Authors@R: c( person("Nick", "Paszty", , "nick.paszty@gene.com", role = c("aut", "cre")), person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 9a37a0ac..0f6c2dc1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.goshawk 0.2.0.9003 +# teal.goshawk 0.2.0.9004 # teal.goshawk 0.2.0 From 404a346fdddd6cda31b0e680e2b4702c44500891 Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Mon, 16 Sep 2024 21:49:54 +0200 Subject: [PATCH 3/6] bring back AVALU column for ANL dataset in correlationplot (#307) Closes #294 --- R/tm_g_gh_correlationplot.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_gh_correlationplot.R b/R/tm_g_gh_correlationplot.R index 3e46b836..0009e807 100644 --- a/R/tm_g_gh_correlationplot.R +++ b/R/tm_g_gh_correlationplot.R @@ -519,7 +519,7 @@ srv_g_correlationplot <- function(id, dplyr::filter(.data[[.(param_var)]] %in% union(.(input$xaxis_param), .(input$yaxis_param))) %>% dplyr::select( .(c( - "USUBJID", input$trt_group, "AVISITCD", param_var, "PARAM", input$xaxis_var, input$yaxis_var, + "USUBJID", input$trt_group, "AVISITCD", param_var, "PARAM", input$xaxis_var, input$yaxis_var, "AVALU", "LOQFL", "LBSTRESC", unique(c(input$hline_vars, input$vline_vars)) )) ) From 5b9f696a3e11f63c418aced632d25f506c1a6748 Mon Sep 17 00:00:00 2001 From: donyunardi Date: Mon, 16 Sep 2024 19:50:46 +0000 Subject: [PATCH 4/6] [skip actions] Bump version to 0.2.0.9005 --- DESCRIPTION | 2 +- NEWS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 810006a9..3ba61b6c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: teal.goshawk Title: Longitudinal Visualization `teal` Modules -Version: 0.2.0.9004 +Version: 0.2.0.9005 Date: 2024-09-16 Authors@R: c( person("Nick", "Paszty", , "nick.paszty@gene.com", role = c("aut", "cre")), diff --git a/NEWS.md b/NEWS.md index 0f6c2dc1..4fc95732 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.goshawk 0.2.0.9004 +# teal.goshawk 0.2.0.9005 # teal.goshawk 0.2.0 From dbbe6d9901448ef4589d12c4843efdc97135cd89 Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:48:01 +0200 Subject: [PATCH 5/6] Calculate density ranges based on `treatment` name and based on AVICITCD for density plot (#308) Fixes https://github.com/insightsengineering/goshawk/issues/192 For proper density calculations, you need to calculate ranges within groups inside the plot. Groups are created based on treatment variable and based on AVICITCD plot. So the max ranges need to be calculated in each group, and the max needs to be extracted. > Set filters to: ADSL -> SEX -> Male, ADSL -> AGE -> 31.41, 35 # How it looked before image # How it looks now image # Example code
Example from `?tm_g_gh_density_distribution_plot` ```r pkgload::load_all("../teal.widgets") pkgload::load_all("../teal") pkgload::load_all(".") data <- teal_data() data <- within(data, { library(dplyr) library(stringr) # original ARM value = dose value arm_mapping <- list( "A: Drug X" = "150mg QD", "B: Placebo" = "Placebo", "C: Combination" = "Combination" ) ADSL <- rADSL ADLB <- rADLB var_labels <- lapply(ADLB, function(x) attributes(x)$label) ADLB <- ADLB %>% mutate( AVISITCD = case_when( AVISIT == "SCREENING" ~ "SCR", AVISIT == "BASELINE" ~ "BL", grepl("WEEK", AVISIT) ~ paste("W", str_extract(AVISIT, "(?<=(WEEK ))[0-9]+")), TRUE ~ as.character(NA) ), AVISITCDN = case_when( AVISITCD == "SCR" ~ -2, AVISITCD == "BL" ~ 0, grepl("W", AVISITCD) ~ as.numeric(gsub("[^0-9]*", "", AVISITCD)), TRUE ~ as.numeric(NA) ), AVISITCD = factor(AVISITCD) %>% reorder(AVISITCDN), TRTORD = case_when( ARMCD == "ARM C" ~ 1, ARMCD == "ARM B" ~ 2, ARMCD == "ARM A" ~ 3 ), ARM = as.character(arm_mapping[match(ARM, names(arm_mapping))]), ARM = factor(ARM) %>% reorder(TRTORD), ACTARM = as.character(arm_mapping[match(ACTARM, names(arm_mapping))]), ACTARM = factor(ACTARM) %>% reorder(TRTORD) ) attr(ADLB[["ARM"]], "label") <- var_labels[["ARM"]] attr(ADLB[["ACTARM"]], "label") <- var_labels[["ACTARM"]] }) datanames <- c("ADSL", "ADLB") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] app <- init( data = data, modules = modules( tm_g_gh_density_distribution_plot( label = "Density Distribution Plot", dataname = "ADLB", param_var = "PARAMCD", param = choices_selected(c("ALT", "CRP", "IGA"), "ALT"), xaxis_var = choices_selected(c("AVAL", "BASE", "CHG", "PCHG"), "AVAL"), trt_group = choices_selected(c("ARM", "ACTARM"), "ARM"), color_manual = c( "150mg QD" = "#000000", "Placebo" = "#3498DB", "Combination" = "#E74C3C" ), color_comb = "#39ff14", comb_line = TRUE, plot_height = c(500, 200, 2000), font_size = c(12, 8, 20), line_size = c(1, .25, 3), hline_arb = c(.02, .05), hline_arb_color = c("red", "black"), hline_arb_label = c("Horizontal Line A", "Horizontal Line B") ) ) ) if (interactive()) { shinyApp(app$ui, app$server) } ```
--- R/tm_g_gh_density_distribution_plot.R | 3 ++- R/utils-keep_range_slider_updated.r | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/R/tm_g_gh_density_distribution_plot.R b/R/tm_g_gh_density_distribution_plot.R index 430affb1..0ea380e8 100644 --- a/R/tm_g_gh_density_distribution_plot.R +++ b/R/tm_g_gh_density_distribution_plot.R @@ -300,7 +300,8 @@ srv_g_density_distribution_plot <- function(id, # nolint "xaxis_var", "xaxis_param", anl_q, - is_density = TRUE + is_density = TRUE, + "trt_group" ) keep_data_const_opts_updated(session, input, anl_q, "xaxis_param") diff --git a/R/utils-keep_range_slider_updated.r b/R/utils-keep_range_slider_updated.r index 26dacbfd..c179d5a0 100644 --- a/R/utils-keep_range_slider_updated.r +++ b/R/utils-keep_range_slider_updated.r @@ -4,7 +4,8 @@ keep_range_slider_updated <- function(session, id_var, id_param_var, reactive_ANL, # nolint - is_density = FALSE) { + is_density = FALSE, + id_trt_group) { stopifnot(is.function(update_slider_fcn)) observe({ @@ -25,8 +26,14 @@ keep_range_slider_updated <- function(session, step <- NULL if (isTRUE(is_density)) { - minmax <- c(0, round(max(stats::density(stats::na.omit(ANL[[varname]]))$y) * 1.5, 5)) - step <- round(max(stats::density(stats::na.omit(ANL[[varname]]))$y) / 100, 5) + treatname <- input[[id_trt_group]] + ANL_split <- ANL %>% split(f = factor(paste0(ANL[["AVISITCD"]], ANL[[treatname]]))) # nolint + density_maxes <- lapply(ANL_split, function(x) { + max(stats::density(stats::na.omit(x[[varname]]))$y) + }) + dmax <- max(unlist(density_maxes)) + minmax <- c(0, round(dmax * 1.2, 5)) + step <- round(dmax / 100, 5) } isolate(update_slider_fcn( From 724ae4644f16319b6de8fdfd7263adb39cbabc64 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 18 Sep 2024 15:48:58 +0000 Subject: [PATCH 6/6] [skip actions] Bump version to 0.2.0.9006 --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3ba61b6c..7e27790f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: teal.goshawk Title: Longitudinal Visualization `teal` Modules -Version: 0.2.0.9005 -Date: 2024-09-16 +Version: 0.2.0.9006 +Date: 2024-09-18 Authors@R: c( person("Nick", "Paszty", , "nick.paszty@gene.com", role = c("aut", "cre")), person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 4fc95732..3c19bbe7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.goshawk 0.2.0.9005 +# teal.goshawk 0.2.0.9006 # teal.goshawk 0.2.0