Skip to content
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

Fix modules to use teal_data instead of tdata #242

Closed
2 tasks done
gogonzo opened this issue Oct 18, 2023 · 1 comment · Fixed by #246
Closed
2 tasks done

Fix modules to use teal_data instead of tdata #242

gogonzo opened this issue Oct 18, 2023 · 1 comment · Fixed by #246

Comments

@gogonzo
Copy link
Contributor

gogonzo commented Oct 18, 2023

part of insightsengineering/teal#937

installation instructions:

staged.dependencies::dependency_table(
  project = "insightsengineering/teal.goshawk@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:

@gogonzo
Copy link
Contributor Author

gogonzo commented Nov 24, 2023

Done

@gogonzo gogonzo closed this as completed Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants