hdx-python-scraper 2.6.2__py3-none-any.whl → 2.6.3__py3-none-any.whl
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/scraper/framework/_version.py +2 -2
- hdx/scraper/framework/utilities/hapi_admins.py +23 -9
- {hdx_python_scraper-2.6.2.dist-info → hdx_python_scraper-2.6.3.dist-info}/METADATA +1 -1
- {hdx_python_scraper-2.6.2.dist-info → hdx_python_scraper-2.6.3.dist-info}/RECORD +6 -6
- {hdx_python_scraper-2.6.2.dist-info → hdx_python_scraper-2.6.3.dist-info}/WHEEL +0 -0
- {hdx_python_scraper-2.6.2.dist-info → hdx_python_scraper-2.6.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -31,8 +31,20 @@ def complete_admins(
|
|
|
31
31
|
warnings = []
|
|
32
32
|
child = None
|
|
33
33
|
adm_level = len(provider_adm_names)
|
|
34
|
+
|
|
35
|
+
def check_unknown_pcode(adm_code: str, pcode: str) -> str:
|
|
36
|
+
if pcode:
|
|
37
|
+
warnings.append(f"PCode unknown {adm_code}->{pcode} ({warntxt})")
|
|
38
|
+
return pcode
|
|
39
|
+
else:
|
|
40
|
+
warnings.append(f"PCode unknown {adm_code}->''")
|
|
41
|
+
return ""
|
|
42
|
+
|
|
34
43
|
for i, provider_adm_name in reversed(list(enumerate(provider_adm_names))):
|
|
35
44
|
adm_code = adm_codes[i]
|
|
45
|
+
parent = admins[i].pcode_to_parent.get(adm_code)
|
|
46
|
+
if not parent and i > 0:
|
|
47
|
+
parent = adm_codes[i - 1]
|
|
36
48
|
if not provider_adm_name:
|
|
37
49
|
provider_adm_name = ""
|
|
38
50
|
provider_adm_names[i] = ""
|
|
@@ -40,9 +52,6 @@ def complete_admins(
|
|
|
40
52
|
pcode = admins[i + 1].pcode_to_parent.get(child)
|
|
41
53
|
warntxt = "parent"
|
|
42
54
|
elif provider_adm_name:
|
|
43
|
-
parent = admins[i].pcode_to_parent.get(adm_code)
|
|
44
|
-
if not parent and i > 0:
|
|
45
|
-
parent = adm_codes[i - 1]
|
|
46
55
|
pcode, _ = admins[i].get_pcode(
|
|
47
56
|
countryiso3,
|
|
48
57
|
provider_adm_name,
|
|
@@ -54,14 +63,19 @@ def complete_admins(
|
|
|
54
63
|
pcode = None
|
|
55
64
|
if adm_code:
|
|
56
65
|
if adm_code not in admins[i].pcodes:
|
|
57
|
-
if
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
if admins[i].looks_like_pcode(adm_code):
|
|
67
|
+
adj_adm_code = admins[i].convert_admin_pcode_length(
|
|
68
|
+
countryiso3, adm_code, parent=parent
|
|
60
69
|
)
|
|
61
|
-
|
|
70
|
+
if adj_adm_code:
|
|
71
|
+
warnings.append(
|
|
72
|
+
f"PCode length {adm_code}->{adj_adm_code}"
|
|
73
|
+
)
|
|
74
|
+
adm_code = adj_adm_code
|
|
75
|
+
else:
|
|
76
|
+
adm_code = check_unknown_pcode(adm_code, pcode)
|
|
62
77
|
else:
|
|
63
|
-
|
|
64
|
-
adm_code = ""
|
|
78
|
+
adm_code = check_unknown_pcode(adm_code, pcode)
|
|
65
79
|
elif pcode and adm_code != pcode:
|
|
66
80
|
if child:
|
|
67
81
|
warnings.append(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hdx-python-scraper
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.3
|
|
4
4
|
Summary: HDX Python scraper utilities to assemble data from multiple sources
|
|
5
5
|
Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-scraper
|
|
6
6
|
Author-email: Michael Rans <rans@email.com>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
hdx/scraper/framework/__init__.py,sha256=11ozJKiUsqDCZ3_mcAHhGYUyGK_Unl54djVSBBExFB4,59
|
|
2
|
-
hdx/scraper/framework/_version.py,sha256=
|
|
2
|
+
hdx/scraper/framework/_version.py,sha256=wl1bK-kzofoYuHGmhGayX761BRFej70Wz5KsoRCUVPs,411
|
|
3
3
|
hdx/scraper/framework/base_scraper.py,sha256=J7AHhDFBehENragRvpZnV8Qi7IcfFql9U_UU1svNr5o,15424
|
|
4
4
|
hdx/scraper/framework/runner.py,sha256=an0c_tz46PCnyyUk0dgDV8xfkb7F3LHMUIhPyPSU8sM,53499
|
|
5
5
|
hdx/scraper/framework/outputs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -15,7 +15,7 @@ hdx/scraper/framework/scrapers/rowparser.py,sha256=j_FxNYzhSB9QmBAzqNhuNVCjlJP4c
|
|
|
15
15
|
hdx/scraper/framework/scrapers/timeseries.py,sha256=w0Ejg4nXaLSuq32zx7vlULMZuDZaTqRO94Dm-VKA9co,3026
|
|
16
16
|
hdx/scraper/framework/utilities/__init__.py,sha256=-zOJzat-fbv427FBIKDnWLs2QStXTBZahiNy_-pgPOc,2390
|
|
17
17
|
hdx/scraper/framework/utilities/fallbacks.py,sha256=t8oKE3_3I6fX4-kzvAdRIhdjg-9vWBGE6shd2_EvC4c,6184
|
|
18
|
-
hdx/scraper/framework/utilities/hapi_admins.py,sha256=
|
|
18
|
+
hdx/scraper/framework/utilities/hapi_admins.py,sha256=K4c-v7NlXQyRd0k2v8h8L2uGoNHaUpPe92cZZAbXsUM,4239
|
|
19
19
|
hdx/scraper/framework/utilities/lookup.py,sha256=4IkO35eBN5xz2H5y688C3L80zEvTjrHQgYiM4dFVpPo,3519
|
|
20
20
|
hdx/scraper/framework/utilities/org_type.py,sha256=euQyRV01yA8kJ3nMFvZxnTRLnvCuxgV1ZZQx8gEOB8Y,183
|
|
21
21
|
hdx/scraper/framework/utilities/org_type_configuration.yaml,sha256=tTordLPgnE90FSJzbVJPEnE06KyhlQBsPlIu1IAw3iw,1841
|
|
@@ -25,7 +25,7 @@ hdx/scraper/framework/utilities/sector.py,sha256=XGysivvPhTqQfK6z1y96sDJATk3zx7s
|
|
|
25
25
|
hdx/scraper/framework/utilities/sector_configuration.yaml,sha256=VKddsahminPOc3QKKieb1DvaYXkdPdhT5cPAL9_HjDw,4940
|
|
26
26
|
hdx/scraper/framework/utilities/sources.py,sha256=3miKn_iruWpfpBA-7R9jFt6_EdfX1zvW4PvjifOCd7s,11503
|
|
27
27
|
hdx/scraper/framework/utilities/writer.py,sha256=YjOhVo3Ks0I5WH7oyM2Q7fO6ImGabYZ2CBhbYw_A0Kk,16695
|
|
28
|
-
hdx_python_scraper-2.6.
|
|
29
|
-
hdx_python_scraper-2.6.
|
|
30
|
-
hdx_python_scraper-2.6.
|
|
31
|
-
hdx_python_scraper-2.6.
|
|
28
|
+
hdx_python_scraper-2.6.3.dist-info/METADATA,sha256=ay5u9phDGiJH6XXVTzzfQYLos_Q5VzPjjAVBZSCsZKA,3361
|
|
29
|
+
hdx_python_scraper-2.6.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
30
|
+
hdx_python_scraper-2.6.3.dist-info/licenses/LICENSE,sha256=wc-4GpMn-ODs-U_bTe1YCiPVgvcjzrpYOx2wPuyAeII,1079
|
|
31
|
+
hdx_python_scraper-2.6.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|