Skip to main content

A Python package that pulls the latest updates & changes to all ISO3166 listed countries.

Project description

iso3166-updates

iso3166_updates Build Platforms License: MIT Issues Size Commits

iso

Automated scripts that check for any updates/changes to the ISO3166-1 and ISO3166-2 country codes and naming conventions, as per the ISO3166 newsletter (https://www.iso.org/iso-3166-country-codes.html) and Online Browsing Platform (OBP) (https://www.iso.org/obp/ui). Available via a Python software package and API; a demo of both is available here.

Table of Contents

Introduction

iso3166-updates is a repo that consists of a series of scripts that check for any updates/changes to the ISO3166-1 and ISO3166-2 country codes and naming conventions, as per the ISO3166 newsletter (https://www.iso.org/iso-3166-country-codes.html). The ISO3166 standard by the ISO defines codes for the names of countries, dependent territories, special areas of geographical interest, consolidated into the ISO3166-1 standard [1], and their principal subdivisions (e.g., provinces, states, departments, regions), which compromise the ISO3166-2 standard [2].

Problem Statement

The ISO is a very dynamic organisation and regularly change/update/remove entries within its library of standards, this includes the ISO3166. Additions/changes/deletions to country/territorial codes in the ISO3166-1 are a lot less frequent than for the ISO3166-2 codes due to there being thousands more entries, thus it can be difficult to keep up with any changes to these codes. These changes are usually communicated via Newsletters on the ISO platform or Online Browsing Platform or via a database which usually costs money to subscribe to [3]. This software and accompanying API makes it extremely easy to check for any new or historic updates to a country or set of countrys' ISO3166-2 codes for free with an easy to use interface and Python package. This software is for anyone working on projects working directly with country codes and who want up-to-date and accurate ISO3166-2 codes and naming conventions.

API

An API is available that can be used to extract any applicable updates for a country via a URL. The API is in alpha stage so is just available via a Google Function at URL:

https://us-central1-iso3166-updates.cloudfunctions.net/iso3166-updates

The API documentation and usage with all useful commands and inputs to the API is available on the README of the iso3166-updates-api folder. The API was built using GCP utilsing a Cloud Function backed by an API Gateway that can be called via a http trigger at the above url, the Function calls GCP Storage to access the back-end JSON with all ISO3166 updates. This JSON is updated regularly using a CRON job that is called every X months.

Requirements

Installation

Install the latest version of iso3166-updates using pip:

pip3 install iso3166-updates

Installation from source:

git clone -b master https://github.com/amckenna41/iso3166-updates.git
cd iso3166_updates
python3 setup.py install

Usage

Import package

import iso3166_updates as iso3166_updates

Get all listed changes/updates for Andorra from wiki (https://en.wikipedia.org/wiki/ISO_3166-2:AD)

iso3166_updates.get_updates("AD")

Get all listed changes/updates for BA, DE, FR, HU, PY

iso3166_updates.get_updates(["BA","DE","FR","HU","PY"])

Get any listed changes/updates for HU, IT, JA, KE from wiki, in the year 2018

iso3166_updates.get_updates("HU, IT, JA, KE", year="2018")

Get any listed changes/updates for Ireland from wiki (https://en.wikipedia.org/wiki/ISO_3166-2:IE), between years of 2012 and 2021

iso3166_updates.get_updates("IE", year="2012-2021")

Get any listed changes/updates for Tanzania from wiki (https://en.wikipedia.org/wiki/ISO_3166-2:TZ), with updates years > 2015

iso3166_updates.get_updates("TA", year=">2015")

Get any listed changes/updates for Yemen from wiki (https://en.wikipedia.org/wiki/ISO_3166-2:YE), with updates years < 2010

iso3166_updates.get_updates("YE", year=">2010")

The output to the above functions for the updates/changes to a ISO3166-2 country returns 4 columns: Edition/Newsletter, Date Issued, Description of change in newsletter and Code/Subdivision change. E.g the output csv format for AD (Andorra) is:

Edition/Newsletter Date Issued Description of change in newsletter Code/Subdivision change
Newsletter I-8 2007-04-17 Addition of the administrative subdivisions... Subdivisions added: 7 parishes...
Online Browsing Platform (OBP) 2014-11-03 Update List Source No subdivision changes listed
Online Browsing Platform (OBP) 2015-11-27 Update List Source No subdivision changes listed

Issues

Any issues, errors or bugs can be raised via the Issues tab in the repository.

Contact

If you have any questions or comments, please contact amckenna41@qub.ac.uk or raise an issue on the [Issues][Issues] tab.

LinkedIn

References

[1]: https://en.wikipedia.org/wiki/ISO_3166-1
[2]: https://en.wikipedia.org/wiki/ISO_3166-2
[3]: ISO Country Codes Collection: https://www.iso.org/publication/PUB500001
[4]: https://github.com/lipis/flag-icons

Support

Buy Me A Coffee

Back to top

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iso3166-updates-0.0.2.tar.gz (15.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

iso3166_updates-0.0.2-py3.8.egg (5.7 kB view details)

Uploaded Egg

iso3166_updates-0.0.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file iso3166-updates-0.0.2.tar.gz.

File metadata

  • Download URL: iso3166-updates-0.0.2.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for iso3166-updates-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3d3c28311f639490524ee15c1d81bc16f5225f15f4e0ff737219d5d47c64b010
MD5 9d39cdad983fe7ee929e761d7303fad7
BLAKE2b-256 90a48a3713f1a31d298d374b0edccd339a90ff768784a2efd4cf34e2b8d7f254

See more details on using hashes here.

File details

Details for the file iso3166_updates-0.0.2-py3.8.egg.

File metadata

  • Download URL: iso3166_updates-0.0.2-py3.8.egg
  • Upload date:
  • Size: 5.7 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for iso3166_updates-0.0.2-py3.8.egg
Algorithm Hash digest
SHA256 ed47df9b1f6ec5a8d14e6339ac3d9ba1facf90c33add74dcc66d838431d1b5cf
MD5 63383d61d735c7c19c57f180d37d8b0f
BLAKE2b-256 e952e24aa7018f16090aaab06db8aa62baa360610aeadc48b7ce2c7c134109b7

See more details on using hashes here.

File details

Details for the file iso3166_updates-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for iso3166_updates-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f6a9738cba6612e12e2601f2f9f97257cfaa97e4bf8cde665a55008c1c4a6771
MD5 3358adc365add5b2354c31fe44d589a5
BLAKE2b-256 dbe5fd9f3d550703c7e3cfc9c42407e72e553edb76c8e500829bc70137d1d84f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page