Repository navigation
Phase 2: server-rendered Use-this-data section and .md mirror - #291
neuromechanist merged 10 commits into
Conversation
Deploying nemar-website with
|
| Latest commit: |
2c4eea2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3eaadc87.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-issue-286-phase2-use.nemar-website.pages.dev |
|
Review addressed. All findings acted on; one nice-to-have declined with a reason. Critical, the page and the .md mirror disagreed for an unpublished dataset. Fixed in 6e9d2a4. This one was my fault as epic lead: the brief told the implementer both "do not render it in the unpublished branch" and "an unpublished dataset yields a reduced card", which are contradictory, and the implementation followed both literally. The result was the worst direction of parity failure, with the agent-facing mirror carrying an overview and a citation the human page never showed, while the page's head advertised rel=alternate to it. The component now renders unconditionally alongside the "Not yet published" banner, and Important, two independently-computed values asserted equal only by a comment. Fixed in 7ada710. Suggestion, commands and URLs buried in prose. Fixed in 2c4eea2. Nice-to-have, a thousands separator on the participant count. Declined deliberately. This section's primary consumer is a machine and a separator is a character an agent has to strip; the human-facing DetailRail already formats counts. Raw integers stay. Evidence. There is exactly one unpublished public dataset in the catalog, Gates after the fixes: lint clean, typecheck 0 errors, 1529 tests green across 63 files (use-this-data.test.ts went 21 to 28), and |
465b176
into
feature/issue-284-epic-agent-readiness
…lms.txt (#294) * Phase 1: AI crawler tokens in robots.txt and a real-lastmod sitemap (#290) * Allow AI crawlers in robots.txt * Add real-lastmod sitemap.xml route * Add tests and fixture for robots/sitemap * Move escapeXml to a neutral xml module * Assert the crawler block stays contiguous * Reuse isManagedDatasetId in the sitemap filter * Skip the sitemap on noindex hosts * Phase 2: server-rendered Use-this-data section and .md mirror (#291) * lib: export license helpers from jsonld * types: add zarr status fields to Dataset * lib: add use-this-data model and tests * add UseThisData section component * layout: add generic headLinks to Base * dataset: render Use this data section * dataset: add markdown mirror endpoint * fix: render Use this data outside unpublished ternary * fix: make page unpublished flag authoritative * fix: mark up commands and URLs, not sentences * Phase 6: nemar.org llms.txt and a footer link (#293) * Add /llms.txt endpoint with tests * Link llms.txt from the footer * Fix llms.txt license claim, was off by 10x * Give llms.txt search link a working q example * Require v prefix on llms.txt version placeholder * Un-link llms.txt dataset-page placeholder * Phase 3: Signposting Link headers and link elements (#292) * lib: add signposting link model and tests * dataset: emit Signposting Link header and tags * Rewrite Zarr recipe to be index-agnostic * Correct the download facts and add a cd step * Check value/note discipline in every section * Cite the published version, not the selected one * Number both references; soften sparse access * Escape interpolated text in the .md mirror * Validate ORCIDs and reject unsafe Link hrefs * Strip a trailing slash from the .md alternate * Split Applebot out and pin robots groups * Cache robots and llms.txt; noindex the mirror * Add route tests for the four new routes * Cite sources for the routing and ORCID notes
Adds the "Use this data" section to the dataset detail page (#284 phase 2) and its markdown mirror at
/dataset/<id>.md.One model, two renderers.
src/lib/use-this-data.tsbuilds a pure, markup-free model from the same SSR data[id].astroalready fetches (landing, metadata, catalog row) — no new fetches.src/components/UseThisData.astrorenders it as HTML;renderUseThisDataMarkdownrenders the identical model as markdown forsrc/pages/dataset/[id].md.ts. Divergence between the two surfaces is impossible by construction: neither renderer holds a fact the model doesn't already carry.The section covers what the dataset is (modalities, participants, size, BIDS version, tasks, HED version), license and terms (canonical license URL, restrictive-tier note, recommended citation,
Referencespapers only — neverIsReferencedBy, which cites the dataset rather than the other way around), where the bytes are (data.nemar.org/<id>/latest/and the pinned version, never ans3://prefix since anonymous ListBucket on that prefix is denied), how to download, how to assess fit without downloading, and a Zarr recipe gated on the catalog row (zarr_status === "ready"andzarr_store_count > 0) with a fallback tozarrIndexUrl(id)when the row carries nozarr_index_urlyet.An unpublished dataset (no selected version) gets a reduced card: the bytes-location, download, assess, and Zarr sections are all omitted; the license section (self-citation) still renders. Every field degrades to omission, never to
null/"undefined"/an empty heading, so a sparse row yields a shorter card, never a throw.Base.astrogained a genericheadLinksprop (an array of{rel, href, type?, title?}) so the dataset page can declare<link rel="alternate" type="text/markdown">without adding dataset-specific mapping logic to the layout — the same seam phase 3's Signposting links will reuse.Additive-only elsewhere:
ccLicenseUrlandconditionsOfAccessare now exported fromjsonld.ts(no behavior change) so the new module can reuse them rather than duplicate the license-mapping logic.zarr_status,zarr_store_count, andzarr_index_urlare added as optional/nullable fields on theDatasettype — these are fields the API already serves, so this is descriptive, not a contract change.No backend change was needed; nothing here alters an API response shape, the Zarr index contract, or the data.nemar.org layout.
No-JavaScript evidence
Route-collision precedence was verified empirically:
curl http://localhost:4321/dataset/nm000103.mdreturnscontent-type: text/markdown(served by[id].md.ts), whilecurl http://localhost:4321/dataset/nm000103(no extension) still returnscontent-type: text/html. Theds*-> canonical redirect also mirrors the page on this route:curl -sI http://localhost:4321/dataset/ds007753.mdreturns301to/dataset/on007753.md.Test plan
bun run lint— 0 errorsbun run typecheck— 0 errors, 0 warnings (241 files)bun run test— 1526/1526 passed (63 files), including 25 new tests insrc/lib/use-this-data.test.tscovering the model/markdown parity guarantee, Zarr gating, an unpublished dataset, References-vs-IsReferencedBy, a sparse null-heavy dataset, and that no output ever presents openneuro.org as canonicalNEMAR_SKIP_OG_GENERATE=1 bun run build— completes cleanlyCloses #286
Part of epic #284