Teal Module: Patient Prior Medication Teal Module
Source:R/tm_t_pp_prior_medication.R
tm_t_pp_prior_medication.Rd
This teal module produces a patient prior medication report using ADaM datasets.
Usage
tm_t_pp_prior_medication(
label,
dataname = "ADCM",
parentname = "ADSL",
patient_col = "USUBJID",
atirel = NULL,
cmdecod = NULL,
cmindc = NULL,
cmstdy = NULL,
pre_output = NULL,
post_output = NULL
)
Arguments
- label
(
character
)
menu item label of the module in the teal app.- dataname
(
character
)
analysis data used in teal module.- parentname
(
character
)
parent analysis data used in teal module, usually this refers toADSL
.- patient_col
(
character
)
patient ID column to be used.- atirel
(
teal.transform::choices_selected()
orteal.transform::data_extract_spec()
)ATIREL
column of the ADCM dataset.- cmdecod
(
teal.transform::choices_selected()
orteal.transform::data_extract_spec()
)CMDECOD
column of the ADCM dataset.- cmindc
(
teal.transform::choices_selected()
orteal.transform::data_extract_spec()
)CMINDC
column of the ADCM dataset.- cmstdy
(
teal.transform::choices_selected()
orteal.transform::data_extract_spec()
)CMSTDY
column of the ADCM dataset.- pre_output
optional, (
shiny.tag
)
with text placed before the output to put the output into context. For example a title.- post_output
optional, (
shiny.tag
)
with text placed after the output to put the output into context. For example theshiny::helpText()
elements are useful.
Examples
library(scda)
synthetic_cdisc_data_latest <- synthetic_cdisc_data("latest")
ADSL <- synthetic_cdisc_data_latest$adsl
ADCM <- synthetic_cdisc_data_latest$adcm
#' Modify ADCM
ADCM$CMINDC <- paste0("Indication_", as.numeric(ADCM$CMDECOD))
ADCM$CMDOSE <- 1
ADCM$CMTRT <- ADCM$CMCAT
ADCM$CMDOSU <- "U"
ADCM$CMROUTE <- "CMROUTE"
ADCM$CMDOSFRQ <- "CMDOSFRQ"
ADCM$CMASTDTM <- ADCM$ASTDTM
ADCM$CMAENDTM <- ADCM$AENDTM
formatters::var_labels(
ADCM[c("CMINDC", "CMTRT", "ASTDY")]
) <- c(
"Indication",
"Reported Name of Drug, Med, or Therapy",
"Study Day of Start of Medication"
)
adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
app <- init(
data = cdisc_data(
cdisc_dataset("ADSL", ADSL,
code = "synthetic_cdisc_data_latest <- synthetic_cdisc_data('latest')
ADSL <- synthetic_cdisc_data_latest$adsl"
),
cdisc_dataset("ADCM", ADCM,
code = "synthetic_cdisc_data_latest <- synthetic_cdisc_data('latest')
ADCM <- synthetic_cdisc_data_latest$adcm
ADCM$CMINDC <- paste0('Indication_', as.numeric(ADCM$CMDECOD))
ADCM$CMDOSE <- 1
ADCM$CMTRT <- ADCM$CMCAT
ADCM$CMDOSU <- 'U'
ADCM$CMROUTE <- 'CMROUTE'
ADCM$CMDOSFRQ <- 'CMDOSFRQ'
ADCM$CMASTDTM <- ADCM$ASTDTM
ADCM$CMAENDTM <- ADCM$AENDTM
formatters::var_labels(
ADCM[c('CMINDC', 'CMTRT', 'ASTDY')]) <- c(
'Indication',
'Reported Name of Drug, Med, or Therapy',
'Study Day of Start of Medication'
)",
keys = adcm_keys
)
),
modules = modules(
tm_t_pp_prior_medication(
label = "Prior medication",
dataname = "ADCM",
parentname = "ADSL",
patient_col = "USUBJID",
atirel = choices_selected(
choices = variable_choices(ADCM, "ATIREL"),
selected = "ATIREL"
),
cmdecod = choices_selected(
choices = variable_choices(ADCM, "CMDECOD"),
selected = "CMDECOD"
),
cmindc = choices_selected(
choices = variable_choices(ADCM, "CMINDC"),
selected = "CMINDC"
),
cmstdy = choices_selected(
choices = variable_choices(ADCM, "ASTDY"),
selected = "ASTDY"
)
)
)
)
#> [INFO] 2022-10-14 09:11:07.4935 pid:3139 token:[] teal.modules.clinical Initializing tm_t_pp_prior_medication
if (FALSE) {
shinyApp(app$ui, app$server)
}