Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: main
branches: [main]
pull_request:
branches: main
# allow manual action trigger
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: r-lib/actions/setup-pandoc@v2

Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/format-batch-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Workflow derived from https://github.com/posit-dev/setup-air/tree/main/examples
name: format-update

on:
# This workflow is run manually from the Actions tab
workflow_dispatch:

jobs:
format-update:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}

- name: Install
uses: posit-dev/setup-air@v1

- name: Format
run: air format .

- name: commit updates
uses: EndBug/add-and-commit@v9
with:
author_name: 'github-actions[bot]'
author_email: 'github-actions[bot]@users.noreply.github.com'
message: "air formatting"
34 changes: 34 additions & 0 deletions .github/workflows/spellcheck-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:
branches: [develop]
pull_request:
branches: develop

name: spelling-check

jobs:
spelling-check:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v6

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install spellchecker
run: install.packages("spelling")
shell: Rscript {0}

- name: Spellcheck root directory (include vignettes)
id: spellcheck # Assign ID to this step for output
run: |
result <- spelling::spell_check_package()
result
if (length(result[[1]]) != 0) {
stop("Spelling errors found (fix or add to WORDLIST)")
}
shell: Rscript {0}
45 changes: 41 additions & 4 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,53 @@ on:

name: test-coverage

permissions:
contents: write
checks: write
pull-requests: write

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
extra-packages: any::covr, any::xml2
needs: coverage

- name: Capture Environment Info
run: |
Rscript -e '
env_vars <- Sys.getenv()
pkg_versions <- installed.packages()[, c("Package", "Version")]
sys_info <- Sys.info()
save(env_vars, pkg_versions, sys_info, file = "ci_env_info.RData")
'

- name: Upload Environment Info
uses: actions/upload-artifact@v6
with:
name: ci_env_info
path: ci_env_info.RData

- name: Test coverage
run: |
covr::codecov(
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}

- name: Show testthat output
Expand All @@ -44,8 +66,23 @@ jobs:

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
if-no-files-found: ignore # Suppress warnings if no files are found

- name: Upload coverage report
uses: actions/upload-artifact@v6
with:
name: coverage-report
path: ./cobertura.xml

- name: Comment coverage
uses: 5monkeys/cobertura-action@master
with:
report_name: coverage-report
path: ./cobertura.xml
minimum_coverage: 10
show_missing: true
link_missing_lines: true
Empty file removed CONTRIBUTING.md
Empty file.
16 changes: 10 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ License: CC0
URL: https://github.com/USEPA/TADAShinyAnalyze
BugReports: https://github.com/USEPA/TADAShinyAnalyze/issues
Imports:
stats,
config,
dplyr,
dplyr (>= 1.1.0),
EPATADA,
TADACommunityHub,
golem,
gotop,
htmltools,
leaflet,
pkgload,
sf,
shiny,
shinyjs,
utils,
Expand All @@ -42,15 +42,19 @@ Imports:
readr,
httr,
slider,
rExpertQuery
rExpertQuery,
graphics
Remotes:
USEPA/EPATADA@develop
USEPA/EPATADA,
USEPA/TADACommunityHub,
USEPA/rExpertQuery
Suggests:
spelling,
testthat (>= 3.0.0)
Depends:
R (>= 4.1.0)
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
LazyData: true
RoxygenNote: 7.3.3
StagedInstall: FALSE
15 changes: 8 additions & 7 deletions R/fct_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ criteria_join <- function(x, y, match_type = "Option 2",
-TADA.MethodSpeciationName,
-TADA.ComparableDataIdentifier
) |>
dplyr::mutate(dplyr::across(dplyr::any_of("TADA.ResultSampleFractionText"), as.character)) # temp solution, consider removing after TADA updates
EPATADA::TADA_CorrectColType()
#dplyr::mutate(dplyr::across(dplyr::any_of("TADA.ResultSampleFractionText"), as.character)) # temp solution, consider removing after TADA updates

