Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DrugPollutR

DrugPollutR is an R Shiny application for exploring aquatic environmental occurrence data and using those data to build environmentally grounded dose series for ecotoxicology experiments.

Hosted app: https://jakemartinresearch.shinyapps.io/DrugPollutR/

Background

Pharmaceutical pollution is a growing global environmental concern, and experimental studies often test concentrations that are much higher than those typically reported in real-world aquatic systems. A major practical reason for this mismatch is that environmental occurrence data are large, fragmented, inconsistently indexed, and time-consuming to clean before they can be used for study design.

DrugPollutR was built to reduce that friction. It provides a simple interface for searching a harmonized occurrence dataset, summarizing observed concentrations, visualizing their distribution, and translating those observations into candidate dose series for laboratory studies. The app is intended as a decision-support tool that helps researchers justify exposure concentrations with reference to measured environmental data.

What The App Does

DrugPollutR is organized into two linked modules.

ChemicalExploreR

ChemicalExploreR helps users find and summarize occurrence records for a compound of interest.

Features:

  • Search by compound name, CAS number, or CID
  • Select one or more matching search terms
  • Group results by parent_compound when related forms should be treated together
  • Filter records by matrix type: surfacewater, effluent, or Combined
  • View matched compounds, summary statistics, concentration density plots, and filtered records
  • Download filtered datasets and summaries with an embedded citation note

Summary statistics and plots are calculated from positive environmental detections only.

DoseSelectR

DoseSelectR uses the environmental concentration data returned from the search workflow to propose a dose series for ecotoxicology studies.

Features:

  • Choose the central tendency used to anchor the series: median, mean, or mode
  • Set the target number of doses
  • Adjust the dose spacing factor
  • Generate a proposed dose table and visualize it against the observed distribution on raw and log scales
  • Download the resulting dose table

The current workflow uses only positive concentration values, requires enough data to define a usable distribution, and applies a lower quantification threshold to avoid implausibly low doses.

Data Foundation

This database was compiled for Martin et al (2025) Environ. Sci. Technol. Lett. 2025, 12, 10, 1308-1313 (https://doi.org/10.1021/acs.estlett.5c00665). It is based on a filtered synthesis of three publicly available datasets: (1) the NORMAN EMPODAT database for chemical occurrence (accessed 18/03/2025), (2) the Umweltbundesamt Pharmaceuticals in the Environment database (PHARMS-UBA; accessed 19/12/2024), and (3) Wilkinson et al. (2022) Pharmaceutical Pollution of the World's Rivers database. Data were restricted to entries reported in mass per volume of water (e.g., µg/L) and relevant to surface water and wastewater matrices (for details of the filtering process, please refer to Martin et al. (2025))

In the packaged app, the processed datasets are stored as bundled app data:

  • inst/app/data/env_data.rds
  • inst/app/data/compound_key.rds

Repository Structure

  • R/: exported package functions, including run_app() and select_doses()
  • inst/app/: bundled Shiny application
  • inst/app/data/: processed app data used by the Shiny application
  • man/: package documentation files
  • tests/testthat/: automated tests
  • sandpit/: manuscripts, old drafts, build artifacts, figures, and other non-package working files

Running Locally

Install from GitHub

Once the repository is pushed to GitHub, DrugPollutR can be installed directly from Git:

install.packages("remotes")
remotes::install_github("JakeMartinResearch/DrugPollutR")
DrugPollutR::run_app()

The package includes a local copy of the processed app data used by the Shiny application. The exported select_doses() function can also be used directly in R workflows.

Use the data and dose workflow from R

The app workflow is also available as regular package functions:

library(DrugPollutR)

# Return the full positive occurrence table
occurrence_df <- occurrence_data()

# Filter by compound name, CAS number, or PubChem CID
fluoxetine_df <- occurrence_data(Name = "fluoxetine")
diclofenac_df <- occurrence_data(CAS = "15307-86-5")
cid_df <- occurrence_data(CID = "3033")

# Restrict to one matrix
surfacewater_df <- occurrence_data(
  Name = "fluoxetine",
  matrix = "surfacewater"
)

# Return app-style summary statistics
occurrence_summary(Name = "fluoxetine")

# Generate the same kind of dose output used by DoseSelectR
dose_result <- occurrence_doses(
  Name = "fluoxetine",
  max_doses = 5,
  min_spacing = 3.2
)

dose_result$doses
dose_result$plot

Requirements

Install a recent version of R and the packages used by the app:

  • shiny
  • bslib
  • shinyWidgets
  • dplyr
  • ggplot2
  • data.table
  • DT
  • scales
  • patchwork

Launch during development

From the project directory in R:

devtools::load_all()
DrugPollutR::run_app()

The Shiny app itself is stored at inst/app/app.R. The root directory is now kept as the R package layer so the GitHub install structure is clearer.

Typical Workflow

  1. Search for a compound in ChemicalExploreR by name, CAS, or CID.
  2. Review matched compounds and choose whether to group by parent compound.
  3. Filter by matrix type and inspect summary statistics, plots, and underlying records.
  4. Move to DoseSelectR and choose a central tendency, number of doses, and spacing factor.
  5. Generate a candidate dose series and download the outputs if needed.

Intended Use And Scope

DrugPollutR is designed to support experimental planning, not to replace researcher judgment. Users may still decide to test concentrations above currently observed environmental levels, include hotspot scenarios, or add positive controls for specific experimental aims. The app is best used as a transparent starting point for environmentally informed study design.

Citation

If you use the app or its compiled data in research outputs, please cite the associated paper and the original occurrence data sources:

  • Martin, J. M.; Brand, J. A.; McCallum, E. S. (2025). Aligning Behavioral Ecotoxicology with Real-World Water Concentrations: Current Minimum Tested Levels for Pharmaceuticals Far Exceed Environmental Reality. Environmental Science & Technology Letters. https://doi.org/10.1021/acs.estlett.5c00665
  • NORMAN EMPODAT
  • PHARMS-UBA
  • Wilkinson et al. (2022). Pharmaceutical Pollution of the World's Rivers. Proceedings of the National Academy of Sciences. https://doi.org/10.1073/pnas.2113947119

About

DrugPollutR is an R Shiny application for exploring aquatic environmental occurrence data and using those data to build environmentally grounded dose series for ecotoxicology experiments.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages