From 486defcd8a33bc4e9b6e69731922c9424a6af2e1 Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Sun, 21 Jan 2024 17:37:00 -0800 Subject: [PATCH 01/10] update lifecycle badge to stable --- README.Rmd | 2 +- README.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 From b279052b8b12be3e97473db17d038f6e93e8f184 Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Sun, 21 Jan 2024 17:37:10 -0800 Subject: [PATCH 02/10] remove draft in the title --- R/app-ui.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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", From 84e735705ef077c524dbc017dd5181aadd04a20f Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Sun, 21 Jan 2024 17:37:21 -0800 Subject: [PATCH 03/10] remove draft and do not cite --- inst/extdata/about.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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). From 46493589e9bf037ae76b5e9c89c01643fbf765c0 Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Sun, 21 Jan 2024 17:38:32 -0800 Subject: [PATCH 04/10] update wording --- R/mod-data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/mod-data.R b/R/mod-data.R index f634813..3f64c59 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(), From a07ae35531aec65d578c5288a34a057033ee7fc0 Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Sun, 21 Jan 2024 17:40:09 -0800 Subject: [PATCH 05/10] add pkgdown action --- .github/workflows/pkgdown.yaml | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/pkgdown.yaml 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 From 4c7e264016278e2136e63853c8e31b0128597a50 Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Mon, 22 Jan 2024 10:55:04 -0800 Subject: [PATCH 06/10] Adding missing footer file --- .gitignore | 2 -- inst/app/www/footer.html | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 inst/app/www/footer.html 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/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 From 223c541367ddbd29c9ee1347e77af017afbbe0ba Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Thu, 25 Jan 2024 09:13:49 -0800 Subject: [PATCH 07/10] update to allow for excel and add data --- DESCRIPTION | 1 + R/mod-data.R | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) 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/mod-data.R b/R/mod-data.R index 3f64c59..6609a5a 100644 --- a/R/mod-data.R +++ b/R/mod-data.R @@ -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,9 +281,15 @@ 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 + ) } ) @@ -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) { @@ -363,6 +369,9 @@ mod_data_server <- function(id) { 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) + # 3. Add to data set rv$data <- rv$data |> From f798a03036f9cdb04b67b07a2811e786f3afecde Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Thu, 25 Jan 2024 09:32:19 -0800 Subject: [PATCH 08/10] change when remove row flag is added to uploaded data so edit works --- R/mod-data.R | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/R/mod-data.R b/R/mod-data.R index 6609a5a..9a62d9b 100644 --- a/R/mod-data.R +++ b/R/mod-data.R @@ -293,7 +293,7 @@ mod_data_server <- function(id) { } ) - # Add data + # Add uploaded data observeEvent(input$add_button, { # Check that data already present if (is.null(rv$data)) { @@ -365,13 +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 |> From 26a56865942fea6c6107e5bb43bd703a60ff5762 Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Thu, 25 Jan 2024 09:34:41 -0800 Subject: [PATCH 09/10] add licence file --- app.R | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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() From 893eccef79cbcc71e15e0510e853e90ff60fb9f8 Mon Sep 17 00:00:00 2001 From: Ayla Pearson Date: Mon, 25 Mar 2024 12:07:13 -0700 Subject: [PATCH 10/10] working dev deployment --- .../shinyapps.io/poissonconsulting/shinywqbench.dcf | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 rsconnect/shinyapps.io/poissonconsulting/shinywqbench.dcf 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