Skip to content

Stop carrying the CBS area label through the build once the last three label-keyed joins are gone #731

Description

@lbm364dl

area is still carried through the whole CBS build as an identity, even though
nothing publishes it: .format_cbs_output() drops it in favour of
reporting_polity_name, which is already year-aware. whep#709 took it out of
the five keys in the pre-1962 extension that did not need a decision first
(PR #730). Three remain, and each is its own issue:

join issue blocked on
.polity_code_from_labels() whep#698 whep#493's aggregate-proxy decision
.fill_historical_destinies()'s primary_area join whep#699 the seed expression (production * seed_rate is t x t/ha)
.interpolate_destiny_shares() whep#691 nothing; it is a no-op refactor

Once those three are gone, area is a display label with no readers inside the
build, and the target state whep#458 describes becomes available: stop
carrying it at all
, and attach the name at the output stage with
add_area_name() or the reporting-polity columns.

That is worth doing rather than leaving, because the label is written by three
different vocabularies and they disagree:

  • .aggregate_to_polities() emits the periodized polity_name
    (Albania (1913-2025)),
  • .enrich_primary_with_names() and .prepare_historical_cbs() emit the
    crosswalk's static area_name (Albania).

Measured on a real 1850-2023 cbs_raw0 (216 published codes) at whep
3014506e: the stamped CBS label differs from .current_area_lookup()'s
area_name for 48 of 216 codes, and over the wider crosswalk the static
name is not any of the code's polity names for 97 of 262 codes. On the raw
frame before source selection, 75 of 216 codes carry more than one label (up to
4) and 2,837 (area_code, year) pairs carry more than one.

None of that costs anything today -- whep#709 removed the last place where it
multiplied rows -- but it is three vocabularies kept alive for a column with no
consumer, and each new reader of area re-creates the whep#563 exposure.

What resolving it needs

  1. whep#691, then whep#699 + whep#493/whep#698, in that order of difficulty.
  2. Drop area from the frames .cbs_combine_sources() and
    .cbs_extend_historical() pass along; keep .cbs_area_labels() only if some
    caller still needs a per-code display name.
  3. Verify as usual: build_commodity_balances(1850:2023) identical(), and one
    area_code -> one reporting_polity_name per year.

Part of the polity migration epic #458. Follow-up from whep#709 / PR #730.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cbsCommodity balance sheets & supply-useenhancementNew feature or requestmechanicalNo methodological decision; objectively correct. Reviewable on tests/CI, low-review to merge.priority:lowThere are other more important things

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions