Skip to content

Commit b40de35

Browse files
authored
HDXDSYS-2706 Update HDX Python Country to use the new global pcodes without HXL hashtags (#85)
* Removed HXL from adminlevel.py and updated documentation * Update the internal URLs
1 parent 61ee198 commit b40de35

File tree

9 files changed

+975
-1087
lines changed

9 files changed

+975
-1087
lines changed

documentation/index.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ The code for the library is [here](https://github.com/OCHA-DAP/hdx-python-countr
4242
The library has detailed API documentation which can be found in the menu at the top.
4343

4444
## Breaking Changes
45+
From 4.1.1, HXL hashtags no longer used in AdminLevel class. The header names are used
46+
instead. setup_from_iterable replaces setup_from_admin_info and
47+
setup_from_libhxl_dataset using keys: "Location", "P-Code", "Name" and "Parent P-Code".
48+
4549
From 4.1.0, HXL hashtags no longer used in Country class. The header names are used
4650
instead.
4751

@@ -154,23 +158,21 @@ A Retrieve object can be passed in the *retriever* parameter that enables
154158
saving data downloaded to a file or loading previously saved data depending
155159
on how the Retrieve object is configured.
156160

157-
Once an AdminLevel object is constructed, one of three setup methods must be
158-
called: *setup_from_admin_info*, *setup_from_libhxl_dataset* or
159-
*setup_from_url*.
161+
Once an AdminLevel object is constructed, either *setup_from_iterable* or
162+
*setup_from_url* must be called.
163+
164+
Method *setup_from_iterable* takes an iterable (eg. iterator or sequence) of the form:
160165

161-
Method *setup_from_admin_info* takes key *admin_info* which is a list with
162-
values of the form:
166+
{"Location": "AFG", "P-Code": "AF01", "Name": "Kabul"}
167+
{"Location": "AFG", "P-Code": "AF0101", "Name": "Kabul", "Parent P-Code": "AF01"}
163168

164-
{"iso3": "AFG", "pcode": "AF01", "name": "Kabul"}
165-
{"iso3": "AFG", "pcode": "AF0101", "name": "Kabul", "parent": "AF01"}
166169

167170
Dictionaries *pcode_to_name* and *pcode_to_iso3* are populated in the
168-
AdminLevel object. *parent* is optional, but if provided enables lookup of
171+
AdminLevel object. *Parent P-Code* is optional, but if provided enables lookup of
169172
location names by both country and parent rather than just country which should
170173
help with any name clashes. It also results in the population of a dictionary
171174
in the AdminLevel object *pcode_to_parent*.
172175

173-
Method *setup_from_libhxl_dataset* takes a libhxl Dataset object, while
174176
*setup_from_url* takes a URL which defaults to a resource in the global p-codes
175177
dataset on HDX.
176178

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ dynamic = ["version"]
3636
requires-python = ">=3.10"
3737

3838
dependencies = [
39-
"hdx-python-utilities>=4.0.4",
40-
"libhxl>=5.2.2",
39+
"hdx-python-utilities>=4.0.4,<5",
4140
"tenacity",
4241
]
4342

0 commit comments

Comments
 (0)