Skip to content

Report lake connection lines apart from rearing km (#317) - #318

Merged
NewGraphEnvironment merged 6 commits into
mainfrom
317-lake-km-should-1450-connection-lines-cou
Oct 8, 2026
Merged

NewGraphEnvironment merged 6 commits into
mainfrom
317-lake-km-should-1450-connection-lines-cou

Conversation

@NewGraphEnvironment

@NewGraphEnvironment NewGraphEnvironment commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Lake connection lines are reported apart from rearing km. The compare rollups (lnk_compare_rollup() / lnk_compare_wsg()) report FWA lake connectors (edge 1450, "Construction line, connection", in a lake or reservoir polygon) as a new rearing_lake_connection km slice and leave them out of rearing and rearing_lake km. fresh's rearing flag still carries them, so cluster_rearing still joins inlet rearing to the lake. Rules are unchanged and nothing re-classifies.
  • One NULL-safe predicate, both sides. .lnk_sql_lake_connection() is exposed as a connection alias in lnk_rollup_wsg() and applied to the link side and the bcfishpass reference alike, because bcfishpass counts these lines in BT and SK rearing too. lnk_rollup_wsg()'s default rearing_km stays the flag total, since the validator's cost and the parity scripts compare the flag itself.
  • Measured on Default lake and wetland rearing: connected to spawning, centrelines kept, km and ha broken out #310's ADMS / NATR snapshots (data-raw/logs/lake_connection_317/). ADMS against bcfishpass: CH +91.1 % → +38.9 %, CO +75.0 % → +28.7 %, BT +16.4 % → +2.0 %. SK rearing km fall 55–95 % on both sides, so SK parity stays 0.0 % on six bcfishpass-config WSGs. Write-up: research/habitat_thresholds.md, "Lake connection lines".

Related Issues

Test plan

  • devtools::test(): 2585 pass / 0 fail / 16 warnings (baseline)
  • New tests pin the predicate, the connection alias, and the flag-total default. They also pin the compare metrics and the link-side and bcfishpass-side SQL, plus the 9-row long format.
  • Live: the link-side rollup matches a flag-level measure within 0.008 km (rollup_check.csv); bcfishpass-config parity on 9 taxonomy-pinned WSGs (parity_bcfishpass.csv)
  • lintr: no new lints in R/ (lnk_compare_wsg.R carries 18 pre-existing, same as main)
  • /code-check: four rounds. Round 1 found the primitive-default leak, fixed by keeping the flag default; round 2 clean; round 3 found two doc errors, fixed; round 4 clean.

Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx

NewGraphEnvironment and others added 5 commits October 8, 2026 08:03
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
Phase 1: on #310's run-B snapshots, no re-classify. Connection lines
(1400/1450 in lake polygons) are 160-276 km per species; ADMS CH vs
bcfishpass +91.1% -> +38.9%. bcfishpass counts them too, so the rule
applies to both sides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
FWA connection lines (1400/1450 in a lake polygon) stay in fresh's
`rearing` flag, where cluster_rearing needs them, but the compare
rollups now report them as `rearing_lake_connection` km and leave them
out of `rearing` and `rearing_lake` km, on the link side and the
bcfishpass side alike (bcfishpass counts them in BT and SK rearing).

One predicate, .lnk_sql_lake_connection() (NULL-safe), exposed as a
`connection` alias in lnk_rollup_wsg(). Its default rearing_km stays
the flag total: the validator's cost and the parity scripts compare the
flag (code-check round 1). compare_rollups.R stops on a pre/post-#317
mix. Live: rollup matches the flag measure within 0.008 km; SK parity
0.0 % on six bcfishpass-config WSGs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
RUNBOOK §7, research/habitat_thresholds.md ("Lake connection lines"),
the default bundle README and dictionary, a note on
bcfishpass_methodology.md's 1400/1450 claim, and the CLAUDE.md status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
FWA 1400 is "Construction line, other flow / inferred connection", a
construction flow line, not a connector (operator: "construction and
connector are totally different"). .lnk_sql_lake_connection() now
matches lake-polygon lines on 1450 only, so 1400 stays in rearing km.
Lake 1400 is at most 1.4 km of rearing: only NATR BT (3,709.5 ->
3,710.4 km, +24.3 % -> +24.4 % vs bcfishpass) and RB move. Logs re-run;
docs swept. Two code-check rounds, ended by enumerating every
claim-bearing sentence against the DB and git (one review figure was a
bare-id_segment fan-out and was corrected before landing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJE2szSCkeV9R3qKhuSwyx
@NewGraphEnvironment
NewGraphEnvironment merged commit 856a5a6 into main Oct 8, 2026
1 check passed
@NewGraphEnvironment
NewGraphEnvironment deleted the 317-lake-km-should-1450-connection-lines-cou branch October 8, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lake km: should 1450 connection lines count as lake rearing?

1 participant