Epic: #51 · risk-register C-34 (Tier 2) · foundational — S4 builds on this
Problem
Nothing asserts how many cells the FAO pipeline should process. The coverage decision lives in views-models (config_queryset.py:REGION), the cell-set in views-datafactory, and the consequences here — but unfao.py has no counterpart check. A wrong or upstream-changed region delivers partial coverage to FAO with no signal.
Context
_validate (unfao.py:147-172) checks only null-ness of the 9 metadata columns; never row/cell counts.
- The enricher already computes + logs the unmapped count (
enrichment.py:117-125) — but there is no expected total to compare against, and nothing is asserted.
- Current
REGION = "africa_me_legacy" (~13,110 cells); the land_gaul switch (~64,736) is imminent (views-models#127).
Work
Acceptance criteria
Implementation notes
- Surface the enricher's unmapped accounting (return value/attribute) so
_validate can assert on it, not just log.
- Keep the count source declarative so S4 can pin
land_gaul = 64,736.
Files
views_postprocessing/unfao/managers/unfao.py (_read, _validate); possibly gaul_schema.py / a region-count config; tests/.
Epic: #51 · risk-register C-34 (Tier 2) · foundational — S4 builds on this
Problem
Nothing asserts how many cells the FAO pipeline should process. The coverage decision lives in views-models (
config_queryset.py:REGION), the cell-set in views-datafactory, and the consequences here — butunfao.pyhas no counterpart check. A wrong or upstream-changed region delivers partial coverage to FAO with no signal.Context
_validate(unfao.py:147-172) checks only null-ness of the 9 metadata columns; never row/cell counts.enrichment.py:117-125) — but there is no expected total to compare against, and nothing is asserted.REGION = "africa_me_legacy"(~13,110 cells); theland_gaulswitch (~64,736) is imminent (views-models#127).Work
_readand_validate: log cell/row counts (historical + forecast) — fetched, enriched, unmapped._validate(or a new_validate_coverage): assert completeness — distinct enriched cells == expected for the region; raise loud on under/over.Acceptance criteria
_read/_validatelog cell counts; expected≠actual raisesValueErrorwith a clear message.Implementation notes
_validatecan assert on it, not just log.land_gaul = 64,736.Files
views_postprocessing/unfao/managers/unfao.py(_read,_validate); possiblygaul_schema.py/ a region-count config;tests/.