Skip to content

feat(data): tidy the unit picker, About this answer and download dialog - #90

Open
jm-rivera wants to merge 2 commits into
devfrom
feat/getdata-answer-panels
Open

jm-rivera wants to merge 2 commits into
devfrom
feat/getdata-answer-panels

Conversation

@jm-rivera

@jm-rivera jm-rivera commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Get Data's unit picker, About this answer panel and download dialog now show each fact once, in words a reader can use, and keep the actions that change the answer next to the facts they change.

Changes

  • Unit picker: no standing euro preset, the currency of a country the question names stays, and a "Search N currencies by name or code" field comes first (unitPresets, currencySearchLabel in src/lib/search/unitPicker.ts; UnitPicker.tsx).
  • About this answer: each fact appears once, and a fact the search filled in carries its reason and a Change control (buildWhySummary in src/lib/search/view.ts; WhyPanel.tsx).
  • Change controls open the sentence word's menu or Refine through one resolver shared with departures (changeTarget in src/lib/search/refineMenu.ts; openMenu lifted into DataSearch.tsx).
  • Breakdowns list their categories with no variable count, and the variable list and family note are gone.
  • The Measure row shows the publisher's indicator code from stat_vars.source_codes, and the DFO variable id sits behind a copy control.
  • The source appears once with publisher and licence, and the citation says "processed by" only when a unit conversion was applied (citation in view.ts).
  • Download dialog: one switch for README, SOURCES.md, CITATION.cff and datapackage.json, extra columns folded under plain names with examples taken from the answer, and blank counts in words (DownloadOptions.tsx, src/lib/search/downloadOptions.ts).
  • Extra columns the long file already writes are hidden by the options document's in_long_layout flag (enrichmentAlreadyInFile), with the long_layout_defaults comparison as the fallback while the API does not serve it.

Notes for reviewers

  • The Party kind, class and whole rows stay visible until dfo-apis serves in_long_layout. The vendored client does not type the field yet, so DatasetEnrichment widens it locally in searchClient.ts.
  • The ISO 2-letter row shows no example: the spec carries only the Data Commons ref, which holds the 3-letter code.
  • A Change for a word-menu row appears one render after the answer lands, because the heading reports its drawn menus through an effect (onMenuChanges).
  • A summed family of variables still cites "via": the website sees unit requests only.

Testing: pnpm lint, pnpm lint:css, pnpm typecheck, pnpm test (2,190 pass) and pnpm build pass. Before and after screenshots against the dev API are below.

Screenshots

Before is origin/dev (b91925c) and after is this branch, both against the dev API through a local proxy, at 1440 by 900.

Change Before After
Unit picker for a Mozambique answer: a currency search field comes first and the list shows only the current unit and the Mozambican metical before 01 after 01
Kenyan shilling preset on a Mozambique question: the typed filter "kes" leaves one row, Kenyan shillings, with Prices below it and no clipped heading before 02 after 02
About this answer for Mozambique: the column token goes, and Change links, a licence line and a Cite as row arrive before 03 after 03
About this answer for Somalia: the column token and the "1 value" line go, and Change links and a Cite as row arrive before 04 after 04
Download dialog: one README, sources and citation tick with file names, and a closed Extra columns fold before 05 after 05
Download dialog with Extra columns open Not present after 06

The unit picker drops the standing euro preset, keeps the currency of
any country the question names, and puts a "Search N currencies" field
first (lib/search/unitPicker.ts, UnitPicker.tsx).

About this answer shows each fact once. A fact the search filled in
carries its reason and a Change control that opens the same menu the
sentence uses (changeTarget in lib/search/refineMenu.ts). Breakdowns
list their categories without a variable count, the publisher's own
indicator code sits on the Measure row from stat_vars.source_codes,
the source appears once, and the citation says "processed by" only
when a conversion was applied (lib/search/view.ts, WhyPanel.tsx).

The download dialog has one switch for the README, sources and
citation files, and folds extra columns under plain names with
examples from the answer and blank counts in words. Extra columns the
long file already writes are hidden by the API's in_long_layout flag,
with the long_layout_defaults comparison as the fallback until the API
serves it (lib/search/downloadOptions.ts).
@jm-rivera
jm-rivera added this pull request to stack #93 October 31, 2026 22:25
Refine keyed an open role by the role name (`destination:`) while the
About rows and the wire use `roleRef` (`where:`), so Change found no
Refine entry for an open recipient. Refine now keys roles by `roleRef`.
@jm-rivera
jm-rivera marked this pull request as ready for review October 31, 2026 23:34

This branch has not been deployed

No deployments
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