Skip to content

Drop QA from SSR; tabs: Demographics (live) + Data quality (coming soon) #81

Closed

Description

@neuromechanist

Problem

Cold SSR on a dataset with a qa/ tree takes 5-28 seconds. Confirmed: `buildQaAggregates` walks `data.nemar.org//qa/` recursively and fetches every per-file `_dataqual.json` at request time. For a 200-300 subject HBN dataset that's hundreds-to-thousands of subrequests on the SSR critical path; on005509 even hits the Worker subrequest budget and falls to 503. Datasets without a `qa/` tree return null after one 404 (~85ms) and load instantly — the asymmetry the user observed.

`Cache-Control: s-maxage=300` already absorbs repeat hits (warm: ~100ms), but the cold path is the user-visible problem.

Approach

  1. Remove `getQaAggregates` from the SSR `Promise.all` in `src/pages/dataset/[id].astro`. Page paints from 2 backend fetches (landing + metadata). Cold SSR drops from 28s to ~500ms regardless of QA tree size.
  2. Replace `` in the page body with a `` component carrying two tabs:
    • Demographics (default, eager hydration after first paint). Client-side fetch of `data.nemar.org///participants.tsv`, parse, render `` (already exists — does stacked-by-sex age histogram) plus a small M/F pie/donut.
    • Data quality "Coming soon" placeholder. Will wire to a pre-computed `qa/aggregates.json` artifact once `QA artifacts sync from hallu + data.nemar.org/<id>/qa/* route nemar-cli#511` lands.
  3. Keep `buildQaAggregates` / `QualityPanel` / `AgeGenderChart` in the tree. Unused on the rendered page but ready to revive when Epic: Website compute surfaces (#493) #511 ships.

Acceptance

  • Cold SSR for on005509 and on005514 under 1.5s (cold) and under 200ms (warm).
  • No `api.nemar.org/datasets` or `data.nemar.org//qa/` fetches on the dataset detail page's SSR critical path.
  • Demographics tab shows a small M/F pie + age histogram stacked by sex for any dataset whose participants.tsv has `sex` and `age` columns.
  • Datasets without a participants.tsv (or without those columns) get a tasteful empty state in the Demographics tab.
  • Data quality tab shows a clear "coming soon" message referencing nemar-cli#511.
  • Tabs are keyboard-navigable (left/right arrow, home/end), follow the WAI-ARIA tabs pattern.
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions