merge_dataset should return better information about filter variables and levels

オープン
#19 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
r

調査の方向性

提供されている tm_t_logistic の例から始め、anl_m <- anl_merged() の後の srv_t_logistic を調べ、columns_source と名前のない filter_info 出力を比較します。teal.modules.clinical と teal.modules.general のコンテキストで、data_extract_input、anl_merged()、および tmc::cs_to_des_filter の使用方法を確認してください。完了した実装では、列ごとのフィルタリングとグローバルフィルタリングの両方について、フィルタ変数と選択されたレベルに安定してアクセスできるようにする必要があります。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
R
スター
2
フォーク
5
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pharmaverse/teal.transform のほかの issue

pharmaverse/teal.transform の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。