Skip to content

Use compact summary.json instead of full manifest.json for dataset detail page #29

Closed

Description

@neuromechanist

Symptom

Dataset detail pages for large BIDS-EEG datasets load slowly or time out on first visit. Examples:

Dataset manifest.json served by data.nemar.org Time to download (typical)
on005261 10.5 MB 8–15 s
nm000103 7.9 MB 6–12 s
nm000166 4.9 MB 4–8 s
on004362 5.2 MB 4–8 s

Users report: "First load slow / times out, switching browser made it almost-instant" — that's the CF edge cache making the 10 MB blob warm. First-load is the actual experience for every new visitor.

Root cause

data.nemar.org/<id>/<version>/manifest.json (backend/src/routes/data.ts:200-251) takes the stored manifest (~4-5 MB for these datasets) and adds a freshly-minted presigned S3 URL to every single file entry on every request. The URL is ~400-800 bytes; multiplied by 14,536 files in on005261 → ~10 MB of signature data per response.

The website's two API endpoints (/api/dataset/<id>/readme and /tree) both fetch this full manifest just to extract:

  • readme: the URL of one entry whose path matches ^readme(\.md|\.txt)?$
  • tree: the path strings (the per-entry presigned URLs are unused)

We're serving 10 MB of presigned URLs to use 50 KB of path data.

Proposal: compact summary.json artifact

Generate a path-only summary at manifest creation time, stored alongside the manifest:

s3://nemar/<id>/version/v<X.Y.Z>-summary.json   ~ 50–200 KB even for 15k-file datasets
{
  "schema_version": "1.0",
  "dataset_id": "on005261",
  "version": "1.0.0",
  "doi": "10.82901/nemar.on005261.v1.0.0",
  "totals": { "files": 14536, "bytes": 241618664825, "subjects": 17 },
  "modalities": ["meg", "beh"],
  "subjects": ["sub-01", "sub-02", ...],
  "readme": { "path": "README.md" } | null,
  "paths": ["README.md", "dataset_description.json", "sub-01/...", ...]
}

Critically:

  • No presigned URLs — the summary is path-only. URLs are minted on demand by data.nemar.org file-download routes that already exist.
  • No checksum/size per-file — totals only, sufficient for the page's needs.

Served at data.nemar.org/<id>/<version>/summary.json. Cache-friendly (no per-request work).

Website-side change (this issue)

  1. New getSummary(id, version) helper in src/lib/data-api.ts.
  2. /api/dataset/<id>/readme endpoint:
    • Fetch summary.json first.
    • If summary.readme is set, fetch the README content from raw.githubusercontent.com (already an existing fallback) or from a new data.nemar.org/<id>/<version>/README.md endpoint that signs on demand.
    • Stop loading the full manifest just to find one entry.
  3. /api/dataset/<id>/tree endpoint:
    • Build the tree from summary.paths (path strings only).
    • Drop the manifest fetch entirely.
  4. Fallback: if summary.json 404s (older datasets without backfill), fall back to the current manifest-based path. This keeps the change deployable independent of the backfill.

Companion work on nemar-cli

Generating summary.json is a nemar-cli/data-layer concern. Tracked in a separate issue there. Until that lands, this change is a no-op (fallback path runs). Once summary.json is published for new datasets, the page is fast. Once backfilled for the 5 recently-recovered datasets (on005261, nm000103, nm000106, nm000166, on004362), they're fast too.

Acceptance

  • /api/dataset/on005261/tree?v=v1.0.0 returns in < 500 ms instead of timing out
  • /api/dataset/on005261/readme?v=v1.0.0 returns in < 500 ms even on a cold cache
  • First-load of /dataset/on005261 feels instant (modulo network RTT) regardless of browser cache state
  • Pre-existing datasets without a backfilled summary still render correctly via the fallback path

Notes

  • Related: companion issue on this repo (filed alongside) for the "no published version" 500-then-429 case, which is independent of the summary artifact.
  • The summary should be regenerable: backfilling old datasets is just running the manifest-recovery script (/tmp/manifest_recover.py used today) with a --also-summary flag. No new infrastructure needed.

Activity

  1. added
    enhancement
    on May 19, 2026
  2. added a commit that references this issue on May 19, 2026
    726bc7b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions