-
Notifications
You must be signed in to change notification settings - Fork 23
Update TADA_CreateAUMLCrosswalk #769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Key additions: Guarding against NULLs and vector org_id values, and explicitly defaulting org_id = "all" when org_id is NULL (common in Shiny) so the function will query ATTAINS unless org_id is explicitly set to "none". Preflight connectivity check to ATTAINS with timing and more informative messages. Increased timeout and timing instrumentation around the ATTAINS web-service calls to make their latency visible. tryCatch around remote/geospatial calls to avoid hard failures on server and to surface diagnostic messages. Guards around sf operations and missing coordinates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
air
[air] reported by reviewdog 🐶
EPATADA/R/GeospatialFunctions.R
Line 3925 in 4d704a8
| if ("TADA.LongitudeMeasure" %in% names(get.attains) && "TADA.LatitudeMeasure" %in% names(get.attains)) { |
[air] reported by reviewdog 🐶
EPATADA/R/GeospatialFunctions.R
Line 3927 in 4d704a8
| dplyr::filter(!is.na(.data$TADA.LongitudeMeasure), !is.na(.data$TADA.LatitudeMeasure)) |
[air] reported by reviewdog 🐶
EPATADA/R/GeospatialFunctions.R
Line 3936 in 4d704a8
| message("st_as_sf (get.attains geometry) failed: ", conditionMessage(e)) |
[air] reported by reviewdog 🐶
EPATADA/R/GeospatialFunctions.R
Lines 4073 to 4075 in 4d704a8
| if (exists("get.attains.matches") && | |
| !is.null(get.attains.matches$without_ATTAINS_catchment) && | |
| !is.null(get.attains.matches$TADA_without_ATTAINS)) { |
[air] reported by reviewdog 🐶
EPATADA/R/GeospatialFunctions.R
Line 4085 in 4d704a8
| message("fill_USGS_catch = TRUE, but there are no USGS catchment outputs to append (no unmatched MLs or matching failed).") |
[air] reported by reviewdog 🐶
Lines 528 to 530 in 4d704a8
| na.cols <- .data |> | |
| purrr::keep(~ all(is.na(.x))) |> | |
| names() |
[air] reported by reviewdog 🐶
Lines 92 to 93 in 4d704a8
| check_inv <- .data[ | |
| , |
[air] reported by reviewdog 🐶
Lines 323 to 325 in 4d704a8
| tada.all <- tada.all |> | |
| dplyr::select(-CharUnit) |> | |
| dplyr::distinct() |
[air] reported by reviewdog 🐶
Line 2363 in 4d704a8
| .data[[col.name]] <- switch(col.type, |
[air] reported by reviewdog 🐶
Lines 277 to 279 in 4d704a8
| do.list <- do.data |> | |
| dplyr::select(ResultIdentifier) |> | |
| dplyr::pull() |
[air] reported by reviewdog 🐶
EPATADA/tests/testthat/test-URLChecker.R
Lines 103 to 105 in 4d704a8
| files <- append(other_files, vignettes) |> | |
| append(articles) |> | |
| append(r_files) |
R/CriteriaComparison.R
Outdated
| all.pairs <- pair.activityid |> | ||
| rbind(pair.ml.time) |> | ||
| dplyr::distinct() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| all.pairs <- pair.activityid |> | |
| rbind(pair.ml.time) |> | |
| dplyr::distinct() | |
| all.pairs <- pair.activityid |> rbind(pair.ml.time) |> dplyr::distinct() |
R/DataDiscoveryRetrieval.R
Outdated
| ~tribal_area, ~url, | ||
| "Alaska Native Allotments", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| ~tribal_area, ~url, | |
| "Alaska Native Allotments", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/0", | |
| ~tribal_area , ~url , | |
| "Alaska Native Allotments" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/0" , |
R/DataDiscoveryRetrieval.R
Outdated
| "American Indian Reservations", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/2", | ||
| "Off-reservation Trust Lands", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/3", | ||
| "Oklahoma Tribal Statistical Areas", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/4" # , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| "American Indian Reservations", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/2", | |
| "Off-reservation Trust Lands", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/3", | |
| "Oklahoma Tribal Statistical Areas", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/4" # , | |
| "American Indian Reservations" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/2" , | |
| "Off-reservation Trust Lands" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/3" , | |
| "Oklahoma Tribal Statistical Areas" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/4" # , |
R/DataDiscoveryRetrieval.R
Outdated
| record_count <- query_avail |> | ||
| dplyr::pull(resultCount) |> | ||
| sum() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| record_count <- query_avail |> | |
| dplyr::pull(resultCount) |> | |
| sum() | |
| record_count <- query_avail |> dplyr::pull(resultCount) |> sum() |
R/DataDiscoveryRetrieval.R
Outdated
| ~tribal_area, ~url, | ||
| "Alaska Native Allotments", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/0", | ||
| "Alaska Native Villages", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/1", | ||
| "American Indian Reservations", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/2", | ||
| "Off-reservation Trust Lands", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/3", | ||
| "Oklahoma Tribal Statistical Areas", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/4", | ||
| "Virginia Federally Recognized Tribes", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| ~tribal_area, ~url, | |
| "Alaska Native Allotments", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/0", | |
| "Alaska Native Villages", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/1", | |
| "American Indian Reservations", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/2", | |
| "Off-reservation Trust Lands", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/3", | |
| "Oklahoma Tribal Statistical Areas", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/4", | |
| "Virginia Federally Recognized Tribes", "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/5" | |
| ~tribal_area , ~url , | |
| "Alaska Native Allotments" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/0" , | |
| "Alaska Native Villages" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/1" , | |
| "American Indian Reservations" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/2" , | |
| "Off-reservation Trust Lands" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/3" , | |
| "Oklahoma Tribal Statistical Areas" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/4" , | |
| "Virginia Federally Recognized Tribes" , "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/5" |
R/GeospatialFunctions.R
Outdated
| crs = 4326 | ||
| # ADDED: Guard against missing coordinates which can occur if inputs have NA lat/long | ||
| # This avoids errors in st_as_sf on Shiny servers with incomplete data | ||
| if ("TADA.LongitudeMeasure" %in% names(user) && "TADA.LatitudeMeasure" %in% names(user)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| if ("TADA.LongitudeMeasure" %in% names(user) && "TADA.LatitudeMeasure" %in% names(user)) { | |
| if ( | |
| "TADA.LongitudeMeasure" %in% | |
| names(user) && | |
| "TADA.LatitudeMeasure" %in% names(user) | |
| ) { |
R/GeospatialFunctions.R
Outdated
| # This avoids errors in st_as_sf on Shiny servers with incomplete data | ||
| if ("TADA.LongitudeMeasure" %in% names(user) && "TADA.LatitudeMeasure" %in% names(user)) { | ||
| user <- user |> | ||
| dplyr::filter(!is.na(.data$TADA.LongitudeMeasure), !is.na(.data$TADA.LatitudeMeasure)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| dplyr::filter(!is.na(.data$TADA.LongitudeMeasure), !is.na(.data$TADA.LatitudeMeasure)) | |
| dplyr::filter( | |
| !is.na(.data$TADA.LongitudeMeasure), | |
| !is.na(.data$TADA.LatitudeMeasure) | |
| ) |
R/GeospatialFunctions.R
Outdated
| attains, | ||
| coords = c("TADA.LongitudeMeasure", "TADA.LatitudeMeasure"), | ||
| crs = 4326 | ||
| if ("TADA.LongitudeMeasure" %in% names(attains) && "TADA.LatitudeMeasure" %in% names(attains)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| if ("TADA.LongitudeMeasure" %in% names(attains) && "TADA.LatitudeMeasure" %in% names(attains)) { | |
| if ( | |
| "TADA.LongitudeMeasure" %in% | |
| names(attains) && | |
| "TADA.LatitudeMeasure" %in% names(attains) | |
| ) { |
R/GeospatialFunctions.R
Outdated
| crs = 4326 | ||
| if ("TADA.LongitudeMeasure" %in% names(attains) && "TADA.LatitudeMeasure" %in% names(attains)) { | ||
| attains <- attains |> | ||
| dplyr::filter(!is.na(.data$TADA.LongitudeMeasure), !is.na(.data$TADA.LatitudeMeasure)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| dplyr::filter(!is.na(.data$TADA.LongitudeMeasure), !is.na(.data$TADA.LatitudeMeasure)) | |
| dplyr::filter( | |
| !is.na(.data$TADA.LongitudeMeasure), | |
| !is.na(.data$TADA.LatitudeMeasure) | |
| ) |
R/GeospatialFunctions.R
Outdated
| get.attains <- tryCatch(sf::st_make_valid(get.attains), error = function(e) { | ||
| message("st_make_valid (get.attains) failed: ", conditionMessage(e)) | ||
| get.attains | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[air] reported by reviewdog 🐶
| get.attains <- tryCatch(sf::st_make_valid(get.attains), error = function(e) { | |
| message("st_make_valid (get.attains) failed: ", conditionMessage(e)) | |
| get.attains | |
| }) | |
| get.attains <- tryCatch( | |
| sf::st_make_valid(get.attains), | |
| error = function(e) { | |
| message("st_make_valid (get.attains) failed: ", conditionMessage(e)) | |
| get.attains | |
| } | |
| ) |
Pull Request Checklist
Preparation
Update your branch from the latest
developand resolve any merge conflictsBefore creating a pull request trigger the format-update GitHub Action on your branch to format the code
Documentation
Add/update inline and/or block comments to clarify complexity, context and intent
Add/update function documentation (roxygen), include working examples, build docs locally using devtools::document(), and inspect added/updated help pages for content and format
Add/update vignettes for corresponding changes in functionality, list these under articles in _pkgdown.yml, and ensure added/updated vignettes run and build with proper formatting locally
Maintenance & Data Refresh
Add new dependencies to
DESCRIPTIONand document appropriatelyRun spelling maintenance in
requiredMaintenance.RIf changes affect other package or the shiny app functions, update those impacted functions accordingly
If columns were added/updated, add/update them in
RequiredCols.RRun
.TADA_UpdateRefFiles()and.TADA_UpdateExampleData()locally viaMaintenanceScheduled.Ror trigger the Component File Update GitHub ActionIf new example data files were added, document them in
ExampleData.Rand include them inMaintenanceScheduled.Rfor regular refreshTests and checks
Add/update tests in
tests/testthatto cover changesRun
devtools::test()to verify new and existing tests passRun
devtools::check()and address any errors, warnings or notesPull Request Description
Includes a summary of the changes made
Includes relevant context/motivation
Includes links to related issues or pull requests (keywords like "Closes #issue_number" automatically close related issues when pull request is merged)
Review
Review the bot-commented coverage-report generated by test-coverage to confirm all changes are covered by tests
Review/accept any bot-suggested format changes
Request review from at least one developer team member