Skip to content

Commit

Permalink
update tm_g_forest_tte (#1336)
Browse files Browse the repository at this point in the history
# Pull Request

<!--- Replace `#nnn` with your issue link for reference. -->

Fixes #nnn

---------

Signed-off-by: Lluís Revilla <[email protected]>
Co-authored-by: Lluís Revilla <[email protected]>
  • Loading branch information
shajoezhu and llrs-roche authored Feb 9, 2025
1 parent 778db17 commit 48eb088
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

### Bug fixes
* Fixed bug in creating modules with `delayed_data` and `teal.transform::all_choices`.
* Fixed bug in `tm_g_forest_tte` and `tm_g_forest_rsp` to resolve delayed data loading variables.

# teal.modules.clinical 0.9.1

Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_forest_rsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,8 @@ srv_g_forest_rsp <- function(id,

strata_var <- as.vector(anl_m$columns_source$strata_var)
subgroup_var <- as.vector(anl_m$columns_source$subgroup_var)

obj_var_name <- get_g_forest_obj_var_name(paramcd, input)
resolved_paramcd <- teal.transform::resolve_delayed(paramcd, as.list(data()))
obj_var_name <- get_g_forest_obj_var_name(resolved_paramcd, input)

my_calls <- template_forest_rsp(
dataname = "ANL",
Expand Down
10 changes: 6 additions & 4 deletions R/tm_g_forest_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,9 @@ srv_g_forest_tte <- function(id,
cnsr_var = shinyvalidate::sv_required("A censor variable is required"),
arm_var = shinyvalidate::sv_required("A treatment variable is required")
),
filter_validation_rule = list(paramcd = shinyvalidate::sv_required(message = "Please select Endpoint filter."))
filter_validation_rule = list(
paramcd = shinyvalidate::sv_required(message = "Please select Endpoint filter.")
)
)

iv_r <- reactive({
Expand All @@ -592,7 +594,7 @@ srv_g_forest_tte <- function(id,
shinyvalidate::sv_between(0, 1, message_fmt = "Confidence level must be between 0 and 1")
)
iv$add_validator(iv_arm_ref)
teal.transform::compose_and_enable_validators(iv, selector_list)
teal.transform::compose_and_enable_validators(iv, selector_list, c("arm_var", "aval_var", "paramcd"))
})

anl_inputs <- teal.transform::merge_expression_srv(
Expand Down Expand Up @@ -681,8 +683,8 @@ srv_g_forest_tte <- function(id,

strata_var <- as.vector(anl_m$columns_source$strata_var)
subgroup_var <- as.vector(anl_m$columns_source$subgroup_var)

obj_var_name <- get_g_forest_obj_var_name(paramcd, input)
resolved_paramcd <- teal.transform::resolve_delayed(paramcd, as.list(data()))
obj_var_name <- get_g_forest_obj_var_name(resolved_paramcd, input)

my_calls <- template_forest_tte(
dataname = "ANL",
Expand Down
3 changes: 2 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -844,12 +844,13 @@ clean_description <- function(x) {
#' @keywords internal
#'
get_g_forest_obj_var_name <- function(paramcd, input, filter_idx = 1) {
choices <- paramcd$filter[[filter_idx]]$choices
input_obj <- paste0(
"paramcd-dataset_", paramcd$dataname,
"_singleextract-filter", filter_idx, "-vals"
)

current_selected <- input[[input_obj]]
choices <- paramcd$filter[[filter_idx]]$choices
obj_var_name <- names(choices)[choices == current_selected]
obj_var_name
}
Expand Down

0 comments on commit 48eb088

Please sign in to comment.