diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..ed7650c --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,48 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index ef10e0b..407a673 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,6 @@ .RProfile .httr-oauth -*.html - docs/ inst/docs/ diff --git a/DESCRIPTION b/DESCRIPTION index 63936f8..04c591d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,6 +26,7 @@ Imports: markdown, pkgload, readr, + readxl, rlang, rmarkdown, shiny, diff --git a/R/app-ui.R b/R/app-ui.R index b118774..07570d5 100644 --- a/R/app-ui.R +++ b/R/app-ui.R @@ -22,7 +22,7 @@ app_ui <- function() { navbarPage( title = div( img(src = "../images/gov3_bc_logo.png", style = "padding-right: 20px;"), - "Emerging Contaminant Aquatic Life Benchmarks - DRAFT" + "Emerging Contaminant Aquatic Life Benchmarks" ), selected = "tab1", id = "navbarID", diff --git a/R/mod-data.R b/R/mod-data.R index f634813..9a62d9b 100644 --- a/R/mod-data.R +++ b/R/mod-data.R @@ -76,7 +76,7 @@ mod_data_ui <- function(id, label = "data") { p("Once a chemical has been selected, hit the Run button."), ), wellPanel( - p("To add your own data."), + p("To append your data to the existing set."), p("1. Download and fill in template. Check the User Guide tab for descriptions of each column."), uiOutput(ns("download_add")), br(), @@ -85,7 +85,7 @@ mod_data_ui <- function(id, label = "data") { ns("file_add"), "", multiple = FALSE, - accept = c(".csv") + accept = c(".xlsx") ), p("3. Click the Add button to add the uploaded data."), actionButton(ns("add_button"), "Add"), @@ -281,13 +281,19 @@ mod_data_server <- function(id) { }) output$dl_add <- downloadHandler( - filename = function() paste0("template-wqbench.csv"), + filename = function() paste0("template-wqbench.xlsx"), content = function(file) { - readr::write_csv(wqbench::template[0, -1], file) + file.copy( + from = system.file( + package = "wqbench", + "template/template-data.xlsx" + ), + to = file + ) } ) - # Add data + # Add uploaded data observeEvent(input$add_button, { # Check that data already present if (is.null(rv$data)) { @@ -303,16 +309,16 @@ mod_data_server <- function(id) { } check_uploaded_1 <- try( - check_upload(input$file_add$datapath, ext = "csv"), + check_upload(input$file_add$datapath, ext = "xlsx"), silent = TRUE ) if (is_try_error(check_uploaded_1)) { return(showModal(check_modal(check_uploaded_1))) } - add_tbl_1 <- readr::read_csv( + add_tbl_1 <- readxl::read_excel( input$file_add$datapath, - show_col_types = FALSE + sheet = "data" ) if (nrow(add_tbl_1) == 0) { @@ -359,10 +365,12 @@ mod_data_server <- function(id) { ecological_group = factor( .data$ecological_group, levels = levels(rv$data$ecological_group) - ), - remove_row = FALSE + ) ) - + + add_tbl_1 <- wqbench::wqb_classify_duration(add_tbl_1, quiet = TRUE) + add_tbl_1 <- wqbench::wqb_standardize_effect(add_tbl_1, quiet = TRUE) + add_tbl_1$remove_row <- FALSE # 3. Add to data set rv$data <- rv$data |> diff --git a/README.Rmd b/README.Rmd index 0d6dc20..6e9431f 100644 --- a/README.Rmd +++ b/README.Rmd @@ -5,7 +5,7 @@ output: github_document # shinywqbench -[![img](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md) +[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) This package is a shiny app that makes using the functions of the `wqbench` package accessible to non-R users. diff --git a/README.md b/README.md index 6f1ab9f..f67d95d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ -[![img](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md) +[![Lifecycle: +stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) This package is a shiny app that makes using the functions of the diff --git a/app.R b/app.R index d98767d..53ccbf7 100644 --- a/app.R +++ b/app.R @@ -1,2 +1,16 @@ +# Copyright 2023 Province of British Columbia +# +# 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. + pkgload::load_all(".") shinywqbench::run_wqbench_app() diff --git a/inst/app/www/footer.html b/inst/app/www/footer.html new file mode 100644 index 0000000..e19d656 --- /dev/null +++ b/inst/app/www/footer.html @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/inst/extdata/about.md b/inst/extdata/about.md index 3274cd6..2d0ee23 100644 --- a/inst/extdata/about.md +++ b/inst/extdata/about.md @@ -19,7 +19,7 @@ Although these benchmarks follow methods similar to those outlined in the [BC WQ Rather the purpose of the benchmarks is to support the assessment of monitoring data and the potential for a chemical to impact the aquatic environment. If you have any feedback or comments on this app, please email them to Angeline.Tillmanns@gov.bc.ca For further information on this app, please see the draft overview: -[Tillmanns, A.R. and Pearson, A. 2023. DRAFT wqbench: A Tool for Calculating Emerging Contaminant Aquatic Life Benchmarks. Ministry of Water, Land and Resource Stewardship. Province of British Columbia, Victoria.](https://www2.gov.bc.ca/assets/gov/environment/air-land-water/water/waterquality/water-quality-guidelines/approved-wqgs/benchmarks_for_emerging_contaminants_overview_draft_august_2023.pdf) +[Tillmanns, A.R. and Pearson, A. 2023. wqbench: A Tool for Calculating Emerging Contaminant Aquatic Life Benchmarks. Ministry of Water, Land and Resource Stewardship. Province of British Columbia, Victoria.](https://www2.gov.bc.ca/assets/gov/environment/air-land-water/water/waterquality/water-quality-guidelines/approved-wqgs/benchmarks_for_emerging_contaminants_overview_draft_august_2023.pdf) @@ -35,6 +35,4 @@ The app automatically completes the following steps: A full description of the steps can be found in the accompanying document, "An overview of the aquatic life water quality benchmark generator" which will eventually be published. -Please do not cite this app at this point. - The code is released under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). diff --git a/rsconnect/shinyapps.io/poissonconsulting/shinywqbench.dcf b/rsconnect/shinyapps.io/poissonconsulting/shinywqbench.dcf new file mode 100644 index 0000000..afebd30 --- /dev/null +++ b/rsconnect/shinyapps.io/poissonconsulting/shinywqbench.dcf @@ -0,0 +1,10 @@ +name: shinywqbench +title: +username: poissonconsulting +account: poissonconsulting +server: shinyapps.io +hostUrl: https://api.shinyapps.io/v1 +appId: 8452407 +bundleId: 8416442 +url: https://poissonconsulting.shinyapps.io/shinywqbench/ +version: 1