Problem
Every new manipulation function (frs_break(), frs_classify(), frs_aggregate()) needs to resolve an AOI parameter into a SQL predicate. This logic is shared infrastructure.
Proposed Solution
Internal helper .frs_resolve_aoi() that normalizes any AOI input to a SQL predicate:
| Input |
Resolution |
Character vector ("BULK", c("BULK", "MORR")) |
WHERE {partition_col} IN (...) |
| sf polygon |
ST_Intersects(geom, ...) |
list(blk = ..., measure = ...) |
Delineate watershed via fwa_watershedatmeasure(), then spatial predicate |
NULL |
No spatial filter |
Network-agnostic design
The partition column is configurable via options(fresh.partition_col = "watershed_group_code"). Default is FWA's WSG code. A spyda-built network sets options(fresh.partition_col = "basin_id") or whatever its partition scheme uses. No FWA concepts baked into the resolver logic.
This aligns with the broader options() pattern for network flexibility:
options(
fresh.partition_col = "watershed_group_code", # FWA default
fresh.stream_table = "whse_basemapping.fwa_stream_networks_sp",
fresh.blk_col = "blue_line_key",
fresh.measure_col = "downstream_route_measure"
)
Dependencies
Build this before frs_break(), frs_classify(), frs_aggregate() — they all consume it.
Problem
Every new manipulation function (
frs_break(),frs_classify(),frs_aggregate()) needs to resolve an AOI parameter into a SQL predicate. This logic is shared infrastructure.Proposed Solution
Internal helper
.frs_resolve_aoi()that normalizes any AOI input to a SQL predicate:"BULK",c("BULK", "MORR"))WHERE {partition_col} IN (...)ST_Intersects(geom, ...)list(blk = ..., measure = ...)fwa_watershedatmeasure(), then spatial predicateNULLNetwork-agnostic design
The partition column is configurable via
options(fresh.partition_col = "watershed_group_code"). Default is FWA's WSG code. A spyda-built network setsoptions(fresh.partition_col = "basin_id")or whatever its partition scheme uses. No FWA concepts baked into the resolver logic.This aligns with the broader
options()pattern for network flexibility:Dependencies
Build this before
frs_break(),frs_classify(),frs_aggregate()— they all consume it.