Derive species presence cols from CSV header#107
Merged
NewGraphEnvironment merged 1 commit intomainfrom May 3, 2026
Merged
Conversation
`R/lnk_pipeline_species.R` and `R/lnk_pipeline_break.R` hardcoded the species-presence column list to 11 codes (bt, ch, cm, co, ct, dv, pk, rb, sk, st, wct). Adding a new species to dimensions.csv + parameters_fresh.csv was silently dropped at the column-list step because the new column was never read. - Extract `.lnk_wsg_species_present(row)` to R/utils.R. Treats every column except `watershed_group_code` and `notes` as a presence flag. Both call sites use the helper. - Add ko (Kokanee) column to wsg_species_presence.csv in both bundles with `t` for PARS, KOTL, NATR, CARP. Sentinel values for testing end-to-end KO flow — actual presence-by-WSG belongs upstream in bcfp's wsg_species_presence.csv (filed at NewGraphEnvironment/bcfishpass#12). Auto-sync workflow will replace these with the authoritative source once that lands. - Add GR + KO species rows to default/parameters_fresh.csv (already present in default/dimensions.csv and rules.yaml). - New tests: lnk_pipeline_species picks up newly-added GR + KO columns when populated, and ignores the `notes` column. Relates to NewGraphEnvironment/sred-2025-2026#24 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
spp_cols <- c("bt", "ch", ...)vector inR/lnk_pipeline_species.RandR/lnk_pipeline_break.R. Both call sites now share.lnk_wsg_species_present(row)(inR/utils.R) which derives the presence-column list from the CSV header.wsg_species_presence.csvpropagates to every callsite without a code edit.kocolumn to both bundles'wsg_species_presence.csvwith sentineltfor PARS, KOTL, NATR, CARP — interim until upstreambcfishpass.wsg_species_presenceships the authoritative coverage (Add ko (Kokanee) column to wsg_species_presence.csv bcfishpass#12).default/parameters_fresh.csv(already present indefault/dimensions.csvandrules.yaml).Why
R/lnk_pipeline_species.R:63-64andR/lnk_pipeline_break.R:167-168were a footgun: the CSV could carry agrcolumn populatedtfor many WSGs, butlnk_pipeline_species()would silently drop GR for every AOI because the hardcoded vector didn't include it. Surfaced when adding GR + KO to enable Kokanee / Arctic Grayling habitat classification on the default bundle.Test plan
devtools::test(filter = "lnk_pipeline_species|lnk_pipeline_break")— 44 PASS / 0 FAIL, including 2 new tests for GR/KO column propagation +notes-column ignoringstream_orderassertions from Wire frs_order_child as link methodology (default off) #97 schema rename) and are unrelated to this PRkosentinel-WSGs are reasonable for interim testing — actual coverage will come from Add ko (Kokanee) column to wsg_species_presence.csv bcfishpass#12Out of scope
Relates to NewGraphEnvironment/sred-2025-2026#24
🤖 Generated with Claude Code