#290: live viewport/cross-filtered counts for the Material facet tree#292
Merged
Merged
Conversation
… facet tree The Material tree shipped with STATIC global baseline counts; this makes them live when the user zooms in. Map/table filtering was already live — this is the legend. - describeCrossFilters: Material participates via materialSelection() (minimal nodes) ONLY when zoomed (!isGlobalView); at/near global it stays baseline. - buildCrossFilterWhere: Material cross-filters OTHER dims via a membership pid-subquery (concept_uri IN selected) — a selected parent matches its subtree. - updateCrossFilteredCounts: cube disabled in tree mode (no tree nodes in the cube); Material own-counts at global → baseline (instant); zoomed → membership query COUNT(DISTINCT pid) per concept_uri, scoped by bbox (lite JOIN) + other dims (facets_v3 pid-subquery) + search. GLOBAL GATE (perf): the membership COUNT(DISTINCT) is a near-full scan at global/ large views and starved the single DuckDB-WASM connection (samples-table query timed out). At true-global the baseline IS the correct global count, so we use it (instant); live counts engage when zoomed, where the bbox prunes the scan. Verified (202608): earthmaterial 4,091,133 global → 25,988 at Cyprus; legend(node) == table(node filter) = 26,310 (coherence isamplesorg#245); parent>=child in-viewport; source⇄ material cross-filter both directions. 8 facet-tree specs + smoke green; render clean. Codex: no blocking findings (verified cross-filter via direct DuckDB queries). Accepted residual (documented): at global view WITH another filter/search, Material counts show baseline (instant, slightly stale) — a precomputed facet_tree_cross_filter cube is the follow-up if live global cross-filtered material counts are wanted. Co-Authored-By: Claude Opus 4.8 (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.
#290 — live viewport / cross-filtered counts for the Material facet tree
Follow-up to the shipped Material hierarchy (#281/#282). The tree shipped with static global baseline counts; this makes the legend numbers live when you zoom in. (Map/table filtering was already live + correct — this is just the counts.)
What
COUNT(DISTINCT pid)fromsample_facet_membership, scoped to the viewport (bbox vialiteJOIN) + the other active facets (afacets_v3pid-subquery) + search. Parent ≥ child holds; legend == table for a node selection (explorer: facet counts use padded viewport, matching the table (#234) #245 coherence).facets_v3's flat value).Global-view gate (perf — important)
The membership
COUNT(DISTINCT pid)is a near-full scan at global/large views and starved the single DuckDB-WASM connection (the samples-table query timed out). At true-global the baseline IS the correct global count, so we use it (instant). Live counts engage when zoomed, where the bbox prunes the scan (verified fast). Net: the global view is unchanged/instant; zoomed views get live counts.Verified (202608)
Accepted residual (documented)
At global view with another active filter/search, Material counts show the global baseline (instant, slightly stale — not cross-filtered). A precomputed
facet_tree_cross_filtercube is the follow-up if live global cross-filtered Material counts are wanted. (Closes the first half of #290; the cube is the optional remainder.)🤖 Generated with Claude Code