Skip to content

include-dcc/include-shiny-template

Repository files navigation

INCLUDE Shiny Template

Lifecycle: experimental

Welcome to INCLUDE. This repository will serve as a guide for developing shiny applications and contains the most basic golem shiny application structure.

Installation

You can install the released version of includeshinytemplate from CRAN with:

install.packages("includeshinytemplate")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("include-dcc/include-shiny-template")

Example

This is a basic example which shows you how to solve a common problem:

library(includeshinytemplate)
## basic example code

Using this template

  1. After copying this template, these are the files that must be updated with your repository name.

    • README.Rmd
    • docker-compose.yml
    • CONTRIBUTING.md
    • dev/01_start.R
    • dev/02_dev.R
  2. After updating these files, please make sure to run the functions in dev/01_start.R to update this repository.

  3. If you want to push this shiny application to CAVATICA, add a github secret with your CAVATICA_AUTH_TOKEN. Make sure you also create a CAVATICA project. Comment the deploy section of the .github/workflows/ci.yaml.

Developmental Guide

In this shiny application template we try to follow the guidelines described by Engineering Production-Grade Shiny Apps: https://engineering-shiny.org/index.html. In particular we utilize tools such as golem and renv to build our shiny application. The steps described below can all be found in more detail in the shiny engineering link above.

  1. Create Golem Shiny App: golem::create_golem() as documented here

  2. Utilize renv to set up your R environment

  3. Update readme by modifying README.Rmd (not README.md):

    devtools::build_readme()
    
  4. Add golem modules. You will most likely want to remove mod_hello_world.R and add your own golem module. Be sure to add to app_ui.R and app_ui.R to use your module. More information here

    golem::add_module( name = "hello_world" )
    
  5. Add tests. More information here

    usethis::use_test( "app" )
    
  6. Need to use Python? Use reticulate Be sure to use either conda or pipenv to manage your Python dependencies.

  7. The CI/CD for this repository is done through github actions and consists of 3 major steps. The file is located at .github/workflows/ci.yaml

    • test: Testing of the shiny package
    • docker: This section is commented out ci.yaml but you can choose to un-comment it out if you want to use this.
    • deploy: Upload this to CAVATICA project so it can be used in data cruncher.

About

🚧 Repo template for INCLUDE Shiny apps

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published