Part of a Data Solution
- Explore →
Postal Codes Solution
Every worldwide postal-code dataset in one bundle — the ultimate global reference for precise postal codes.
API Access
Access dataset files directly from scripts, code, or AI agents.
Browse dataset files
API Access
Access dataset files directly from scripts, code, or AI agents.
Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.
Start with these files — they give you everything you need to understand and access the dataset.
- 1. Fetch datapackage.yaml to inspect schema and resources
- 2. Download data resources listed in datapackage.yaml
- 3. Read README.md for full context
Data Files
Explore with AIpostal-codes-sl
| Field | Type | Description | Title |
|---|---|---|---|
| country_code | string | ISO 3166-1 alpha-2 -- always SL | Country Code |
| postal_code | string | Always empty -- Sierra Leone has no postal code system. Not a data gap. | Postal Code |
| place_name | string | Chiefdom name (same as admin_name3) | Place Name |
| admin_name1 | string | Province | Administrative Name 1 |
| admin_code1 | string | ISO 3166-2:SL province code | Administrative Code 1 |
| admin_name2 | string | District (OCHA's "Fabala" corrected to "Falaba") | Administrative Name 2 |
| admin_code2 | string | Not populated | Administrative Code 2 |
| admin_name3 | string | Chiefdom, as listed in OCHA's boundary set (dated to the 2017 de-amalgamation reform; not the full post-reform chiefdom list) | Administrative Name 3 |
| admin_code3 | string | Not populated | Administrative Code 3 |
| latitude | number | Chiefdom centroid latitude (WGS84), from OCHA COD-AB | Latitude |
| longitude | number | Chiefdom centroid longitude (WGS84), from OCHA COD-AB | Longitude |
| accuracy | string | CHIEFDOM_CENTROID -- a chiefdom-area centroid, not a point address. Empty where there is no centroid. | Accuracy |
| alternative_city_name | string | Not populated | Alternative City Name |
Download
Download CSVAbout
- Last updated
- 6 October 2026
- Total rows
- 167
- Format
- CSV
- File size
- 13.8 kB
About this dataset
Sierra Leone (SL): migration notes
Internal record of the P6 migration from the old scripts to the producer: the discrepancies found, their causes, and who decided what. This is a dated record, so the numbers are as of the migration and not kept current. It is not shipped in the zip.
- Issue: pc-28e.8.20
- Commit: see
git log -- datasets/sl/(P6 sl commit on feat/single-source-of-truth, basee797eb1) - Parity verdict:
format-only(gate: pass, exit 0); CRLF→LF only - Producer:
custom, refresh disabled
Sources
| Input | URL | Notes |
|---|---|---|
| HDX catalogue entry (CKAN API) | https://data.humdata.org/api/3/action/package_show?id=cod-ab-sle | Read only to resolve the current workbook URL; not cached as an input |
| OCHA COD-AB Sierra Leone admin boundaries workbook | https://data.humdata.org/dataset/<package-uuid>/resource/<resource-uuid>/download/sle_admin_boundaries.xlsx (resolved at fetch time) | Sheet sle_admin3. The old builder read a hand-downloaded local copy (sources/ocha_cod_ab_sle_admin_boundaries.xlsx) of this workbook; its docstring names the HDX dataset page as the origin |
- Versioned URL. HDX download URLs carry resource UUIDs that change when OCHA re-uploads. The producer asks the CKAN
package_showAPI (what the dataset page itself uses) forcod-ab-sleand takes the one resource whose format isXLSX. More or fewer than one, or a non-HDX URL, is aProducerError. The resolved URL is recorded insl.inputs.json;--no-fetchreuses it. At migration time it was.../dataset/a4816317-a913-4619-b1e9-d89e21c056b4/resource/7815b9d2-a25d-470c-a032-e9d2464d942d/download/sle_admin_boundaries.xlsx(HDXlast_modified2026-01-26, sha25630fc8c69…, 467,709 bytes). - The workbook is still COD-AB v02 (the
versioncolumn), the same edition the old builder used, with 167 rows insle_admin3. - The workbook is parsed with the stdlib (zipfile + ElementTree, sheet found by name through
workbook.xmland its rels). The old builder neededopenpyxl, which isn't in the project venv or requirements. - Sierra Leone has no postal-code system, so
postal_codeis empty on every row.pipeline.postal_code_required: falsetells build.py this is intended.
Parity against the live public CSV (2026-10-05)
Rows: 167 live and 167 fresh, none only on one side, 0 changed cells, no cell classes. Once CRLF is normalised to LF the fresh sl.csv is byte-identical to the live CSV, including row order (checked with tr -d '\r' | cmp). Live sha256 97058bd8…, fresh 24a06693…; the only difference is line endings.
No discrepancies to explain.
Decisions
| Decision | By | Basis |
|---|---|---|
| Accept the CRLF→LF difference | Standing rule (P5 sign-off: row_order/CRLF-only pre-approved) | Equal rows, 0 changed cells |
Resolve the workbook URL through HDX's CKAN package_show API | Agent, per the brief's versioned-URL rule | The download URL embeds resource UUIDs; the catalogue API is the stable way to find the current one |
| Drop the exact-count assert (167 source rows) | P6 brief | Replaced by structural checks: required columns present, non-empty names, known province, numeric centroids (both or neither), all 5 provinces present, primary key unique |
Read the xlsx with the stdlib instead of openpyxl | Agent: port choice | openpyxl isn't installed or listed in requirements; es already reads INE's xlsx the same way. Output is identical |
Coordinates: round(float, 5) written as Python's float repr | Agent: faithful port | That is what the old builder's csv.DictWriter did (e.g. a value rounding to 8.10000 ships as 8.1) |
latitude/longitude typed number; accuracy stays string | Agent, per the brief | accuracy is the literal CHIEFDOM_CENTROID, not a GeoNames accuracy code, so the GeoNames accuracy description doesn't apply |
primaryKey: [admin_name1, admin_name2, admin_name3] | Agent, from the produced CSV | Unique in the produced CSV and the old builder's own PK. place_name alone is not unique (one chiefdom name occurs in two districts) |
pipeline.postal_code_required: false | Brief (plan rule; bj precedent) | Postal code is empty on every row |
| Field descriptions taken from the old builder's datapackage.json, minus counts | Agent | The P3 generic descriptions ("Postal code for the location", "e.g., state, region") were wrong for sl |
| Count wording: "167 chiefdoms" removed from the descriptor description, README and field descriptions; "16 districts and 5 provinces" kept | Agent, per the brief's count rule | One row per chiefdom, so the chiefdom count is the row count. The coverage note keeps its meaning ("fewer chiefdoms than the ~190 estimated after the 2017 reform") |
Transforms carried over
From build_postal_codes_product.py:
- One row per
sle_admin3row:place_name=admin_name3=adm3_name,admin_name2=adm2_name,admin_name1=adm1_name. admin_code1→ ISO 3166-2:SL from the province-name crosswalk (Eastern E, North Western NW, Northern N, Southern S, Western W). Unknown province is aProducerError(the old KeyError).- District fix "Fabala" → "Falaba" (OCHA misspelling; GeoNames "Falaba District").
latitude/longitudefromcenter_lat/center_lonrounded to 5 decimals;accuracyCHIEFDOM_CENTROIDwhere a centroid exists, empty otherwise.postal_code,admin_code2,admin_code3,alternative_city_nameempty.- Sorted by (admin_name1, admin_name2, admin_name3).
- Not ported: the old builder's own datapackage.json, README, ATTRIBUTION and zip writing (build.py / committed docs handle those) and
publish_r2.py(deleted; its "Fabala absent" pre-publish assert is covered by the producer's correction and a unit test).
Open questions
- The descriptor
descriptionends "see ATTRIBUTION.txt", butdatasets/sl/has no ATTRIBUTION.txt (only the old builder wrote one, intodata/for the zip). Left as is; belongs to the pc-hfz sweep. .licensing-notes.mdstill carries dated counts ("31 chiefdoms", "167 rows") and the stalelicence_status.decision: "compatible"/ premium-tier history. Left alone (pc-hfz).- The OCHA pcodes (
adm1_pcode/adm2_pcode/adm3_pcode) are in the source but were never shipped inadmin_code2/admin_code3. Not changed (that would be a schema/content change for the user to decide).