# Build join expression as a string
join_cols <- c(
Expand Down Expand Up @@ -93,7 +94,7 @@ pH_join <- function(x, y){

by <- dplyr::join_by(TADA.MonitoringLocationIdentifier, TADA.MonitoringLocationTypeName,
TADA.LatitudeMeasure, TADA.LongitudeMeasure,
dplyr::closest(DateTime >= DateTime_lower),
closest(DateTime >= DateTime_lower),
closest(DateTime <= DateTime_upper))

x2 <- x |>
Expand Down Expand Up @@ -135,7 +136,7 @@ temp_join <- function(x, y){

by <- dplyr::join_by(TADA.MonitoringLocationIdentifier, TADA.MonitoringLocationTypeName,
TADA.LatitudeMeasure, TADA.LongitudeMeasure,
dplyr::closest(DateTime >= DateTime_lower),
closest(DateTime >= DateTime_lower),
closest(DateTime <= DateTime_upper))

x2 <- x |>
Expand Down Expand Up @@ -276,7 +277,7 @@ excursion_summary <- function(x, type){
Start_Date = min(ActivityStartDate, na.rm = TRUE),
End_Date = max(ActivityStartDate, na.rm = TRUE),
Minimum = min(TADA.ResultMeasureValue, na.rm = TRUE),
Median = median(TADA.ResultMeasureValue, na.rm = TRUE),
Median = stats::median(TADA.ResultMeasureValue, na.rm = TRUE),
Maximum = max(TADA.ResultMeasureValue, na.rm = TRUE),
Number_of_Excursions = modSum(Excursion),
.groups = "drop") |>
Expand Down Expand Up @@ -1232,7 +1233,7 @@ frequency_summary <- function(x, type){
x_P2 <- x_P |>
dplyr::group_by(dplyr::across(dplyr::all_of(id_cols2))) |>
dplyr::mutate(FreqValue = FreqValue/100) |>
dplyr::mutate(Percentile = quantile(Result_Duration,
dplyr::mutate(Percentile = stats::quantile(Result_Duration,
probs = dplyr::first(FreqValue))) |>
dplyr::mutate(E_Value = Percentile) |>
dplyr::ungroup()
Expand Down Expand Up @@ -1468,8 +1469,8 @@ window_before_period <- function(unit, value) {
if (is.na(unit)) unit <- "n-day"
if (unit == "n-hour") return(lubridate::hours(max(value, 1) - 1))
if (unit == "n-day") return(lubridate::days(max(value, 1) - 1))
if (unit == "n-month") return(lubridate::months(max(value, 1)) - lubridate::days(1))
if (unit == "n-season") return(lubridate::months(3L * max(value, 1)) - lubridate::days(1))
if (unit == "n-month") return(months(max(value, 1)) - lubridate::days(1))
if (unit == "n-season") return(months(3L * max(value, 1)) - lubridate::days(1))
lubridate::days(max(value, 1) - 1)
}

Expand Down
6 changes: 3 additions & 3 deletions R/mod_analysis_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ mod_analysis_plots_server <- function(id,

# Check if there's data to plot
if(nrow(filtered_data4()) == 0) {
plot.new()
text(0.5, 0.5, "No data available for selected filters",
graphics::plot.new()
graphics::text(0.5, 0.5, "No data available for selected filters",
cex = 1.2, col = "gray50")
return(NULL)
}
Expand Down Expand Up @@ -564,7 +564,7 @@ mod_analysis_plots_server <- function(id,

# Helper: line type from AcuteChronic
get_linetype <- function(vals) {
typ <- unique(tolower(na.omit(vals)))
typ <- unique(tolower(stats::na.omit(vals)))
if ("acute" %in% typ) return("dotted")
if ("chronic" %in% typ) return("dashed")
return("solid")
Expand Down
6 changes: 5 additions & 1 deletion R/mod_batch_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,10 @@ mod_batch_analysis_server <- function(id, tadat){
# Get selected locations - if NULL or empty, use all locations
selected_locs <- tadat$selected_monitoring_locations

if (is.null(selected_locs) || length(selected_locs) == 0) {
# No selection - set to NULL to show empty state
tadat$exceedance_summary2 <- NULL
} else{
# Filter based on location type for the exceedance results
if (tadat$loc_select %in% "MLid") {
exceedance_summary2 <- tadat$exceed_summary |>
Expand All @@ -806,7 +810,7 @@ mod_batch_analysis_server <- function(id, tadat){

exceedance_summary2 <- tadat$exceed_summary |>
dplyr::filter(ATTAINS.AssessmentUnitIdentifier %in% selected_aus)
}
}}

# Handle NULL or empty parameter filter
if (is.null(input$parameter_filter) || length(input$parameter_filter) == 0) {
Expand Down
Loading