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.
Split out of #741, which fixed the half of this that was actionable now.
The gap
polity_area_crosswalkrows are keyed on(area_code, polity_code), and.add_polity_columns_dt()is called with two different kinds of code in thatfirst slot:
R/build_cbs.R:766, 892, 1393, 2425,R/build_trade.R:191, 201;polity_area_code--.bucket_area_labels()(
R/polity_folds.R:585), which is where every publishedreporting_polity_codeis 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:bucket 238, so bucket 238 sums Ethiopia's 1961-1992 data, and this row is the
bucket's only period before 1993. Deleting it sends 176 of the 352
(area, year) pairs for areas 62/238 to
ETH-1993-2025as an out-of-spanstand-in -- measured in The prefix expansion hands an area the polity another area owns upstream, because it only tests each area against its own map span #741, which is why that PR kept it.
upstream's map gives it 1993-2024 only.
#741 removed the mirror row
(62, ETH-1993-2025)precisely because it has nobucket 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
ETHis the only ISO3 prefix family theupstream 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 reachesreporting_polity_codethrough the bucket route, andETH-1952-1993is theright 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_rolein{"area", "bucket"}, or two tables), have.add_polity_columns_dt()select onit, and mark
(238, ETH-1952-1993)bucket-only. That is a published schemachange with more than one defensible shape, which is why it is filed rather than
folded into #741.
Part of the polity migration epic #458.