Skip to content

feat(studio): show publisher codes in a card's More Info - #100

Merged
jm-rivera merged 2 commits into
devfrom
feat/more-info-source-codes
Nov 1, 2026
Merged

jm-rivera merged 2 commits into
devfrom
feat/more-info-source-codes

Conversation

@jm-rivera

@jm-rivera jm-rivera commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Studio's More Info now shows the publisher's indicator codes that card descriptions carry, worded as Get Data's "About this answer" words them. A one-series card shows "World Bank code DT.TDS.DEGG.CD" under the measure, and a card that draws several values, such as Zimbabwe's debt by currency, shows each value's code beside its Shows row. The descriptions gain the field in DevelopmentFinanceObservatory/spec-kit#45 and DevelopmentFinanceObservatory/apis#239. Until those ship, no description carries codes and the panel is unchanged.

Changes

  • src/lib/sourceCodes.ts and src/components/atoms/SourceCodes: groupSourceCodes groups codes by publisher, keeps the exact ones when any is exact, lists three per publisher and counts the rest; sourceCodeParts and sourceCodeText build "World Bank code …" or "Built from World Bank codes …". Get Data's WhyPanel and view.ts use them, and its output is unchanged.
  • src/lib/studio/description.ts: DescriptionSourceCode, DrawnValue and About.source_codes, read tolerantly, so a malformed list is dropped and the rest of the description reads.
  • descriptionBlocks.ts and CardInfoPanel.tsx: each Shows term carries its codes as small mono chips with the full sentence as their title, three a publisher and "+N more" for the rest (sourceCodeChips). The card-level sentence under the measure names the card codes no shown value carries (unlistedCodes), and shows only when some remain.
  • Tests: the spec-kit vector description-card-source-codes.json as a fixture, cases for per-value codes, one exact series, a computed card's "Built from" codes, an unnamed publisher, a malformed list and a card with none, and sourceCodes.test.ts for the shared sentence.

Notes for reviewers

A provenance maps to its publisher through description.sources[], falling back to the source's label and then "Source", never the raw provenance/... ref. On a computed card that works only where the description credits the input's source.

Testing: pnpm lint, pnpm lint:css, pnpm typecheck, pnpm test (2,282 passed, with Get Data's why.test.ts unchanged; every new description assertion fails without the change) and pnpm build pass. Rendered More Info from the spec-kit vector and a one-series IDS description.

Screenshots

Before After, one code per value After, one series
More Info lists Zimbabwe's six currencies with no codes Each currency in Shows carries its World Bank code, such as DT.CUR.EURO.ZS A Mozambique debt service card reads World Bank code DT.TDS.DEGG.CD under the measure

Card descriptions can carry the publisher's indicator codes behind
their series (about.source_codes, and source_codes on each drawn
value). More Info shows a one-series card's code under the measure
("World Bank code DT.TDS.DEGG.CD") and each drawn value's code beside
its Shows row. The grouping by publisher and the sentence move into
src/lib/sourceCodes.ts and the SourceCodes atom, which Get Data's
"About this answer" now uses too, so both surfaces word codes the same
way. The description reader drops a malformed code list and keeps the
rest of the description.
More Info dropped the card-level code line whenever any Shows value
carried codes, so a card code that no value carried vanished.
unlistedCodes now keeps the card codes no shown value carries, and the
line shows only when some remain. The per-value chips show three codes
a publisher and now add "+N more" for the rest (sourceCodeChips).
@jm-rivera
jm-rivera marked this pull request as ready for review November 1, 2026 09:41
@jm-rivera
jm-rivera merged commit c701d4a into dev Nov 1, 2026
2 checks passed
@jm-rivera
jm-rivera deleted the feat/more-info-source-codes branch November 1, 2026 09:46
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