Skip to content

Commit

Permalink
Merge pull request bcgov#37 from poissonconsulting/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
aylapear authored Mar 25, 2024
2 parents ac0c880 + 893ecce commit ba80e6c
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 19 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
.RProfile
.httr-oauth

*.html

docs/
inst/docs/

Expand Down
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Imports:
markdown,
pkgload,
readr,
readxl,
rlang,
rmarkdown,
shiny,
Expand Down
2 changes: 1 addition & 1 deletion R/app-ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
30 changes: 19 additions & 11 deletions R/mod-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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"),
Expand Down Expand Up @@ -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)) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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 |>
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ output: github_document
# shinywqbench

<!-- badges: start -->
[![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)
<!-- badges: end -->

This package is a shiny app that makes using the functions of the `wqbench` package accessible to non-R users.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

<!-- badges: start -->

[![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)
<!-- badges: end -->

This package is a shiny app that makes using the functions of the
Expand Down
14 changes: 14 additions & 0 deletions app.R
Original file line number Diff line number Diff line change
@@ -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()
24 changes: 24 additions & 0 deletions inst/app/www/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div id="footer">
<div id="footerWrapper">
<div id="footerAdminSection">
<div id="footerAdminLinksContainer" class="container">
<div id="footerAdminLinks" class="row">
<ul class="inline">
<li data-order="0">
<a href="//www2.gov.bc.ca/gov/content/home/disclaimer" target="_self">Disclaimer</a>
</li>
<li data-order="1">
<a href="//www2.gov.bc.ca/gov/content/home/privacy" target="_self">Privacy</a>
</li>
<li data-order="2">
<a href="//www2.gov.bc.ca/gov/content/home/accessibility" target="_self">Accessibility</a>
</li>
<li data-order="3">
<a href="//www2.gov.bc.ca/gov/content/home/copyright" target="_self">Copyright</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
4 changes: 1 addition & 3 deletions inst/extdata/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] 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)



Expand All @@ -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).
10 changes: 10 additions & 0 deletions rsconnect/shinyapps.io/poissonconsulting/shinywqbench.dcf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ba80e6c

Please sign in to comment.