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 hashes)

Uploaded Source

Built Distributions

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

Uploaded Source

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

Uploaded Python 3

Supported by

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