teal Module: Patient Profile Prior Medication
Source:R/tm_t_pp_prior_medication.R
tm_t_pp_prior_medication.RdThis module produces a patient profile 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,
transformators = list(),
decorators = lifecycle::deprecated()
)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)
name of patient ID variable.- atirel
(
teal.transform::choices_selected())
object with all available choices and preselected option for theATIRELvariable fromdataname.- cmdecod
(
teal.transform::choices_selected())
object with all available choices and preselected option for theCMDECODvariable fromdataname.- cmindc
(
teal.transform::choices_selected())
object with all available choices and preselected option for theCMINDCvariable fromdataname.- cmstdy
(
teal.transform::choices_selected())
object with all available choices and preselected option for theCMSTDYvariable fromdataname.- pre_output
(
shiny.tag) optional,
with text placed before the output to put the output into context. For example a title.- post_output
(
shiny.tag) optional,
with text placed after the output to put the output into context. For example theshiny::helpText()elements are useful.- transformators
(
listofteal_transform_module) that will be applied to transform module's data input. To learn more checkvignette("transform-input-data", package = "teal").- decorators
-
(named
listof lists ofteal_transform_module) optional, decorator for tables or plots included in the module output reported. The decorators are applied to the respective output objects.See section "Decorating Module" below for more details.
Reporting
This module returns an object of class teal_module, that contains a server function.
Since the server function returns a teal_report object, this makes this module reportable, which means that
the reporting functionality will be turned on automatically by the teal framework.
For more information on reporting in teal, see the vignettes:
vignette("reportable-shiny-application", package = "teal.reporter")vignette("adding-support-for-reporting-to-custom-modules", package = "teal")
Examples
library(dplyr)
data <- teal_data()
data <- within(data, {
ADCM <- tmc_ex_adcm
ADSL <- tmc_ex_adsl %>% filter(USUBJID %in% ADCM$USUBJID)
ADCM$CMASTDTM <- ADCM$ASTDTM
ADCM$CMAENDTM <- ADCM$AENDTM
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
join_keys(data)["ADCM", "ADCM"] <- adcm_keys
ADSL <- data[["ADSL"]]
ADCM <- data[["ADCM"]]
app <- init(
data = data,
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"
)
)
)
)
#> Initializing tm_t_pp_prior_medication
if (interactive()) {
shinyApp(app$ui, app$server)
}