Repository navigation
SWEET holds no income table; the caller passes each country's income group - #116
Merged
Merged
Conversation
…roup country_income.py was a copy of What a Waste 2.0's 2018 World Bank groups, a second source beside the one the ingestion pipeline now loads from the World Bank. It and site_type_defaults.income_for are deleted; the site-type rule's high-income branch uses only the income the caller passes. New arguments so WasteMAP can pass its build's income: sdst_prepopulate income_by_iso3, load_andre_params income_id, dst_baseline_blank income_id (through disposal_split_for). Climate TRACE already passes its row's income. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The public City.site_only_estimate path still omits the caller-provided income_id, causing incorrect site-type guesses and leaving the active contract violation unresolved.
1 open issue
What changed in this PR
This PR removes SWEET’s embedded World Bank income-group table and makes caller-provided income the sole input for site-type and disposal-split fallbacks.
Changes:
- Deletes
country_income.pyand removes the internal income fallback. - Adds income parameters to city, custom-location, and site-type inference paths.
- Updates tests, modelling documentation, and the October changelog.
- Corrects the remaining public site-type path and contradictory changelog entries before approval.
This pull request requires changes.
| File | Summary |
|---|---|
tests/test_site_type_defaults.py |
Verifies removal of the embedded income table and the updated income arguments. |
tests/test_custom_location_disposal_split.py |
Covers custom-location disposal splits with and without caller-provided income. |
SWEET_python/site_type_defaults.py |
Uses caller-provided income for high-income rules. Moderate issue (2 votes): City.site_only_estimate still calls default_site_type without income. |
SWEET_python/MODEL_DECISIONS.md |
Documents caller-supplied income as the site-type modelling decision. |
SWEET_python/defaults_2019.py |
Propagates caller-provided income into disposal-split fallback logic. |
SWEET_python/country_income.py |
Deletes SWEET’s duplicated World Bank income-group table. |
SWEET_python/city_params.py |
Adds income inputs to city loading, custom locations, and SDST prepopulation paths. |
changelog/2026-10.md |
Documents the API and modelling changes. Nit (1 vote): older entries still reference the deleted income module and outdated disposal-split API. |
Review effort: Lite
The last path that guesses a site type with no income argument. Nothing calls it, but a caller would have lost the high-income rule silently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

SWEET no longer keeps its own copy of the World Bank income groups.
SWEET_python/country_income.pyheld What a Waste 2.0's 2018 groups, and the site-type rule fell back to it whenever a caller passed no income. Income now comes only from the caller, so every tool reads it from one place: the World Bank list the ingestion pipeline loads (RMI/waste_data_ingestion_pipeline#309).What changed
country_income.pyandsite_type_defaults.income_forare deleted. Nothing outside SWEET imported them; I checked Climate TRACE and WasteMAP.landfill_is_default/default_site_type: the high-income branch uses only theincome_idthe caller passes. A missing income counts as not high income, so only the region and named-country rules apply.City.sdst_prepopulate(..., income_by_iso3=): a country→group mapping, looked up once the clicked point's country is known.City.load_andre_params(..., income_id=): the cities table's disposal-split fallback (Singapore, Brunei and others with no split of their own).City.dst_baseline_blank(..., income_id=), passed on todefaults_2019.disposal_split_for: Custom Location.income_id; nothing changes there.Does this change a modelling decision?
site-type-fillinSWEET_python/MODEL_DECISIONS.mdnow says the caller supplies income.Do published numbers change?
Only for a caller that passes no income. That caller loses the high-income branch: untyped sites in Australia, Chile and the high-income Caribbean islands default to open dump, and cities in Brunei and Singapore with no split of their own fall back to all dumpsite. WasteMAP's paired PR passes income on every path, so its numbers move only where the World Bank group itself changed since 2018 (Argentina, Guyana and others; see that PR).
Tests
pytest -m "not integration": 710 passed.tests/test_site_type_defaults.pynow checks that SWEET holds no table and that the new arguments exist.tests/test_custom_location_disposal_split.pycovers Brunei with and without an income.Pairs with
sweet_python.refnames this branch.main, so the release that ships it also ships A shared site is split by the tonnes each city reports sending it #111–A site's intake series: the average sits at its years, and a shrinking site follows its line #113.Acceptance criteria
Definition of done
MODEL_DECISIONS.mdand the changelog updated🤖 Generated with Claude Code