Postal Codes Dataset for Sierra Leone, SL

162
Updated:
Files:1
Size:13.8 kB
Rows:167
Formats:csv
License:CC-BY-IGO

Postal Codes Dataset for Sierra Leone, SL including name of the city, town, or place, various administrative divisions and alternative city names.

Part of a Data Solution

  • Postal Codes Solution

    Every worldwide postal-code dataset in one bundle — the ultimate global reference for precise postal codes.

    Explore →

API Access

Access dataset files directly from scripts, code, or AI agents.

Browse dataset files
Dataset Files

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.

/logistics/postal-codes-sl/
https://datahub.io/logistics/postal-codes-sl/_r/-/.licensing-notes.md
https://datahub.io/logistics/postal-codes-sl/_r/-/.migration-notes.md
https://datahub.io/logistics/postal-codes-sl/_r/-/ATTRIBUTION.txt
https://datahub.io/logistics/postal-codes-sl/_r/-/README.md
https://datahub.io/logistics/postal-codes-sl/_r/-/datapackage.yaml
Key Files

Start with these files — they give you everything you need to understand and access the dataset.

datapackage.yaml— metadata & schema
https://datahub.io/logistics/postal-codes-sl/_r/-/datapackage.yaml
README.md— documentation
https://datahub.io/logistics/postal-codes-sl/_r/-/README.md
Typical Usage
  1. 1. Fetch datapackage.yaml to inspect schema and resources
  2. 2. Download data resources listed in datapackage.yaml
  3. 3. Read README.md for full context

Data Files

Explore with AI

postal-codes-sl


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, base e797eb1)
  • Parity verdict: format-only (gate: pass, exit 0); CRLF→LF only
  • Producer: custom, refresh disabled

Sources

InputURLNotes
HDX catalogue entry (CKAN API)https://data.humdata.org/api/3/action/package_show?id=cod-ab-sleRead only to resolve the current workbook URL; not cached as an input
OCHA COD-AB Sierra Leone admin boundaries workbookhttps://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_show API (what the dataset page itself uses) for cod-ab-sle and takes the one resource whose format is XLSX. More or fewer than one, or a non-HDX URL, is a ProducerError. The resolved URL is recorded in sl.inputs.json; --no-fetch reuses it. At migration time it was .../dataset/a4816317-a913-4619-b1e9-d89e21c056b4/resource/7815b9d2-a25d-470c-a032-e9d2464d942d/download/sle_admin_boundaries.xlsx (HDX last_modified 2026-01-26, sha256 30fc8c69…, 467,709 bytes).
  • The workbook is still COD-AB v02 (the version column), the same edition the old builder used, with 167 rows in sle_admin3.
  • The workbook is parsed with the stdlib (zipfile + ElementTree, sheet found by name through workbook.xml and its rels). The old builder needed openpyxl, which isn't in the project venv or requirements.
  • Sierra Leone has no postal-code system, so postal_code is empty on every row. pipeline.postal_code_required: false tells 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

DecisionByBasis
Accept the CRLF→LF differenceStanding 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 APIAgent, per the brief's versioned-URL ruleThe 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 briefReplaced 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 openpyxlAgent: port choiceopenpyxl 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 reprAgent: faithful portThat 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 stringAgent, per the briefaccuracy 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 CSVUnique 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: falseBrief (plan rule; bj precedent)Postal code is empty on every row
Field descriptions taken from the old builder's datapackage.json, minus countsAgentThe 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" keptAgent, per the brief's count ruleOne 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_admin3 row: 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 a ProducerError (the old KeyError).
  • District fix "Fabala" → "Falaba" (OCHA misspelling; GeoNames "Falaba District").
  • latitude/longitude from center_lat/center_lon rounded to 5 decimals; accuracy CHIEFDOM_CENTROID where a centroid exists, empty otherwise.
  • postal_code, admin_code2, admin_code3, alternative_city_name empty.
  • 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 description ends "see ATTRIBUTION.txt", but datasets/sl/ has no ATTRIBUTION.txt (only the old builder wrote one, into data/ for the zip). Left as is; belongs to the pc-hfz sweep.
  • .licensing-notes.md still carries dated counts ("31 chiefdoms", "167 rows") and the stale licence_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 in admin_code2/admin_code3. Not changed (that would be a schema/content change for the user to decide).