{"id":297079,"name":"wqbench","description":"Generate download and compile data from EPA ECOTOX database to generate aquatic life water quality benchmarks.","url":"https://github.com/bcgov/wqbench","last_synced_at":"2026-04-12T01:02:05.392Z","repository":{"id":182081750,"uuid":"597519249","full_name":"bcgov/wqbench","owner":"bcgov","description":"R package to generate download and compile data from EPA ECOTOX database","archived":false,"fork":false,"pushed_at":"2026-03-31T17:18:03.000Z","size":4574,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-05T17:20:00.751Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://bcgov.github.io/wqbench/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcgov.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-04T19:50:11.000Z","updated_at":"2026-03-31T17:12:22.000Z","dependencies_parsed_at":"2024-09-20T04:30:30.973Z","dependency_job_id":"6ff1926b-0dd0-4588-bc39-06bc366d61a2","html_url":"https://github.com/bcgov/wqbench","commit_stats":{"total_commits":591,"total_committers":4,"mean_commits":147.75,"dds":"0.11675126903553301","last_synced_commit":"ce320f0e2f40aa55b9b535e28814f5554cf9a370"},"previous_names":["bcgov/wqbench"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bcgov/wqbench","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fwqbench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fwqbench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fwqbench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fwqbench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcgov","download_url":"https://codeload.github.com/bcgov/wqbench/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fwqbench/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31451447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"ssl_error","status_checked_at":"2026-04-05T21:22:51.943Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"owner":{"login":"bcgov","name":"bcgov","uuid":"916280","kind":"organization","description":"This is the home for code that is open","email":"Developer.Experience@gov.bc.ca","website":"https://github.com/bcgov/BC-Policy-Framework-For-GitHub","location":"Canada","twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/916280?v=4","repositories_count":2150,"last_synced_at":"2024-12-16T17:13:08.511Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/bcgov","funding_links":[],"total_stars":5184,"followers":687,"following":0,"created_at":"2022-11-05T11:06:51.523Z","updated_at":"2024-12-16T17:13:08.511Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcgov","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcgov/repositories"},"packages":[],"commits":{"id":1638672,"full_name":"bcgov/wqbench","default_branch":"main","total_commits":614,"total_committers":4,"total_bot_commits":2,"total_bot_committers":1,"mean_commits":153.5,"dds":0.1123778501628665,"past_year_total_commits":11,"past_year_total_committers":1,"past_year_total_bot_commits":0,"past_year_total_bot_committers":0,"past_year_mean_commits":11.0,"past_year_dds":0.0,"last_synced_at":"2026-04-05T22:05:20.467Z","last_synced_commit":"62c79a87970af0d524b334adcdb1a14fd6c6ea90","created_at":"2024-07-24T00:17:49.918Z","updated_at":"2026-04-05T22:05:07.709Z","committers":[{"name":"Ayla Pearson","email":"ayla@poissonconsulting.ca","login":"aylapear","count":545},{"name":"Andy Teucher","email":"andy.teucher@gmail.com","login":"ateucher","count":60},{"name":"Joe Thorley","email":"joe@poissonconsulting.ca","login":"joethorley","count":7},{"name":"repo-mountie[bot]","email":"44246292+repo-mountie[bot]","login":"repo-mountie[bot]","count":2}],"past_year_committers":[{"name":"Ayla Pearson","email":"ayla@poissonconsulting.ca","login":"aylapear","count":11}],"commits_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fwqbench/commits","host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-04-07T00:00:11.408Z","repositories_count":6211731,"commits_count":917753764,"contributors_count":35560078,"owners_count":1142810,"icon_url":"https://github.com/github.png","host_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://commits.ecosyste.ms/api/v1/hosts/GitHub/repositories"}},"issues_stats":{"full_name":"bcgov/wqbench","html_url":"https://github.com/bcgov/wqbench","last_synced_at":"2026-04-05T17:11:48.179Z","status":"active","issues_count":40,"pull_requests_count":29,"avg_time_to_close_issue":3079840.1842105263,"avg_time_to_close_pull_request":469288.14285714284,"issues_closed_count":38,"pull_requests_closed_count":28,"pull_request_authors_count":3,"issue_authors_count":2,"avg_comments_per_issue":1.2,"avg_comments_per_pull_request":0.20689655172413793,"merged_pull_requests_count":24,"bot_issues_count":0,"bot_pull_requests_count":1,"past_year_issues_count":0,"past_year_pull_requests_count":1,"past_year_avg_time_to_close_issue":null,"past_year_avg_time_to_close_pull_request":54140.0,"past_year_issues_closed_count":0,"past_year_pull_requests_closed_count":1,"past_year_pull_request_authors_count":1,"past_year_issue_authors_count":0,"past_year_avg_comments_per_issue":null,"past_year_avg_comments_per_pull_request":0.0,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":1,"created_at":"2024-07-24T00:17:50.670Z","updated_at":"2026-04-05T17:11:48.179Z","repository_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fwqbench","issues_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcgov%2Fwqbench/issues","issue_labels_count":{"Type: Enhancement":3,"Priority: 5 Don't Do!":2,"Priority: 1 Critical":2,"Difficulty: 1 Simple":1,"Priority: 4 Low":1,"Effort: 1 Low":1,"Type: Testing":1,"Next Release":1},"pull_request_labels_count":{},"issue_author_associations_count":{"COLLABORATOR":40},"pull_request_author_associations_count":{"COLLABORATOR":28,"CONTRIBUTOR":1},"issue_authors":{"aylapear":39,"ateucher":1},"pull_request_authors":{"aylapear":18,"ateucher":10,"repo-mountie[bot]":1},"host":{"name":"GitHub","url":"https://github.com","kind":"github","last_synced_at":"2026-04-05T00:00:08.668Z","repositories_count":14095632,"issues_count":34421481,"pull_requests_count":112300245,"authors_count":11226509,"icon_url":"https://github.com/github.png","host_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/repositories","owners_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/owners","authors_url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors"},"past_year_issue_labels_count":{},"past_year_pull_request_labels_count":{},"past_year_issue_author_associations_count":{},"past_year_pull_request_author_associations_count":{"COLLABORATOR":1},"past_year_issue_authors":{},"past_year_pull_request_authors":{"aylapear":1},"maintainers":[{"login":"aylapear","count":57,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/aylapear"},{"login":"ateucher","count":11,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/ateucher"}],"active_maintainers":[{"login":"aylapear","count":1,"url":"https://issues.ecosyste.ms/api/v1/hosts/GitHub/authors/aylapear"}]},"events":{"total":{"DeleteEvent":6,"PullRequestEvent":20,"IssuesEvent":1,"IssueCommentEvent":1,"PushEvent":37,"PullRequestReviewEvent":4,"CreateEvent":4},"last_year":{"PullRequestEvent":1,"IssuesEvent":1,"PushEvent":2}},"keywords":[],"dependencies":[{"ecosystem":"actions","filepath":".github/workflows/R-CMD-check.yaml","sha":null,"kind":"manifest","created_at":"2023-07-18T17:45:51.448Z","updated_at":"2023-07-18T17:45:51.448Z","repository_link":"https://github.com/bcgov/wqbench/blob/main/.github/workflows/R-CMD-check.yaml","dependencies":[{"id":11661845086,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":11661845087,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":11661845088,"package_name":"r-lib/actions/setup-r-dependencies","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":11661845089,"package_name":"r-lib/actions/check-r-package","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/test-coverage.yaml","sha":null,"kind":"manifest","created_at":"2023-07-18T17:45:51.566Z","updated_at":"2023-07-18T17:45:51.566Z","repository_link":"https://github.com/bcgov/wqbench/blob/main/.github/workflows/test-coverage.yaml","dependencies":[{"id":11661845203,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":11661845210,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":11661845212,"package_name":"r-lib/actions/setup-r-dependencies","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":11661845216,"package_name":"actions/upload-artifact","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false}]},{"ecosystem":"cran","filepath":"DESCRIPTION","sha":null,"kind":"manifest","created_at":"2023-07-18T17:45:51.641Z","updated_at":"2023-07-18T17:45:51.641Z","repository_link":"https://github.com/bcgov/wqbench/blob/main/DESCRIPTION","dependencies":[{"id":11661845857,"package_name":"chk","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845862,"package_name":"DBI","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845865,"package_name":"dplyr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845867,"package_name":"ggplot2","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845869,"package_name":"httr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845873,"package_name":"readr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845875,"package_name":"rlang","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845878,"package_name":"RSQLite","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845880,"package_name":"rvest","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845882,"package_name":"scales","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845885,"package_name":"ssdtools","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845965,"package_name":"stringr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845968,"package_name":"tibble","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845970,"package_name":"tidyr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845972,"package_name":"utils","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845974,"package_name":"withr","ecosystem":"cran","requirements":"*","direct":true,"kind":"imports","optional":false},{"id":11661845976,"package_name":"covr","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false},{"id":11661845978,"package_name":"testthat","ecosystem":"cran","requirements":"\u003e= 3.0.0","direct":true,"kind":"suggests","optional":false},{"id":11661845980,"package_name":"wqbenchdata","ecosystem":"cran","requirements":"*","direct":true,"kind":"suggests","optional":false}]},{"ecosystem":"actions","filepath":".github/workflows/pkgdown.yaml","sha":null,"kind":"manifest","created_at":"2024-04-12T21:52:13.064Z","updated_at":"2024-04-12T21:52:13.064Z","repository_link":"https://github.com/bcgov/wqbench/blob/main/.github/workflows/pkgdown.yaml","dependencies":[{"id":17389102080,"package_name":"actions/checkout","ecosystem":"actions","requirements":"v3","direct":true,"kind":"composite","optional":false},{"id":17389102081,"package_name":"r-lib/actions/setup-pandoc","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":17389102082,"package_name":"r-lib/actions/setup-r","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":17389102083,"package_name":"r-lib/actions/setup-r-dependencies","ecosystem":"actions","requirements":"v2","direct":true,"kind":"composite","optional":false},{"id":17389102084,"package_name":"JamesIves/github-pages-deploy-action","ecosystem":"actions","requirements":"v4.4.1","direct":true,"kind":"composite","optional":false}]}],"score":2.995732273553991,"created_at":"2024-07-24T00:17:41.979Z","updated_at":"2026-04-12T01:02:05.393Z","avatar_url":"https://github.com/bcgov.png","language":"R","category":"Natural Resources","sub_category":"Water Supply and Quality","monthly_downloads":0,"total_dependent_repos":0,"total_dependent_packages":0,"readme":"---\noutput: github_document\n---\n\n# wqbench\n\n\u003c!-- badges: start --\u003e\n[![img](https://img.shields.io/badge/Lifecycle-Experimental-339999)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md)\n[![R-CMD-check](https://github.com/bcgov/wqbench/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bcgov/wqbench/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/bcgov/wqbench/branch/main/graph/badge.svg)](https://app.codecov.io/gh/bcgov/wqbench?branch=main)\n\u003c!-- badges: end --\u003e\n\nThis package contains the functions and tools to generate aquatic life water quality benchmarks.\n\n## Installation\n\n```{r, eval=FALSE}\n# install.packages(\"devtools\")\ndevtools::install_github(\"bcgov/wqbench\")\n```\n\n## Workflow\n\n```{r}\nlibrary(wqbench)\n```\n\n### Create Data Set for Shiny App\n\nThe `wqb_create_data_set()` function will download the US EPA ECOTOX\u003csup\u003e1\u003c/sup\u003e database, create a local .sqlite database, add other data sources and filter conditions, clean and process the data, classify the duration, standardize the effect and output the completed data set needed for the shinywqbench app.\nThe function will create an RDS file of the data set as well.\nIt takes a few minutes to download and create the data set.\n\nThe default argument for:\n\n- `file_path` will save the raw text files at `\"~/Ecotoxicology/ecotox\"`.\n- `folder_path` will save the .sqlite database and RDS file is at `\"~/Ecotoxicology/ecotox_db/\"`.\n- `version` will download the most recent version of the data set available on the website.\n\n```{r, eval=FALSE}\ndata_set \u003c- wqb_create_data_set()\n```\n\nThe data set can be read in after it has been created.\n\n```{r, eval=FALSE}\ndata_set \u003c- readRDS(\"~/Ecotoxicology/ecotox_db/ecotox_ascii_09_12_2024.rds\")\n```\n\n### Generate Benchmark\n\n```{r}\nset.seed(101)\n```\n\n#### Deterministic Example\n\n```{r}\ndata \u003c- wqb_filter_chemical(wqbenchdata::aquatic_data, \"100016\")\ndata \u003c- wqb_benchmark_method(data)\n\ndata_agg \u003c- wqb_aggregate(data)\ndata_agg \u003c- wqb_af(data_agg)\n\nctv \u003c- wqb_generate_ctv(data_agg)\nctv\n```\n\nTo calculate the benchmark for the chemical, divide the critical toxicity value (ctv) by the assessment factors.\n\n```{r}\nbenchmark \u003c- ctv / (data_agg$af_bc_species * data_agg$af_salmon * data_agg$af_planktonic * data_agg$af_variation)\nbenchmark\n```\n\n*Deterministic* method only generates an estimate, the lcl and ucl columns will always be blank .\n\n```{r}\n# Plot data set\nwqb_plot(data)\n```\n\n```{r, fig.width=14}\n# Plot the results\nwqb_plot_det(data_agg)\n```\n\n#### SSD Example\n\n```{r}\ndata \u003c- wqb_filter_chemical(wqbenchdata::aquatic_data, \"1071836\")\ndata \u003c- wqb_benchmark_method(data)\n\ndata_agg \u003c- wqb_aggregate(data)\ndata_agg \u003c- wqb_af(data_agg)\n\nctv \u003c- wqb_generate_ctv(data_agg)\nctv\n```\n\nTo calculate the benchmark for the chemical, divide the critical toxicity value (ctv) by the assessment factors.\n\n```{r}\nbenchmark \u003c- ctv / (data_agg$af_bc_species * data_agg$af_salmon * data_agg$af_planktonic * data_agg$af_variation)\nbenchmark\n```\n\n*SSD* method can generate a lower and upper confidence interval.\n\n```{r, fig.height=10, fig.width=12}\n# Plot data set\nwqb_plot(data)\n```\n\n```{r}\n# Plot the results\nfit \u003c- wqb_ssd_fit(data_agg)\nwqb_plot_ssd(data_agg, fit)\n```\n\n#### Summary Tables\n\n```{r}\nwqb_summary_trophic_species(data_agg)\nwqb_summary_trophic_groups(data_agg)\nwqb_summary_af(data_agg)\n```\n\n## Developer Instructions\n\nSee the [Developer Instructions](https://bcgov.github.io/wqbench/articles/Developer-instructions.html) on the package website for\ninstructions on updating the reference data for the database and updating the \"Add Data\" template\n\nSee the [README in the shinywqbench repository](https://github.com/bcgov/shinywqbench?tab=readme-ov-file#shinywqbench) for instructions for updating\nand deploying the [shiny app](https://bcgov-env.shinyapps.io/shinywqbench/).\n\n## Getting Help or Reporting an Issue\n\nTo report issues, bugs or enhancements, please file an [issue](https://github.com/bcgov/wqbench/issues).\nCheck out the [support](https://github.com/bcgov/wqbench/blob/main/.github/SUPPORT.md) for more info.\n\n## Code of Conduct\n\nPlease note that the shinywqbench project is released with a [Contributor Code of Conduct](https://github.com/bcgov/wqbench/CODE_OF_CONDUCT.md).\nBy contributing to this project, you agree to abide by its terms.\n\n## License\n\nThe code is released under the Apache License 2.0\n\n\u003e Copyright 2023 Province of British Columbia\n\u003e\n\u003e Licensed under the Apache License, Version 2.0 (the \"License\");\n\u003e you may not use this file except in compliance with the License.\n\u003e You may obtain a copy of the License at\n\u003e\n\u003e https://www.apache.org/licenses/LICENSE-2.0\n\u003e\n\u003e Unless required by applicable law or agreed to in writing, software\n\u003e distributed under the License is distributed on an \"AS IS\" BASIS,\n\u003e WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\u003e See the License for the specific language governing permissions and\n\u003e limitations under the License.\n\n## Reference\n\n1. Olker, J. H., Elonen, C. M., Pilli, A., Anderson, A., Kinziger, B., Erickson, S., Skopinski, M., Pomplun, A., LaLone, C. A., Russom, C. L., \u0026 Hoff, D. (2022). The ECOTOXicology Knowledgebase: A Curated Database of Ecologically Relevant Toxicity Tests to Support Environmental Research and Risk Assessment. Environmental Toxicology and Chemistry, 41(6):1520-1539. https://doi.org/10.1002/etc.5324\n","funding_links":[],"readme_doi_urls":["https://doi.org/10.1002/etc.5324"],"works":{},"citation_counts":{},"total_citations":0,"keywords_from_contributors":["geo"],"project_url":"https://ost.ecosyste.ms/api/v1/projects/297079","html_url":"https://ost.ecosyste.ms/projects/297079"}