Skip to content

Commit b95cbad

Browse files
rdhyeeclaude
andcommitted
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>
1 parent 53fd201 commit b95cbad

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

tutorials/isamples_explorer.qmd

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ facet_summaries_url = "https://data.isamples.org/isamples_202601_facet_summaries
3434
// Pre-computed cross-filter cache (6KB - instant single-filter lookups)
3535
cross_filter_url = "https://data.isamples.org/isamples_202601_facet_cross_filter.parquet"
3636
37-
// Slim facets file for on-the-fly multi-filter queries (0.3MB - URI strings, not BIGINT FKs)
37+
// Facets file for on-the-fly multi-filter queries (63MB - URI strings, not BIGINT FKs)
3838
sample_facets_url = "https://data.isamples.org/isamples_202601_sample_facets_v2.parquet"
3939
4040
// Source color scheme (consistent with iSamples conventions)
@@ -485,7 +485,7 @@ crossFilteredFacets = {
485485
const conditions = ["filter_source IS NULL", "filter_material IS NULL",
486486
"filter_context IS NULL", "filter_object_type IS NULL"];
487487
if (activeSources.length === 1)
488-
conditions[0] = `filter_source = '${activeSources[0]}'`;
488+
conditions[0] = `filter_source = '${activeSources[0].replace(/'/g, "''")}'`;
489489
else if (activeMaterials.length === 1)
490490
conditions[1] = `filter_material = '${activeMaterials[0].replace(/'/g, "''")}'`;
491491
else if (activeContexts.length === 1)
@@ -547,24 +547,6 @@ crossFilteredFacets = {
547547
}
548548
```
549549

550-
```{ojs}
551-
//| code-fold: true
552-
// Merge cross-filtered counts with baseline facets
553-
// Baseline provides the full list of values; cross-filter overrides counts
554-
function getDisplayCounts(facetKey) {
555-
const baseline = facetsByType[facetKey] || [];
556-
if (!crossFilteredFacets || !crossFilteredFacets[facetKey]) return baseline;
557-
558-
const filtered = crossFilteredFacets[facetKey];
559-
const countMap = new Map(filtered.map(r => [r.value, r.count]));
560-
561-
return baseline.map(item => ({
562-
...item,
563-
count: countMap.has(item.value) ? countMap.get(item.value) : 0,
564-
}));
565-
}
566-
```
567-
568550
```{ojs}
569551
//| code-fold: true
570552
// Update facet count labels in-place when cross-filtered counts change

0 commit comments

Comments
 (0)