hdx-python-pipelineutils 0.0.6__tar.gz → 0.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/PKG-INFO +1 -1
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/_version.py +2 -2
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/hapi_admins.py +19 -1
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/sector_configuration.yaml +1 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/test_hapi_admins.py +11 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/test_lookup.py +2 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/.github/workflows/publish.yaml +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/.github/workflows/run-python-tests.yaml +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/.gitignore +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/.pre-commit-config.yaml +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/CLAUDE.md +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/LICENSE +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/README.md +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/pyproject.toml +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/__init__.py +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/lookup.py +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/org_type.py +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/org_type_configuration.yaml +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/reader.py +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/sector.py +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/conftest.py +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/download-global-pcode-lengths.csv +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/download-global-pcodes-adm-1-2.csv +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/education_closures_school_closures.csv +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/global-coordination-groups-beta.json +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/hno_2017_sahel_nutrition.csv +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/hno_2017_sahel_people_in_need.xlsx +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/org_type_organization_types_beta_csv_no_hxl.csv +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/organization-types-beta.json +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/sahel-humanitarian-needs-overview.json +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/fixtures/input/sector_global_coordination_groups_beta_csv_no_hxl.csv +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/tests/test_readers.py +0 -0
- {hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/uv.lock +0 -0
{hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/_version.py
RENAMED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.0.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 0,
|
|
21
|
+
__version__ = version = '0.0.7'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 0, 7)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -38,11 +38,29 @@ def complete_admins(
|
|
|
38
38
|
warnings.append(f"PCode unknown {adm_code}->''")
|
|
39
39
|
return ""
|
|
40
40
|
|
|
41
|
+
def get_pcode_from_names(level: int) -> str | None:
|
|
42
|
+
# Exact matching only, so that a wrong parent does not scope the
|
|
43
|
+
# child lookup to the wrong area
|
|
44
|
+
pcode = None
|
|
45
|
+
for j in range(level + 1):
|
|
46
|
+
if adm_codes[j] in admins[j].pcodes:
|
|
47
|
+
pcode = adm_codes[j]
|
|
48
|
+
elif provider_adm_names[j]:
|
|
49
|
+
pcode, _ = admins[j].get_pcode(
|
|
50
|
+
countryiso3,
|
|
51
|
+
provider_adm_names[j],
|
|
52
|
+
parent=pcode,
|
|
53
|
+
fuzzy_match=False,
|
|
54
|
+
)
|
|
55
|
+
else:
|
|
56
|
+
pcode = None
|
|
57
|
+
return pcode
|
|
58
|
+
|
|
41
59
|
for i, provider_adm_name in reversed(list(enumerate(provider_adm_names))):
|
|
42
60
|
adm_code = adm_codes[i]
|
|
43
61
|
parent = admins[i].pcode_to_parent.get(adm_code)
|
|
44
62
|
if not parent and i > 0:
|
|
45
|
-
parent = adm_codes[i - 1]
|
|
63
|
+
parent = adm_codes[i - 1] or get_pcode_from_names(i - 1) or ""
|
|
46
64
|
if not provider_adm_name:
|
|
47
65
|
provider_adm_name = ""
|
|
48
66
|
provider_adm_names[i] = ""
|
|
@@ -96,6 +96,17 @@ class TestAdmins:
|
|
|
96
96
|
assert adm_level == 2
|
|
97
97
|
assert warnings == []
|
|
98
98
|
|
|
99
|
+
provider_adm_names = ["Kabul", "Qara Bagh"]
|
|
100
|
+
adm_codes = ["", ""]
|
|
101
|
+
adm_names = ["", ""]
|
|
102
|
+
adm_level, warnings = complete_admins(
|
|
103
|
+
admins, countryiso3, provider_adm_names, adm_codes, adm_names
|
|
104
|
+
)
|
|
105
|
+
assert adm_codes == ["AF01", "AF0114"]
|
|
106
|
+
assert adm_names == ["Kabul", "Qara Bagh"]
|
|
107
|
+
assert adm_level == 2
|
|
108
|
+
assert warnings == []
|
|
109
|
+
|
|
99
110
|
provider_adm_names = ["Kabal", "Paghman"]
|
|
100
111
|
adm_codes = ["AF01", ""]
|
|
101
112
|
adm_names = ["", ""]
|
|
@@ -7,6 +7,8 @@ class TestLookup:
|
|
|
7
7
|
sector = Sector()
|
|
8
8
|
assert sector.get_code("child protection") == "PRO-CPN"
|
|
9
9
|
assert sector.get_code("gestion des sites daccueil temporaires") == "SHL"
|
|
10
|
+
assert sector.get_code("Cash multi-sectoriel") == "Cash"
|
|
11
|
+
assert sector.get_code("Abris et Non vivres") == "SHL"
|
|
10
12
|
assert "Intersectoral" in sector.get_code_to_name()
|
|
11
13
|
assert sector.get_name("PRO-MIN") == "Mine Action"
|
|
12
14
|
assert sector.get_name("xxx") is None
|
{hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/.github/workflows/publish.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/__init__.py
RENAMED
|
File without changes
|
{hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/lookup.py
RENAMED
|
File without changes
|
{hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/org_type.py
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/reader.py
RENAMED
|
File without changes
|
{hdx_python_pipelineutils-0.0.6 → hdx_python_pipelineutils-0.0.7}/src/hdx/pipelineutils/sector.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|