Skip to contents

This is the main teal app that puts everything together.

Usage

ui_teal(
  id,
  splash_ui = tags$h2("Starting the Teal App"),
  title = NULL,
  header = tags$p(""),
  footer = tags$p("")
)

srv_teal(id, modules, raw_data, filter = teal_slices())

Arguments

id

(character(1))
module id

splash_ui

(shiny.tag)
UI to display initially, can be a splash screen or a Shiny module UI. For the latter, see init() about how to call the corresponding server function.

title

(NULL or character)
The browser window title (defaults to the host URL of the page).

header

(shiny.tag or character)
the header of the app. Note shiny code placed here (and in the footer argument) will be placed in the app's ui function so code which needs to be placed in the ui function (such as loading CSS via htmltools::htmlDependency()) should be included here.

footer

(shiny.tag or character)
the footer of the app

raw_data

(reactive)
returns the TealData, only evaluated once, NULL value is ignored

Value

ui_teal returns HTML for Shiny module UI. srv_teal returns reactive which returns the currently active module.

Details

It displays the splash UI which is used to fetch the data, possibly prompting for a password input to fetch the data. Once the data is ready, the splash screen is replaced by the actual teal UI that is tabsetted and has a filter panel with datanames that are relevant for the current tab. Nested tabs are possible, but we limit it to two nesting levels for reasons of clarity of the UI.

The splash screen functionality can also be used for non-delayed data which takes time to load into memory, avoiding Shiny session timeouts.

Server evaluates the raw_data (delayed data mechanism) and creates the datasets object that is shared across modules. Once it is ready and non-NULL, the splash screen is replaced by the main teal UI that depends on the data. The currently active tab is tracked and the right filter panel updates the displayed datasets to filter for according to the active datanames of the tab.

It is written as a Shiny module so it can be added into other apps as well.

Examples

mods <- teal:::example_modules()
raw_data <- reactive(teal:::example_cdisc_data())
app <- shinyApp(
  ui = function() {
    teal:::ui_teal("dummy")
  },
  server = function(input, output, session) {
    active_module <- teal:::srv_teal(id = "dummy", modules = mods, raw_data = raw_data)
  }
)
if (interactive()) {
  runApp(app)
}