Repository navigation
feat(studio): show publisher codes in a card's More Info - #100
Merged
Merged
Conversation
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).
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.
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.tsandsrc/components/atoms/SourceCodes:groupSourceCodesgroups codes by publisher, keeps the exact ones when any is exact, lists three per publisher and counts the rest;sourceCodePartsandsourceCodeTextbuild "World Bank code …" or "Built from World Bank codes …". Get Data'sWhyPanelandview.tsuse them, and its output is unchanged.src/lib/studio/description.ts:DescriptionSourceCode,DrawnValueandAbout.source_codes, read tolerantly, so a malformed list is dropped and the rest of the description reads.descriptionBlocks.tsandCardInfoPanel.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.description-card-source-codes.jsonas 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, andsourceCodes.test.tsfor 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 rawprovenance/...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'swhy.test.tsunchanged; every new description assertion fails without the change) andpnpm buildpass. Rendered More Info from the spec-kit vector and a one-series IDS description.Screenshots