merge_dataset should return better information about filter variables and levels

Aperta
#19 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
r

Direzione di ricerca

Inizia con l’esempio tm_t_logistic fornito e ispeziona srv_t_logistic dopo anl_m <- anl_merged(), confrontando columns_source con l’output filter_info senza nome. Leggi data_extract_input, anl_merged() e l’uso di tmc::cs_to_des_filter nel contesto di teal.modules.clinical e teal.modules.general; l’implementazione completata dovrebbe fornire un accesso stabile alle variabili di filtro e ai livelli selezionati sia per il filtraggio per colonna sia per il filtraggio globale.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

core

data_extract is designed to contain custom filter for each variable (data_extract). This means
that in teal.modules.clinical where we don't need to merge data (all inputs can come from the same dataset), we just need to return information such as columns_source and easy accessible filter_info.
data_extract should be optimized for both scenarios

  1. We enable filter input separately for each column selection.
  2. We enable filter input globally for all column selections.

At this moment both 1 and 2 is possible (thanks to the tmc::cs_to_des_filter), but in both scenarios it's hard to obtain information from anl_merged()$filter_infos about the filters without performing some nested-list-filtering. See that in teal.modules.general we don't use filter selection anywhere - we use only columns_source. Below is the output from anl_m$filter_info. Perhaps, easiest solution is to create wrapper function to get_de_filter_selected(vars = "ADRS") or something similar. We might wan't to combine all data_extract(s) information for each

[[1]]
NULL

[[2]]
[[2]][[1]]
[[2]][[1]]$columns
[1] "PARAMCD"

[[2]][[1]]$selected
[[2]][[1]]$selected[[1]]
[1] "BESRSPI"

[[2]][[1]]$multiple
[1] FALSE

[[2]][[1]]$drop_keys
[1] FALSE

[[3]]
NULL

Check tm_t_logistic. Put browser() in srv_t_logistic after anl_m <- anl_merged() and see the output of anl_m. paramcd which we are interested in is a filter which means that in columns_source it will be always empty, but it will be reflected in anl_m$filter_info. We can still obtain selected from anl_m$filter_info but the problem is because we can't select by filter variable name - filter_info is unnamed and not robust to reordering.

Find better way to manage data_extract_input(..., data_extract_spec = ) in teal.modules.clinical modules or optimize teal/teal.devel workflow to cover both tmg and tmc.

devtools::load_all("../teal")
devtools::load_all("../teal.devel")
devtools::load_all("../teal.modules.clinical")

library(random.cdisc.data)
library(dplyr)
ADSL <- radsl(cached = TRUE)
ADRS <- radrs(cached = TRUE) %>%
  filter(PARAMCD %in% c("BESRSPI", "INVET"))

arm_ref_comp = list(
  ACTARMCD = list(
    ref = "ARM B",
    comp = c("ARM A", "ARM C")
  ),
  ARM = list(
    ref = "B: Placebo",
    comp = c("A: Drug X", "C: Combination")
  )
)

app <- init(
  data = cdisc_data(
    cdisc_dataset("ADSL", ADSL, code = 'ADSL <- radsl(cached = TRUE)'),
    cdisc_dataset(
      "ADRS", ADRS,
      code = 'ADRS <- radrs(cached = TRUE) %>% filter(PARAMCD %in% c("BESRSPI", "INVET"))'
    ),
    check = TRUE
  ),
  modules = root_modules(
    tm_t_logistic(
      label = "Logistic Regression",
      dataname = "ADRS",
      arm_var = choices_selected(
        choices = variable_choices(ADRS, c("ARM", "ARMCD")),
        selected = "ARM"
      ),
      arm_ref_comp = arm_ref_comp,
      paramcd = choices_selected(
        choices = value_choices(ADRS, "PARAMCD", "PARAM"),
        selected = value_choices(ADRS, "PARAMCD", "PARAM")
      ),
      cov_var = choices_selected(
        choices = c("SEX", "AGE", "BMRKR1", "BMRKR2"),
        selected = "SEX"
      ),
      interaction_var = choices_selected(
        choices = c("SEX", "AGE", "BMRKR1", "BMRKR2"),
        selected = NULL
      )
    )
  )
)

shinyApp(ui = app$ui, server = app$server)

Provenance:

Creator: gogonzo
Lingua principale
R
Stelle
2
Fork
5
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pharmaverse/teal.transform

Tutte le issue di pharmaverse/teal.transform

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.