Skip to content

feat(descriptions): carry each series' publisher codes - #45

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

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

Conversation

@jm-rivera

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

Copy link
Copy Markdown
Contributor

Card and dataset version descriptions can now carry the publisher's own indicator codes behind their series, so Studio's More Info can say "World Bank code DT.CUR.EURO.ZS" as Get Data already does from Search's stat_vars.source_codes. The shape and the meaning of exact are Search's, so the two surfaces say the same thing.

Changes

  • description.schema.json: $defs.source_code ({provenance, code, exact?}), $defs.source_codes (1 to 50, unique, sorted by provenance then code), about.source_codes on a card or a dataset version, and $defs.drawn_value, which lets each about.drawn value carry the codes its variables declare. A computed version and a source card refuse about.source_codes, and a card drawn from a computed version refuses exact at both places ($defs.built_from_codes).
  • structure.py: check_description refuses a source_codes list, under about or on a drawn value, that is not strictly ascending by (provenance, code) (source_codes_not_ascending). JSON Schema's uniqueItems compares whole entries, so this rule is what stops the same code appearing twice with and without exact.
  • Five vectors: description-card-source-codes (accepted), description-card-computed-exact-code-rejected, description-source-codes-empty-rejected, description-source-codes-reversed-rejected and description-drawn-value-source-codes-duplicate-rejected.
  • catalogue/manifest.json: the schema's new referenced_schemas digest, which dfo-apis checks when it loads the catalogue.
  • The descriptions README and CHANGELOG.

Notes for reviewers

A list past 50 codes is left out, as drawn.values is, so a served list is always complete. A description with no codes omits the member and is unchanged on the wire. description.schema.json on dev is not in pretty-format-json's form (the hook rewrites 160 untouched lines), so these commits skip that hook and write the additions in the file's inline style; the reformat can go in a PR of its own. structure.py on dev already fails check-docstring-first (its constants carry attribute docstrings), so the second commit skips that hook too.

Testing: validate_descriptions_vectors.py (124 vectors), the descriptions (142, at full coverage) and components (314) suites, validate_client_contract.py, tools/tests (624), and ruff, ruff format and ty pass. The dfo-apis composer change that fills the field passes its description, assembler, Datasets, Presentation, live-refresh and contract suites (6,097 passed) against this branch.

A card or dataset version description can now state the publisher's
own indicator codes behind its series (World Bank IDS's
DT.DIS.BLAT.CB.CD and the like) as about.source_codes, and each drawn
value its variables declare can carry its own. A code is
{provenance, code, exact?} in Search's order and with its meaning of
exact. A list holds 1 to 50 codes and is left out past that, as
drawn.values is. A computed version and a source card take none, and
a card drawn from a computed version takes no exact code. The
components catalogue manifest carries the schema's new digest.
uniqueItems compares whole entries, so a source_codes list could name
the same (provenance, code) twice when only exact differed, and could
list codes in any order. check_description now refuses a list under
about or on a drawn value that is not strictly ascending by
(provenance, code), with the reason source_codes_not_ascending, which
covers both. Two vectors pin a duplicate on a drawn value and a
reversed about list.
@jm-rivera
jm-rivera marked this pull request as ready for review November 1, 2026 09:10
@jm-rivera
jm-rivera merged commit 4ad7739 into dev Nov 1, 2026
19 checks passed
@jm-rivera
jm-rivera deleted the feat/description-source-codes branch November 1, 2026 09:55
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