An interactive app to issue or end Air Quality Warnings built using RStudio's Shiny open source R package.
Only to be used by ENV Air Quality Meteorologists contact the team for usage.
- R, minimum version 4.4.3 (Note: Earlier versions of R may not process qmd files correctly when testing locally)
- Quarto 1.4.X
- Shiny 1.10.X
bcmaps
fs
here
htmlwidgets
knitr
leaflet
leaflet.esri # note: this package has been removed from the CRAN repo and is unmaintained
mapview
sf
shiny
shinydashboard
shinyjs
tidyverse # mostly using dplyr, tidyr, readr, lubridate
quarto
webshot
zip
Here is high-level documentation on the development of applications, use of GitHub, and Openshift in the Government of BC:
Instructions are geared toward the following tools:
- Ensure R, RStudio, and Quarto are installed on the machine
- Clone this repository using GitHub Desktop
- Open project in RStudio
- Install required packages
Run
source("src/run_app_locally/install_packages.r")
in the console or select "Run" from RStudio's Source Pane - Make and required changes
- Run the app locally to review
Run
shiny::runApp()
or select "Run App" from RStudio's Source Pane
To deploy to TEST and PROD you require a shinyapps.io account.
-
Install rsconnect.
- Before deploying for the first time, you need to ensure you have the rsconnect R package from CRAN installed. Run the following command in your R console to check:
library(rsconnect)
- If you get an Error that says “there is no package called ‘rsconnect’, try to install it the usual way:
install.packages(rsconnect)
- Before deploying for the first time, you need to ensure you have the rsconnect R package from CRAN installed. Run the following command in your R console to check:
-
Configure rsconnect with your shinyapps.io token. Follow the shinyapps.io instructions to copy your token from the account page and configure it in the R console:
rsconnect::setAccountInfo(name="<ACCOUNT>", token="<TOKEN>", secret="<SECRET>")
-
Publish the app.
- Run
deployApp()
or select "Publish" from RStudio's Source Pane with either theui.R
orserver.R
file open. - Fill in all the required details in the dialog box, noting them for future reference:
- On the left side, choose which files to publish (or not publish)
- On the right side, ensure you have the correct account selected
- Enter a name that is at least 4 alphanumeric characters (no spaces). the name will be part of the URL to access your app, for example:
https://<ACCOUNT>.shinyapps.io/<APPNAME>
- For PROD the app name is
aqwarnings_shiny
, we publish new apps for major test versions following the conventionaqwarnings_shiny_test_<date>
.
- Run
-
Set up athentication for the app. (Note: you only have to do this when publishing a new app)
- Go to the shinyapps.io dashboard.
- Navigate to the administrative interface, select the application to modify, and click on the Users tab. - Follow the instructions to change the Application Visibility setting to "Private" and restart the app.
To report bugs/issues/feature requests, please file an issue.
If you would like to contribute, please see our CONTRIBUTING guidelines.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Copyright 2025 Province of British Columbia
Code is licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Documentation including the content of air quality warnings and bulletins by the Province of British Columbia is licensed under a Creative Commons Attribution 4.0 International License: https://creativecommons.org/licenses/by/4.0/.
This repository contains information in the /data/raw/shapefiles
folder adapted from Meteorological Service of Canada (MSC) Forecast Regions Polygons, which is information licenced under the Data Server End-use Licence of Environment and Climate Change Canada.
This project was created using the bcgovr package.