Skip to content

The crosswalk cannot say whether a row answers for a reporting area or for the bucket it folds into #742

Description

@lbm364dl

Split out of #741, which fixed the half of this that was actionable now.

The gap

polity_area_crosswalk rows are keyed on (area_code, polity_code), and
.add_polity_columns_dt() is called with two different kinds of code in that
first slot:

  • a raw FAOSTAT reporting area code -- R/build_cbs.R:766, 892, 1393, 2425,
    R/build_trade.R:191, 201;
  • a bucket code, i.e. polity_area_code -- .bucket_area_labels()
    (R/polity_folds.R:585), which is where every published
    reporting_polity_code is actually decided.

Nothing in the table says which of the two a row is meant to answer, so one row
has to serve both. (238, ETH-1952-1993) is the case:

#741 removed the mirror row (62, ETH-1993-2025) precisely because it has no
bucket reading -- nothing folds into bucket 62 -- but the asymmetric rule it
shipped is a workaround for the missing distinction, not the distinction itself.

Scope

Small and static. Only three areas fold into a bucket that is not their own code
(62 into 238, 276 and 277 into 206), and ETH is the only ISO3 prefix family the
upstream map splits across two reporting areas, so exactly one row is
currently ambiguous.

Not urgent, and why

The two readings happen to give the same answer today. Measured over all 266
area/bucket codes x 1850-2025 (46,816 pairs) and confirmed on a real
6,310,390-row get_primary_production(), every pre-1993 Ethiopia row reaches
reporting_polity_code through the bucket route, and ETH-1952-1993 is the
right answer for it. A raw area-238 row dated before 1993 -- which FAOSTAT never
emits -- would get the same code, correctly by extent but silently as a period
hit rather than as the stand-in it is. So this is labelling precision, not a
wrong number.

What a fix would look like

Give the crosswalk a column naming the key space a row serves (key_role in
{"area", "bucket"}, or two tables), have .add_polity_columns_dt() select on
it, and mark (238, ETH-1952-1993) bucket-only. That is a published schema
change with more than one defensible shape, which is why it is filed rather than
folded into #741.

Part of the polity migration epic #458.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:regionsRegions, countries, polities: harmonization & modelingenhancementNew feature or requestneeds-expertEmbeds a methodological/scientific decision. Do not merge on green CI alone; tag an expert.priority:lowThere are other more important things

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions