Skip to content

jumpingrivers/flu.dashboard

Repository files navigation

Flu Dashboard

The {flu.dashboard} R package contains:

  • A Shiny application for viewing the information provided in the application.

For information about the content and purpose of the application, read the file at inst/about/about_main.md.

A version of this app is deployed to gallery-flu.jmpr.io. You can also view some of the other apps, dashboards and widgets from Jumping Rivers in our gallery.

Environment variables

The app stores data using pins. The current pin location used in the code is for a Posit Connect server. If this is where your pins will be stored, you'll need to create an API key, or know what your existing one is.

Then you'll need to add these details to an .Renviron file, which contains the following details:

CONNECT_SERVER=https://your.connect.server
CONNECT_API_KEY=AbCdE123456f

Replacing the placeholders with the value for your server address and API key.

You should not upload the .Renviron file as part of your bundle when deploying the application.

If the dashboard and the pre-processed data pins are deployed to the same Posit Connect server by the same user, these environment variables do not need to be configured for the application. Posit Connect will handle the authentication automatically.

Pins username

The file at inst/data-processing/config.yml is used to set the filename where pins are stored and the Posit Connect username that hosts the pin.

In order to load pins from the correct account name, you need to set your Posit Connect username in the pins_username variable. The default setting is

default:
  pins_username: !expr Sys.getenv("PINS_USERNAME", unset = "your_username")

This allows you to define your username either as (in order of priority):

  • An environment variable called PINS_USERNAME
  • By replacing the your_username placeholder in the inst/data-processing/config.yml file.

For application users

To install the application, use:

remotes::install_github("jumpingrivers/flu.dashboard")

With any necessary environment variables set to connect to the data sources through {pins}, you can start the Shiny application using:

flu.dashboard::run()

For application developers

Restoring {renv}

If you are forking the repository to develop, note this uses {renv} to manage R package dependencies. To install the R packages from the {renv} lockfile, run renv::restore() or read documentation from the {renv} website.

Running the application

From the root directory of the repository, you can start the application in the normal way for a Shiny application.

shiny::runApp()

Deploying the application

  1. If you have introduced or updated packages for the application, update the {renv} lockfile

    renv::snapshot(dev = TRUE)
  2. If performing a git-backed deployment from Posit Connect, update the manifest.json file:

    rsconnect::write_manifest()
  3. Deploy to your hosting service from the app.R file at the root of the repository, or allow Posit Connect's git-backed deployment to perform the deployment and automatically check for updates to the manifest.json file by pushing changes to the git repository.

Authors and acknowledgment

This has been created by the Data Science team at Jumping Rivers. You can get in touch with us at hello@jumpingrivers.com.

We'd like to thank Andy McCann and the DS Team within NUCT at NHS ML who created the original inspiration inspiration for this app with their 'flu-tracker Shiny application (source code).

License

This R package has a GNU GPL v3 license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages