Plugins for gsm.app are defined by a named list
with information about the
plugin. We provide a ready-to-use plugin definition for this AE plugin.
Usage
pluginAE(
chrCategoricalFields = c(aeser = "Serious?", mdrpt_nsv = "Preferred Term", mdrsoc_nsv =
"System Organ Class", aetoxgr = "Toxicity Grade", aeongo = "Ongoing?", aerel =
"Related?"),
chrDateFields = c(mincreated_dts = "AE Entry Date", aest_dt = "AE Start Date", aeen_dt
= "AE End Date"),
chrMetricID_AE = c(Site = "Analysis_kri0001", Country = "Analysis_cou0001"),
chrMetricID_SAE = c(Site = "Analysis_kri0002", Country = "Analysis_cou0002"),
lWorkflows = list()
)
Arguments
- chrCategoricalFields
character
A named vector of fields indfAE
to treat as categorical, where the names are the column names and the values are what to display to users. Unnamed elements will be used as both the field name and the display name. These fields are currently used in the Prevalence panel.- chrDateFields
character
A named vector of fields indfAE
to treat as dates, where the names are the column names and the values are what to display to users. Unnamed elements will be used as both the field name and the display name. These fields are currently used in the Timeline panel.- chrMetricID_AE
character
The ID(s) of the adverse events metric(c). The default value is named byGroupLevel
, but the names are not currently used. It is advisable to only provide oneMetricID
perGroupLevel
, though.- chrMetricID_SAE
character
The ID(s) of the serious adverse events metric(s). The default value is named byGroupLevel
, but the names are not currently used. It is advisable to only provide oneMetricID
perGroupLevel
, though.- lWorkflows
list
An optional named list of workflows to run in order to translate app domain data into the format required by the plugin (as defined in the pluginspec
). These workflows are ran before the plugin'sspec
is applied, and are meant to serve as a bridge between your domain data and the plugin's expected domains.
Examples
pluginAE()
#> $meta
#> $meta$Name
#> [1] "Adverse Events"
#>
#>
#> $shiny
#> $shiny$UI
#> function (id, chrCategoricalFields = c(aeser = "Serious?", mdrpt_nsv = "Preferred Term",
#> mdrsoc_nsv = "System Organ Class", aetoxgr = "Toxicity Grade",
#> aeongo = "Ongoing?", aerel = "Related?"), chrDateFields = c(mincreated_dts = "AE Entry Date",
#> aest_dt = "AE Start Date", aeen_dt = "AE End Date"))
#> {
#> ns <- NS(id)
#> bslib::page_fillable(mod_AEDashboard_UI(ns("dashboard"),
#> chrCategoricalFields = chrCategoricalFields, chrDateFields = chrDateFields))
#> }
#> <bytecode: 0x55db8b970018>
#> <environment: namespace:gsm.ae>
#>
#> $shiny$Server
#> function (id, dfAnalyticsInput, dfResults, rctv_dSnapshotDate,
#> rctv_dfAE_Study, rctv_strGroupID, rctv_strGroupLevel, rctv_strSubjectID,
#> chrCategoricalFields = c(aeser = "Serious?", mdrpt_nsv = "Preferred Term",
#> mdrsoc_nsv = "System Organ Class", aetoxgr = "Toxicity Grade",
#> aeongo = "Ongoing?", aerel = "Related?"), chrDateFields = c(mincreated_dts = "AE Entry Date",
#> aest_dt = "AE Start Date", aeen_dt = "AE End Date"),
#> chrMetricID_AE = c(Site = "Analysis_kri0001", Country = "Analysis_cou0001"),
#> chrMetricID_SAE = c(Site = "Analysis_kri0002", Country = "Analysis_cou0002"))
#> {
#> dfAnalyticsInput <- PrepareGSMData(dfAnalyticsInput, chrMetricID_AE = chrMetricID_AE,
#> chrMetricID_SAE = chrMetricID_SAE)
#> dfResults <- PrepareGSMData(dfResults, chrMetricID_AE = chrMetricID_AE,
#> chrMetricID_SAE = chrMetricID_SAE)
#> moduleServer(id, function(input, output, session) {
#> rctv_dSnapshotDatePrevious <- reactive({
#> dSnapshotDates <- as.Date(unique(dfResults$SnapshotDate))
#> dSnapshotDatesPrevious <- dSnapshotDates[!is.na(dSnapshotDates) &
#> dSnapshotDates < rctv_dSnapshotDate()]
#> if (length(dSnapshotDatesPrevious)) {
#> return(max(dSnapshotDatesPrevious, na.rm = TRUE))
#> }
#> return(as.Date(NA, origin = "1970-01-01"))
#> })
#> rctv_strGroupID_inferred <- reactive({
#> strGroupID <- rctv_strGroupID()
#> strSubjectID <- rctv_strSubjectID()
#> if (is.null(strGroupID) && length(strSubjectID) ==
#> 1) {
#> test1 <- dfAnalyticsInput$SubjectID == strSubjectID
#> test2 <- dfAnalyticsInput$GroupLevel == rctv_strGroupLevel()
#> return(dfAnalyticsInput$GroupID[test1 & test2][[1]])
#> }
#> return(strGroupID)
#> }) %>% bindCache(rctv_strSubjectID(), rctv_strGroupID(),
#> rctv_strGroupLevel())
#> mod_AEDashboard_Server("dashboard", dfAnalyticsInput = dfAnalyticsInput,
#> rctv_dSnapshotDate = rctv_dSnapshotDate, rctv_dSnapshotDatePrevious = rctv_dSnapshotDatePrevious,
#> rctv_dfAE_Study = rctv_dfAE_Study, rctv_strGroupID = rctv_strGroupID_inferred,
#> rctv_strGroupLevel = rctv_strGroupLevel, rctv_strSubjectID = rctv_strSubjectID,
#> chrCategoricalFields = chrCategoricalFields, chrDateFields = chrDateFields)
#> })
#> }
#> <bytecode: 0x55db8b972b78>
#> <environment: namespace:gsm.ae>
#>
#>
#> $spec
#> $spec$AE
#> $spec$AE$SubjectID
#> $spec$AE$SubjectID$type
#> [1] "character"
#>
#>
#> $spec$AE$GroupID
#> $spec$AE$GroupID$type
#> [1] "character"
#>
#>
#> $spec$AE$GroupLevel
#> $spec$AE$GroupLevel$type
#> [1] "character"
#>
#>
#> $spec$AE$aeser
#> $spec$AE$aeser$type
#> [1] "character"
#>
#>
#> $spec$AE$mdrpt_nsv
#> $spec$AE$mdrpt_nsv$type
#> [1] "character"
#>
#>
#> $spec$AE$mdrsoc_nsv
#> $spec$AE$mdrsoc_nsv$type
#> [1] "character"
#>
#>
#> $spec$AE$aetoxgr
#> $spec$AE$aetoxgr$type
#> [1] "character"
#>
#>
#> $spec$AE$aeongo
#> $spec$AE$aeongo$type
#> [1] "character"
#>
#>
#> $spec$AE$aerel
#> $spec$AE$aerel$type
#> [1] "character"
#>
#>
#> $spec$AE$mincreated_dts
#> $spec$AE$mincreated_dts$type
#> [1] "Date"
#>
#>
#> $spec$AE$aest_dt
#> $spec$AE$aest_dt$type
#> [1] "Date"
#>
#>
#> $spec$AE$aeen_dt
#> $spec$AE$aeen_dt$type
#> [1] "Date"
#>
#>
#>
#> $spec$SUBJ
#> $spec$SUBJ$SubjectID
#> $spec$SUBJ$SubjectID$type
#> [1] "character"
#>
#>
#>
#>
#> $config
#> $config$chrCategoricalFields
#> aeser mdrpt_nsv mdrsoc_nsv
#> "Serious?" "Preferred Term" "System Organ Class"
#> aetoxgr aeongo aerel
#> "Toxicity Grade" "Ongoing?" "Related?"
#>
#> $config$chrDateFields
#> mincreated_dts aest_dt aeen_dt
#> "AE Entry Date" "AE Start Date" "AE End Date"
#>
#> $config$chrMetricID_AE
#> Site Country
#> "Analysis_kri0001" "Analysis_cou0001"
#>
#> $config$chrMetricID_SAE
#> Site Country
#> "Analysis_kri0002" "Analysis_cou0002"
#>
#>
#> $packages
#> list()
#>
#> $required_inputs
#> character(0)
#>
#> $workflows
#> list()
#>