Skip to content

feat(site): surface a datasets count metric#30

Merged
benjibromberg merged 2 commits into
mainfrom
worktree-feat+datasets-metric
Jun 2, 2026
Merged

feat(site): surface a datasets count metric#30
benjibromberg merged 2 commits into
mainfrom
worktree-feat+datasets-metric

Conversation

@benjibromberg

Copy link
Copy Markdown
Member

Summary

Adds a top-line `datasets` count (129) — the number of individual catalogued datasets, not just the 14 dataset pages — and surfaces it across the homepage hero, the "Datasets by species" card, and the "By the Numbers" dashboard, replacing the old "Species / Dataset pages" headline. The species-page count (14) is retained in a detail position on the dashboard.

How the count works

"Datasets" is not one uniform shape in the corpus, so each `Datasets/` page contributes its natural, deterministic unit (no canonical Markdown was changed — the parser accommodates the existing shapes):

Source Pages Unit Count
`## Complete data inventory` tables 10 species + CrossSpecies table rows 108
Reference pages HumanReference, CHOReference `###` entries 7
Benchmarks Benchmarks.md `##` entries 14
Total 129

A new `datasets.ts` parser module (`computeDatasetBreakdown`) is the single source of truth: `counts.ts` reads its total for `counts.json`, `metrics.ts` reads its breakdown for the dashboard, and `generate-data.ts` asserts the parts sum to the total and match `counts.json` — extending the project's existing "a stat can't drift from the page it links to" invariant. `metrics.speciesInventory` now delegates to the shared `inventoryRowCount` helper.

Changes

  • Parser: new `datasets.ts` (+ tests + fixtures for all three page shapes); `datasets` field added to `CountsSchema` and a `datasets` breakdown to `MetricsSchema`; `counts.ts` / `metrics.ts` / `generate-data.ts` wired with no-drift assertions.
  • Site: `Hero.astro`, `SectionsGrid.astro`, `MetricsDashboard.astro` show the 129 total instead of the 14 page count; dashboard caption shows the breakdown by source-page shape.

Verification

  • `pnpm test` — 289 passing (incl. new `datasets.test.ts`; ground-truth total pinned at 129)
  • `pnpm parse` — `counts.datasets: 129`; breakdown 108 + 7 + 14; cross-validation asserts green
  • `pnpm build` — full build passes
  • Browser-verified: hero, card, and dashboard all render `129 Datasets`

🤖 Generated with Claude Code

Add datasets.ts: computeDatasetBreakdown sums each page's natural unit —
inventory-table rows (species + CrossSpecies), H3 entries (reference pages),
and H2 entries (Benchmarks) — to a single 'datasets' total (129).

Expose it as counts.datasets and a metrics.datasets breakdown; generate-data
asserts the parts sum to the total and match counts.json. metrics.speciesInventory
now delegates to the shared inventoryRowCount helper.
Hero stat, the 'Datasets by species' card, and the By the Numbers top stat now
show the 129-dataset total instead of the 14 species-page count. The species
page count moves to a detail position — the dashboard's per-species breakdown
section, with a new caption showing the dataset breakdown by source-page shape.
@benjibromberg benjibromberg merged commit c645321 into main Jun 2, 2026
1 check passed
@benjibromberg benjibromberg deleted the worktree-feat+datasets-metric branch June 2, 2026 10:21
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.

1 participant