Repository navigation
Use parent-keyed admin name mappings whatever the p-code's parent - #95
Merged
Merged
Conversation
A mapping keyed by parent (eg. "ET07|Dawuro": "ET1104") was ignored unless the mapped p-code's parent equalled the key's parent, so it could not map a name listed under a pre-split region to its current p-code. Country and global mappings still require the parent to match.
This was referenced Sep 29, 2026
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.
AdminLevel.get_pcodeignored a mapping keyed by parent (eg."ET07|Dawuro": "ET1104") unless the mapped p-code's parent equalled the key's parent. Such a mapping could not send a name listed under a pre-split region to its current p-code.Now a parent-keyed mapping is used whatever the p-code's parent. Country (
"ETH|...") and global mappings still require the p-code's parent to match the given parent.Motivation
hdx-scraper-ipc: since hdx-python-pipelineutils 0.0.7, IPC "SNNP" exact matches ET07 as parent, so "Dawuro" (ET1104, under ET11 South West Ethiopia) goes unmatched (44 rows, 2020–21). With this change,
"ET07|Dawuro": "ET1104"restores ET11/ET1104 (checked against IPC's test data: only those 44 rows change).Existing configs affected
Across OCHA-DAP repos, the only parent-keyed mappings whose p-code is outside the key's parent are 8 in hapi-pipelines and hapi-pipelines-backup
configs/core.yaml(eg."ET07|SIDAMA": "ET1600","TZ12|Mbozi": "TZ2606"). They have been ignored since they were added (2024-05-31, after the parent check in #42). The current hapi-pipelines does no name-based p-code lookups, and hapi-pipelines-backup cannot install country 4.2.x, so neither output changes.Changes
adminlevel.py: parent-keyed mapping checked first inget_pcode"AF05|MyMapping4": "AF0401"and assertionsdocumentation/index.md: mapping rule described