Skip to content

NCC-CNC/wheretowork

Repository files navigation

Where to Work: Interactive systematic conservation planning application

lifecycle R-CMD-check-Ubuntu R-CMD-check-Windows Docker Status Coverage Status

The Where To Work application is a decision support tool to help prioritize conservation efforts for the Nature Conservancy of Canada. It provides an interactive interface for conducting systematic conservation planning exercises, and uses mathematical optimization algorithms to generate solutions.

Usage

The application is available online. Please note that you must use Google Chrome for it to work.

Installation

The application is available as an online service provided by the Nature Conservancy of Canada. If you need to run the application on your own computer, then you can run it using the R statistical computing environment, Docker, or Docker Compose.

Using R

To use this method, you will need to install the R statistical computing environment. After completing the installation, you can install the application using the following R code:

if (!require(remotes)) install.packages("remotes")
remotes::install_github("NCC-CNC/wheretowork")

You can then use the following R code to start the application and open it in your web browser:

wheretowork::run_app()

Using Docker

To use this method, you will need to install Docker Engine (see here for instructions). After completing this step, you can install the application from the DockerHub repository. Specifically, please use the following system command:

docker run -dp 3838:3838 --name wheretowork -it naturecons/wheretowork:latest

You can then view the application by opening the following link in Google Chrome: http://localhost:3838. After you have finished using the application, you can terminate it using the following system command. Note that if you don’t terminate the application once you are finished using it, then it will continue running in the background.

docker rm -f wheretowork

Using Docker Compose

To use this method, you will need to install Docker Engine (see here for instructions) and Docker Compose (see here for instructions). After installing both programs, you can install the application by cloning this repository and then using the following system commands:

docker-compose pull
docker-compose up -d

You can then view the application by opening the following link in Google Chrome: http://localhost:3838. After you have finished using the application, you can terminate it using the following system command. Note that if you don’t terminate the application once you are finished using it, then it will continue running in the background.

docker-compose down

Contributing

The application is a Shiny web application developed using the R statistical computing environment. Specifically, it uses the golem framework. This means that the application is effectively an R package that contains code for defining and launching the application (see here for more details). The R code files (located in the ./R directory) are organized using the following naming conventions:

  • app_*: Defines the web application:
    • app_config.R: Imports configuration settings.
    • app_global.R: Initializes the application. It performs a similar to the global.R file in typical Shiny applications.
    • app_server.R: Defines the (back-end) server-side logic for the application. It performs a similar role to the server.R file in typical Shiny applications.
    • app_ui.R: Defines the (font-end) user interface for the application. It performs a similar role to the ui.R file in typical Shiny applications.
  • server_*: Defines components used to assemble the server-side logic for the application.
  • ui_*: Defines functions used to programmatically create HTML elements for the front-end of the application.
  • class_*: Defines object orientated programming classes used in the back-end of the application. These classes are implemented using R6 class system.
  • fct_*: Defines R functions used in the back-end of the application. These files contain code used to perform analyses and manipulate the classes.
  • widget_*: Defines custom widgets used by the application. These widgets are implemented using the htmlwidgets framework.
  • utils_*: Defines utility R functions used in the back-end of the application.

Getting help

Thank you for checking out this application. If you encounter any software defects (e.g. application crashes, unexpected behavior, or spelling mistakes), please feel free to post them on the issue tracker. If you have any questions about using this application, please contact Dr. Richard Schuster ([email protected]) or Prof. Joe Bennett ([email protected]).