EPATADA icon indicating copy to clipboard operation
EPATADA copied to clipboard

TADA_AnalysisDataFilter removes rows when clean = TRUE if TADA.UseForAnalysis.Flag == "No - NA"

Open cristinamullin opened this issue 7 months ago • 3 comments

Is your feature request related to a problem? Please describe:

TADA_AnalysisDataFilter removes results when clean = TRUE if TADA.UseForAnalysis.Flag == "No - NA". Is this the desired behavior? See example below.

Describe the solution you'd like:

I don't think results should be removed when clean = TRUE unless they meet criteria to be flagged as sediment or groundwater... suggest that NA's (row within not enough information to assign as GW or sediment automatically) should remain and be reviewed separately.

query.params <- list(
  where = "assessmentunitidentifier IN ('CT-C2_016-SB')",
  outFields = "*",
  f = "geojson"
)

url = "https://gispub.epa.gov/arcgis/rest/services/OW/ATTAINS_Assessment/MapServer/2/query?"

poly.response <- httr::GET(url, query = query.params)

poly.geojson <- httr::content(poly.response, as = "text", encoding = "UTF-8")

poly.sf <- sf::st_read(poly.geojson, quiet = TRUE)

WQP_raw_2 <- TADA_DataRetrieval(
  # startDate = "2019-01-01",
  # endDate = "2024-12-31",
  aoi_sf = poly.sf,
  applyautoclean = TRUE,
  ask = FALSE)

WQP_flag <- TADA_AnalysisDataFilter(
  WQP_raw_2,
  clean = FALSE,
  surface_water = TRUE,
  ground_water = FALSE,
  sediment = FALSE
)

# Review unique flags
unique(WQP_flag$TADA.UseForAnalysis.Flag)

# Review flagged rows
WQP_flag_review <- WQP_flag %>%
  dplyr::filter(TADA.UseForAnalysis.Flag == "No - NA") %>%
  dplyr::select(c("TADA.UseForAnalysis.Flag", "ActivityMediaName", "ActivityMediaSubdivisionName", "AquiferName", "LocalAqfrName", "ConstructionDateText", "WellDepthMeasure.MeasureValue", "WellDepthMeasure.MeasureUnitCode", "WellHoleDepthMeasure.MeasureValue", "WellHoleDepthMeasure.MeasureUnitCode"))

WQP_clean <- TADA_AnalysisDataFilter(
  WQP_raw_2,
  clean = TRUE,
  surface_water = TRUE,
  ground_water = FALSE,
  sediment = FALSE
)

Reminders for TADA contributors addressing this issue:

New features and/or edits should include all the following work:

  • [ ] Create or edit the function/code.

  • [ ] Document all code using line/inline and/or multi-line/block comments to describe what is does.

  • [ ] Create or edit tests in tests/testthat folder to help prevent and/or troubleshoot potential future issues.

  • [ ] Create or edit the function documentation. Include working examples.

  • [ ] Update or add the new functionality to the appropriate vignette (or create new one).

  • [ ] If function/code edits made as part of this issue impact other functions in the package or functionality in the shiny app, ensure those are updated as well.

  • [ ] Run TADA_UpdateAllRefs(), TADA_UpdateExampleData(), styler::style_pkg(), devtools::document(), and devtools::check() and address any new notes or issues before creating a pull request.

  • [ ] Run more robust check for releases: devtools::check(manual = TRUE, remote = TRUE, incoming = TRUE)

cristinamullin avatar May 23 '25 14:05 cristinamullin

Is this something that needs to be completed prior to Cybertown?

hillarymarler avatar May 23 '25 15:05 hillarymarler

No, I added a workaround (filtering using the flag column values instead of clean = TRUE) to the training Rmd for now.

From: hillarymarler @.> Sent: Friday, May 23, 2025 11:30 AM To: USEPA/EPATADA @.> Cc: Mullin, Cristina @.>; Author @.> Subject: Re: [USEPA/EPATADA] TADA_AnalysisDataFilter removes rows when clean = TRUE if TADA.UseForAnalysis.Flag == "No - NA" (Issue #596)

Caution: This email originated from outside EPA, please exercise additional caution when deciding whether to open attachments or click on provided links.

[https://avatars.githubusercontent.com/u/152432687?s=20&v=4]hillarymarler left a comment (USEPA/EPATADA#596)https://github.com/USEPA/EPATADA/issues/596#issuecomment-2904818779

Is this something that needs to be completed prior to Cybertown?

Reply to this email directly, view it on GitHubhttps://github.com/USEPA/EPATADA/issues/596#issuecomment-2904818779, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALGLGYAX7VZV3GRLEKDGHJ32745FVAVCNFSM6AAAAAB5Y7FHCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMBUHAYTQNZXHE. You are receiving this because you authored the thread.Message ID: @.@.>>

cristinamullin avatar May 23 '25 16:05 cristinamullin

Great! I will work on a fix after the workshop.

hillarymarler avatar May 23 '25 16:05 hillarymarler