Skip to content
Milan Malfait edited this page Sep 12, 2024 · 1 revision

Overview

The Shiny app is developed using the {golem} framework. Among other things, this means that we make heavy use of Shiny modules. In brief, a Shiny module is a self-contained, encapsulated piece of Shiny UI and server logic. In practice, this will often be a particular component of the dashboard. Note that it is possible to nest modules within other modules, leading to a hierarchical structure.

The filenames in R/ follow the {golem} conventions:

  • The app_*.R files define the UI and server logic for the app itself.
  • The mod_*.R files define the UI and server logic for the modules.
  • Any business logic functions, which are independent from the app's application logic, are defined in the fct_*.R files.

An overview of the app's design is given in the diagram below (note that this is subject to change):

Design diagram

The source for this image is available here

File structure

The repository is organised as an R package with a few additional directories used for deployment of the Shiny app:

  • R/: contains the R source code for the package
  • inst/: configuration files and dummy data for the app
    • dev_data/: dummy data for the app to use during development
    • app/wwww: static files (e.g. CSS, JavaScript) for the app
  • man/: documentation files for the package, generated by {roxygen2}
  • tests/: unit tests for the package, written with {testthat}

The directories not included in the package (i.e. listed in .Rbuildignore) but used for deployment and data preprocessing:

  • data-raw/test_db: the source data for generating the test data
  • data/test_data: test data parquet files mimicking what real data would look like to run the app in production
  • dev/: contains scripts and helper functions for development
  • deploy/: contains Docker files and scripts for deployment
  • renv/: contains the renv library, managed by {renv}
  • scripts/: contains scripts for data preprocessing and generating the test and development data
Clone this wiki locally