Repository navigation
Phase 2: Dataset detail page + on* provenance + version switcher - #8
Merged
neuromechanist merged 3 commits intoMay 15, 2026
Conversation
…-tree + markdown Lib layer for the upcoming dataset detail page. - neuroschema.ts: types for NeuroschemaDataset, LandingPayload, Manifest (mirrors the live data.nemar.org responses verified this session) - data-api.ts: typed getLanding/getMetadata/getManifest + fetchManifestEntryText with timeouts. Honors PUBLIC_DATA_BASE_URL override; 404 -> null, network errors throw so callers can render the right empty state - provenance.ts: detect on*/ds* parity. nm* is native; on* is derived with best-effort original ds id resolution (related_identifiers DERIVED relations, URL host pattern, DOI pattern, last-ditch on->ds prefix swap). The mirror version is the highest vN.0.0 per the NEMAR policy that every OpenNeuro pull is a major version bump (see nemarOrg/nemar-cli#448 comment thread). listMirrorVersions returns every vN.0.0 newest-first. - bids-tree.ts: fold manifest into nested TreeNode with size aggregates, numeric+locale-aware sort (sub-2 before sub-10). classifyFile gates the per-file Vis/View buttons by extension. - markdown.ts: dep-free CommonMark subset (headings, paragraphs, lists, code fences + inline code, bold/italic, links + autolinks, hr). HTML-escapes everything and rejects javascript:/data: URLs. Scope deliberately small; follow-ups can add tables/blockquotes when a real README needs them. 69/69 unit tests passing.
…, README Components: - DetailHeader-equivalent inline in [id].astro (ID + lineage label + title + lede + modality chips + action row + DOI badge) - ActionBar: Download zip, Compute (stub modal pointing at Phase 5 + NSG), Issues, GitHub, OpenNeuro for on* datasets - ProvenanceCard (on* only): title 'NEMAR-curated copy of OpenNeuro ds00xxxx', 2-cell DOI parity grid (NEMAR / OpenNeuro), View-original + View-mirror CTAs, All mirror snapshots <details> when vN.0.0 count > 1. The mirror version pointer points to highest vN.0.0 per the policy in nemar-cli#448 comment. - VersionSwitcher: segmented tab strip + overflow dropdown when > 4 versions, 'mirror' chip on vN.0.0 entries, hidden when only one version exists - AuthorList: name + ORCID icon link + first affiliation (with +N more), expandable - DoiBadge: copy-on-click with success state, label + value + small icon - Chip: reusable label chip (neutral/accent/warning tones) - BidsTree + BidsDirChildren: recursive collapsible tree from manifest paths, auto-opens shallow trees, EEG/.set + .tsv files tagged 'Vis · soon' / 'View · soon' pointing at Phase 5 visualizer work - DetailRail: right-rail metadata (license, BIDS version, modalities/tasks/datatypes, sessions, publish date with relative time, authors, funding, keywords, related identifiers DOIs + URLs) - Readme: server-side markdown rendering with empty-state for datasets without one Route: - pages/dataset/[id].astro SSR: parallel fetch of landing + metadata, then manifest for selected version (?v=... param falls back to latest). Defensive 404 when dataset is not public or doesn't exist. README pulled from manifest entry's presigned URL with 2.5s timeout. Cache-Control: max-age=60 to keep within presigned-URL TTL. Verified live: - /dataset/nm000104 (native, multi-thousand-file manifest) - /dataset/on005262 (derived, exercises ProvenanceCard with DOI parity grid) - /dataset/nm000103 (manifest 404 -> graceful 'Manifest unavailable' panel + rail still populated from metadata.json) - /dataset/does-not-exist (404) - 69/69 unit tests passing, 0 typecheck errors across 46 files
…auto-open README: - Wrapped in a 32rem max-block-size container with a bottom fade gradient - 'Expand README' / 'Collapse README' button overlays the fade; jumps to full-height on click - Auto-hides the toggle entirely when the README fits within the cap (short READMEs render unchanged) - aria-expanded + aria-controls wired for keyboard / screen-reader users BIDS tree: - MAX_AUTO_OPEN_DEPTH 2 -> 1 + AUTO_OPEN_CHILD_CAP 12 -> 6 so large datasets (nm000104 with 100+ subjects, on005262 with 12+ subjects) render with only top-level subjects open. Users expand the ones they want. Verified live against nm000104 (large tree) and on005262 (derived dataset).
This was referenced May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 of #1. Lands
/dataset/<id>consuming the now-livedata.nemar.org/<id>/{metadata.json, manifest.json}(issue nemarOrg/nemar-cli#449) plus a dedicated provenance surface foron*OpenNeuro-derived datasets.Closes #3.
What landed
Library layer (
src/lib/)neuroschema.ts— types forNeuroschemaDataset,LandingPayload,Manifest, mirroring the live data.nemar.org responsesdata-api.ts— typedgetLanding/getMetadata/getManifest+fetchManifestEntryTextwith abortable timeouts; 404 ->null, network errors throwprovenance.ts—nm*is native,on*is derived. Best-effort resolution of the original OpenNeuro ID viarelated_identifiersDERIVED relations, URL/DOI patterns, with a last-ditchon->dsprefix swap.listMirrorVersions()returns everyvN.0.0newest-first per the policy in nemar-cli#448 comment.bids-tree.ts— folds manifest into a nested tree with size aggregates, numeric+locale-aware sort (sub-2beforesub-10), file classifier for Vis/View buttonsmarkdown.ts— dep-free CommonMark subset (headings, paragraphs, lists, code fences + inline code, bold/italic, links + autolinks, hr); HTML-escapes everything; rejectsjavascript:/data:URLsComponents
Chip,DoiBadge(copy-on-click),ActionBar(Download / Compute stub / Issues / GitHub / OpenNeuro),ProvenanceCard,VersionSwitcher(segmented tabs + overflow),AuthorList(with ORCID icons + affiliations),BidsTree+BidsDirChildren(recursive collapsible),Readme(markdown rendering),DetailRail(sticky right rail).Route
src/pages/dataset/[id].astro— SSR, parallel landing + metadata fetch, version via?v=param, README fetched from manifest entry's presigned URL, graceful 404 + manifest-unavailable states.Two new design surfaces
Provenance card for
on*datasets<details>when multiplevN.0.0existFirst-class version switcher
mirrorchip onvN.0.0<details>dropdown when > 4 versions/dataset/<id>?v=v1.0.0deep-links to a specific versionVerified live
/dataset/nm000104/dataset/on005262NEMAR-curated copy of OpenNeuro ds005262, BIDS tree expanded/dataset/nm000103/dataset/does-not-existTests + checks
bun run typecheck— 0 errors across 46 filesbun run test— 69/69 (Phase-1 37 still pass + 32 new acrossdata-api,provenance,bids-tree,markdown)screenshots/peer/(will be moved to per-PR archive on merge)Test plan
/discoverto a dataset card; detail page loads/dataset/on005262; click "View as-imported mirror" — URL gains?v=v1.0.0, version switcher highlights itOut of scope
.setfiles (Phase 5 — Vis button currently shows "soon" tag).tsvfiles (Phase 5 — View button currently shows "soon" tag)archives/<v>.ziproute on data.nemar.org — currently the Download zip link 404s. Either nemar-cli ships the archive route, or we point Download zip athttps://data.nemar.org/<id>/<v>/manifest.jsonand let users fetch with rcloneFollow-ups
participantsandfile_sizeinapi.nemar.org/datasetsfor OpenNeuro-derived rows so Discover cards aren't sparseIsDerivedFromrelated_identifiers to allon*datasets so provenance auto-resolution doesn't have to rely on theon->dsprefix swap fallback