Fix modules to use `teal_data` instead of `tdata`
Closed this issue · 0 comments
gogonzo commented
part of insightsengineering/teal#937
installation instructions:
staged.dependencies::dependency_table(
project = "insightsengineering/teal.osprey@https://github.com",
project_type = "repo@host",
ref = "refactor",
verbose = 1
) |>
staged.dependencies::install_deps()
steps:
- Assign yourself by writing your name next to the module in "Progress list" below.
- Open separate branch tm_module_of_your_choice@refactor.
- Make changes relevant changes.
- Make PR to the @refactor branch with only one module changed. ONE PR, ONE MODULE. Include example app in the initial comment!
- Add a link to the PR next to the "Progress list".
example changes
- argument checks
# from
checkmate::assert_class(data, "tdata")
# to
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
- merge expressions
# from
anl_merged_q <- reactive({
req(anl_merged_input())
teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data)) %>%
teal.code::eval_code(as.expression(anl_merged_input()$expr))
})
# to
anl_merged_q <- reactive({
req(anl_merged_input())
data() %>%
teal.code::eval_code(as.expression(anl_merged_input()$expr))
})
- validation rules
iv$add_rule("variables", shinyvalidate::sv_in_set(
# set = names(data[[dataname]]()), message_fmt = "Not all selected variables exist in the data" # old
set = names(data()[[dataname]]), message_fmt = "Not all selected variables exist in the data" # new
))
- arm_ref_comp
arm_ref_comp_iv <- arm_ref_comp_observer(
session,
input,
output,
id_arm_var = extract_input("arm_var", parentname),
# data = data[[parentname]], # old
data = reactive(data()[[parentname]]), # new
arm_ref_comp = arm_ref_comp,
module = "tm_mmrm"
)