diff --git a/R/argument_convention.R b/R/argument_convention.R index 02ad702206..028898a120 100644 --- a/R/argument_convention.R +++ b/R/argument_convention.R @@ -56,6 +56,7 @@ #' @param interact_y (`character`)\cr a selected item from the interact_var column which will be used to select the #' specific `ANCOVA` results. If the interaction is not needed, the default option is `FALSE`. #' @param llt (`character`)\cr name of the variable with low level term for events. +#' @param patient_id (`character`)\cr patient ID. #' @param na_level (`string`)\cr used to replace all `NA` or empty values #' in character or factor variables in the data. Defaults to `""`. To set a #' default `na_level` to apply in all modules, run `set_default_na_str("new_default")`. diff --git a/R/tm_g_pp_therapy.R b/R/tm_g_pp_therapy.R index 8504b26c12..0fcf150a7b 100644 --- a/R/tm_g_pp_therapy.R +++ b/R/tm_g_pp_therapy.R @@ -1,22 +1,21 @@ -#' Template: Therapy +#' Template: Patient Profile Therapy Table and Plot #' -#' Creates a therapy template call. +#' Creates a valid expression to generate a patient profile therapy table and [ggplot2::ggplot()] plot using ADaM +#' datasets. #' #' @inheritParams template_arguments -#' @param atirel (`character`)\cr name of time relation of medication variable. -#' @param cmdecod (`character`)\cr name of standardized medication name variable. -#' @param cmindc (`character`)\cr name of indication variable. #' @param cmdose (`character`)\cr name of dose per administration variable. #' @param cmtrt (`character`)\cr name of reported name of drug, med, or therapy variable. #' @param cmdosu (`character`)\cr name of dose units variable. #' @param cmroute (`character`)\cr name of route of administration variable. #' @param cmdosfrq (`character`)\cr name of dosing frequency per interval variable. -#' @param cmstdy (`character`)\cr name of study day of start of medication variable. #' @param cmendy (`character`)\cr name of study day of end of medication variable. -#' @param patient_id (`character`)\cr patient ID. -#' @param font_size (`numeric`)\cr numeric vector of length 3 for current, min and max font size values. -#' @keywords internal #' +#' @inherit template_arguments return +#' +#' @seealso [tm_g_pp_therapy()] +#' +#' @keywords internal template_therapy <- function(dataname = "ANL", atirel = "ATIREL", cmdecod = "CMDECOD", @@ -230,36 +229,26 @@ template_therapy <- function(dataname = "ANL", y } -#' Teal Module: Patient Profile Therapy Teal Module +#' teal Module: Patient Profile Therapy Table and Plot #' -#' This teal module produces a patient profile therapy plot using `ADaM` datasets. +#' This module produces a patient profile therapy table and [ggplot2::ggplot()] type plot using ADaM datasets. #' #' @inheritParams module_arguments #' @inheritParams template_therapy -#' @param patient_col (`character`)\cr patient ID column to be used. -#' @param atirel ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `ATIREL` column of the `ADCM` dataset. -#' @param cmdecod ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `CMDECOD` column of the `ADCM` dataset. -#' @param cmdose ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `CMDOSE` column of the `ADCM` dataset. -#' @param cmtrt ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `CMTRT` column of the `ADCM` dataset. -#' @param cmdosu ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `CMDOSU` column of the `ADCM` dataset. -#' @param cmroute ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `CMROUTE` column of the `ADCM` dataset. -#' @param cmdosfrq ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `CMDOSFRQ` column of the `ADCM` dataset. -#' @param cmstdy ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `CMSTDY` column of the `ADCM` dataset. -#' @param cmendy ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `CMENDY` column of the `ADCM` dataset. -#' @param cmindc ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr -#' `CMINDC` column of the `ADCM` dataset. -#' @param font_size (`numeric`)\cr numeric vector of length 3 for current, min and max font size values. +#' @param cmdose ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all +#' available choices and preselected option for the `CMDOSE` variable from `dataname`. +#' @param cmtrt ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all +#' available choices and preselected option for the `CMTRT` variable from `dataname`. +#' @param cmdosu ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all +#' available choices and preselected option for the `CMDOSU` variable from `dataname`. +#' @param cmroute ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all +#' available choices and preselected option for the `CMROUTE` variable from `dataname`. +#' @param cmdosfrq ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all +#' available choices and preselected option for the `CMDOSFRQ` variable from `dataname`. +#' @param cmendy ([teal.transform::choices_selected()] or [teal.transform::data_extract_spec()])\cr object with all +#' available choices and preselected option for the `CMENDY` variable from `dataname`. #' -#' @export +#' @inherit module_arguments return #' #' @examples #' library(nestcolor) @@ -339,6 +328,7 @@ template_therapy <- function(dataname = "ANL", #' shinyApp(app$ui, app$server) #' } #' +#' @export tm_g_pp_therapy <- function(label, dataname = "ADCM", parentname = "ADSL", @@ -412,6 +402,7 @@ tm_g_pp_therapy <- function(label, ) } +#' @keywords internal ui_g_therapy <- function(id, ...) { ui_args <- list(...) is_single_dataset_value <- teal.transform::is_single_dataset( @@ -531,7 +522,7 @@ ui_g_therapy <- function(id, ...) { ) } - +#' @keywords internal srv_g_therapy <- function(id, data, reporter, diff --git a/man/template_therapy.Rd b/man/template_therapy.Rd index 53248b12d0..f56ccbca6d 100644 --- a/man/template_therapy.Rd +++ b/man/template_therapy.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/tm_g_pp_therapy.R \name{template_therapy} \alias{template_therapy} -\title{Template: Therapy} +\title{Template: Patient Profile Therapy Table and Plot} \usage{ template_therapy( dataname = "ANL", @@ -40,13 +40,13 @@ template_therapy( \item{cmdosfrq}{(\code{character})\cr name of dosing frequency per interval variable.} -\item{cmstdy}{(\code{character})\cr name of study day of start of medication variable.} +\item{cmstdy}{(\code{character})\cr name of study relative day of start of medication variable.} \item{cmendy}{(\code{character})\cr name of study day of end of medication variable.} \item{patient_id}{(\code{character})\cr patient ID.} -\item{font_size}{(\code{numeric})\cr numeric vector of length 3 for current, min and max font size values.} +\item{font_size}{(\code{numeric})\cr font size value.} \item{ggplot2_args}{optional, (\code{ggplot2_args})\cr object created by \code{\link[teal.widgets:ggplot2_args]{teal.widgets::ggplot2_args()}} with settings for the module plot. The argument is merged with option \code{teal.ggplot2_args} and with default module arguments @@ -54,7 +54,14 @@ for the module plot. The argument is merged with option \code{teal.ggplot2_args} For more details, see the vignette: \code{vignette("custom-ggplot2-arguments", package = "teal.widgets")}.} } +\value{ +a \code{list} of expressions to generate a table or plot object. +} \description{ -Creates a therapy template call. +Creates a valid expression to generate a patient profile therapy table and \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} plot using ADaM +datasets. +} +\seealso{ +\code{\link[=tm_g_pp_therapy]{tm_g_pp_therapy()}} } \keyword{internal} diff --git a/man/tm_g_pp_therapy.Rd b/man/tm_g_pp_therapy.Rd index 04054d4e65..807555e2be 100644 --- a/man/tm_g_pp_therapy.Rd +++ b/man/tm_g_pp_therapy.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/tm_g_pp_therapy.R \name{tm_g_pp_therapy} \alias{tm_g_pp_therapy} -\title{Teal Module: Patient Profile Therapy Teal Module} +\title{teal Module: Patient Profile Therapy Table and Plot} \usage{ tm_g_pp_therapy( label, @@ -34,39 +34,39 @@ tm_g_pp_therapy( \item{parentname}{(\code{character})\cr parent analysis data used in teal module, usually this refers to \code{ADSL}.} -\item{patient_col}{(\code{character})\cr patient ID column to be used.} +\item{patient_col}{(\code{character})\cr name of patient ID variable.} -\item{atirel}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{ATIREL} column of the \code{ADCM} dataset.} +\item{atirel}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{ATIREL} variable from \code{dataname}.} -\item{cmdecod}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{CMDECOD} column of the \code{ADCM} dataset.} +\item{cmdecod}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{CMDECOD} variable from \code{dataname}.} -\item{cmindc}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{CMINDC} column of the \code{ADCM} dataset.} +\item{cmindc}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{CMINDC} variable from \code{dataname}.} -\item{cmdose}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{CMDOSE} column of the \code{ADCM} dataset.} +\item{cmdose}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{CMDOSE} variable from \code{dataname}.} -\item{cmtrt}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{CMTRT} column of the \code{ADCM} dataset.} +\item{cmtrt}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{CMTRT} variable from \code{dataname}.} -\item{cmdosu}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{CMDOSU} column of the \code{ADCM} dataset.} +\item{cmdosu}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{CMDOSU} variable from \code{dataname}.} -\item{cmroute}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{CMROUTE} column of the \code{ADCM} dataset.} +\item{cmroute}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{CMROUTE} variable from \code{dataname}.} -\item{cmdosfrq}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{CMDOSFRQ} column of the \code{ADCM} dataset.} +\item{cmdosfrq}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{CMDOSFRQ} variable from \code{dataname}.} -\item{cmstdy}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{CMSTDY} column of the \code{ADCM} dataset.} +\item{cmstdy}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{CMSTDY} variable from \code{dataname}.} -\item{cmendy}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr -\code{CMENDY} column of the \code{ADCM} dataset.} +\item{cmendy}{(\code{\link[teal.transform:choices_selected]{teal.transform::choices_selected()}} or \code{\link[teal.transform:data_extract_spec]{teal.transform::data_extract_spec()}})\cr object with all +available choices and preselected option for the \code{CMENDY} variable from \code{dataname}.} -\item{font_size}{(\code{numeric})\cr numeric vector of length 3 for current, min and max font size values.} +\item{font_size}{(\code{numeric})\cr numeric vector of length 3 of current, minimum and maximum font size values.} \item{plot_height}{optional, (\code{numeric})\cr a vector of length three with \code{c(value, min, max)}. Specifies the height of the main plot and renders a slider on the plot to interactively adjust the plot height.} @@ -86,8 +86,11 @@ for the module plot. The argument is merged with option \code{teal.ggplot2_args} For more details, see the vignette: \code{vignette("custom-ggplot2-arguments", package = "teal.widgets")}.} } +\value{ +a \code{teal_module} object. +} \description{ -This teal module produces a patient profile therapy plot using \code{ADaM} datasets. +This module produces a patient profile therapy table and \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} type plot using ADaM datasets. } \examples{ library(nestcolor)