Skip to content

Fix empty funder chips on dataset pages - #230

Merged
neuromechanist merged 2 commits into
stagingfrom
fix/issue-204-funder-field
Aug 3, 2026
Merged

Fix empty funder chips on dataset pages#230
neuromechanist merged 2 commits into
stagingfrom
fix/issue-204-funder-field

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Closes #204.

Problem

Funding.funder did not exist. data.nemar.org sends funder_name, so
DetailRail.astro rendered an empty <span class="rail__funder"></span> for
every funding entry. Live on production right now: nm000103 has two funding
entries and shows two blank spans. Award numbers were unaffected
(award_number was already the right name), which is why this read as a
partial rendering quirk rather than a broken field.

Change

  • neuroschema.ts: Funding.funder -> funder_name, and the two fields the
    API sends but the type omitted (award_uri, funder_identifier_type).
    Typed nullable, matching the rest of the file: a shape violation must render
    an incomplete rail, never throw and drop the page.
  • format.ts: new displayableFunding() resolves and trims the name and drops
    entries without one, so a null can never reproduce the blank-chip symptom.
  • DetailRail.astro consumes it.

No compatibility branch for the old key: I surveyed 11 funding entries across
10 datasets on production and zero carry a funder field.

Tests

Five cases in src/lib/format.test.ts, including one against
test/fixtures/funding-nm000103.json captured from
data.nemar.org/nm000103/metadata.json — the exact document that renders
blank today. Full suite 1020 passing, typecheck and lint clean.

Verified rendering against real production data on a dev server: both funder
names now appear ("See https://childmind.org/..." and "NIH"), with the
R01MH125934 award number still alongside.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: eae527f
Status: ✅  Deploy successful!
Preview URL: https://397f2f6f.nemar-website.pages.dev
Branch Preview URL: https://fix-issue-204-funder-field.nemar-website.pages.dev

View logs

@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review (code-reviewer subagent, sonnet)

Verdict: approve, no blocking issues. One cosmetic nit, fixed in eae527f.

Checks run independently of CI: typecheck 0 errors (213 files), lint clean (209 files), full suite 1020/1020 including the 5 new displayableFunding cases.

The fixture is real. test/fixtures/funding-nm000103.json was diffed against a live curl of data.nemar.org/nm000103/metadata.json and is a byte-for-byte match, satisfying the no-mocks rule.

The survey went much wider than mine, and it settles the one real design risk. I had checked 11 funding entries across 10 datasets. The reviewer fetched all 754 datasets and every metadata.json, covering 1080 funding entries across 408 datasets:

  • every entry carries exactly {funder_name, award_number, award_title, award_uri, funder_identifier, funder_identifier_type}
  • zero use a funder key, so the decision not to write a compatibility branch is correct
  • zero have an award_number/award_title with no usable funder_name

That last one matters: the open question on displayableFunding was whether dropping nameless entries could hide award data a user should see. It cannot, because that combination does not occur anywhere in the catalog.

Other findings: the generic signature is sound (the spread preserves sibling fields, covered by test); folding metadata.funding ?? [] into the helper rather than duplicating the guard is correct; a grep for \bfunder\b excluding the legitimate names found no remaining reader of .funder anywhere in the codebase.

Nit (fixed): the fixture had no trailing newline. Cosmetic only — lint runs biome check src, which does not cover test/fixtures.

Findings addressed: 1 of 1. Nothing skipped.

@neuromechanist
neuromechanist merged commit 5bd7f1b into staging Aug 3, 2026
5 checks passed
@neuromechanist
neuromechanist deleted the fix/issue-204-funder-field branch August 3, 2026 07:50
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