Commit 1be3fba
Add cross-filtering to Explorer facet counts (#94)
* Add cross-filtering to Explorer facet counts
When any filter is active, facet counts now reflect the intersection
of all OTHER active filters. For example, selecting SESAR as source
updates material/context/specimen counts to show only what exists
in SESAR data. Uses parallel GROUP BY queries via DuckDB-WASM.
Counts update via DOM manipulation to avoid resetting checkbox
selections. Zero-count facet values are dimmed for visual clarity.
When no filters are active, pre-computed summaries are used (instant).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix cross-filtering: use pre-computed cache + correct column mapping
- Add 6KB pre-computed cross-filter cache for instant single-filter lookups
- Add 21MB sample_facets view with URI-string columns for on-the-fly fallback
- Fix column name mismatch: wide parquet has p__* BIGINT[] columns, but
facet values are URI strings — cross-filter now queries sample_facets
- Main whereClause uses pid subquery against sample_facets for facet filters
- Source filter still queries wide parquet directly (n column is correct)
Supplementary files on data.isamples.org:
- isamples_202601_facet_cross_filter.parquet (6 KB, 526 rows)
- isamples_202601_sample_facets_v2.parquet (21 MB, 6M rows)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix three cross-filter bugs
1. Multi-value within single facet: fast path now requires exactly
one value in the active facet, not just one active dimension.
Multiple selections (e.g., SESAR+GEOME) correctly fall through
to on-the-fly queries.
2. Text search participates in cross-filtering: buildCrossFilterWhere
now includes ILIKE conditions. sample_facets_v2 regenerated with
label, description, place_name columns (63 MB on R2).
3. Clearing filters restores baseline counts: the update cell now
resets all facet-count labels to baseline values and removes
zero-count dimming when crossFilteredFacets is null.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix count universe inconsistency and blank-value mismatch
Codex review found two bugs:
1. facet_summaries counted all 6.68M records but sample_facets only
had the 5.98M with coordinates — counts jumped when toggling filters.
Regenerated all three parquet files from the same base universe
(lat IS NOT NULL). SESAR now consistently 4,389,231 across all files.
2. Baseline summaries included blank-string facet values, but on-the-fly
queries excluded them with != ''. Regenerated summaries now exclude
blanks, matching the on-the-fly behavior.
Also: removed dead getDisplayCounts(), fixed stale 0.3MB comment,
added missing quote escaping on source cache lookup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add cross-filtering interaction tests
5 new tests in TestExplorerCrossFiltering:
- Baseline SESAR count matches summaries (>4M)
- Clicking source updates material counts (organicmaterial decreases)
- Clearing filter restores baseline counts
- Zero-count items get dimmed (opacity < 1)
- New parquet endpoints (cross_filter, sample_facets_v2) reachable
Cross-filter tests gracefully skip if data attributes not yet deployed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Clean up blank-string facet values in sample_facets
Convert blank strings to NULL with NULLIF in sample_facets_v2 generation
(586 blank context rows → NULL). Remove redundant != '' guards from
on-the-fly queries since IS NOT NULL now handles both.
Addresses Codex finding #2: blank values in sample_facets caused state
mismatch with baseline summaries (which correctly excluded blanks).
Finding #1 (count universe mismatch) was a false positive — Codex
cached stale files; live CDN has consistent counts across all three
artifacts (SESAR=4,389,231, total=5,980,282).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 3300b44 commit 1be3fba
2 files changed
Lines changed: 323 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
74 | 177 | | |
75 | 178 | | |
76 | 179 | | |
| |||
0 commit comments