insightsengineering/teal.osprey

Fix modules to use `teal_data` instead of `tdata`

Closed this issue · 0 comments

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:

  1. Assign yourself by writing your name next to the module in "Progress list" below.
  2. Open separate branch tm_module_of_your_choice@refactor.
  3. Make changes relevant changes.
  4. Make PR to the @refactor branch with only one module changed. ONE PR, ONE MODULE. Include example app in the initial comment!
  5. 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"
    )

Progress list:

  • tm_g_ae_oview
  • tm_g_ae_sub
  • tm_g_butterfly
  • tm_g_decorate
  • tm_g_events_term_id
  • tm_g_heat_bygrade
  • tm_g_patient_profile
  • tm_g_spiderplot
  • tm_g_swimlane
  • tm_g_waterfall