Skip to main content

Identifier Tools

Library that helps working with different entity (legal person, entrepreneur, subject, etc.) identifier types.

Purpose of this library is to validate string if it matches the identifier format and if possible calculate checksum if it is correct for identifier.

Identifier format checking is based on European Central Bank - List of national identifiers spreadsheet.

Identifier format is extended by identifiers issued by Národná banka Slovenska - Národné voľby a špecifiká v projekte AnaCredit.

Currently supported identifiers for checksum calculation: IČO, IČO NI, LEI, NIČ, all available identifiers and their format is listed in file identifier_tools/formats_constants.py.

Identifier Tools library has support for ISO 7064 standard that is used to validate NIČ, LEI, IBAN among other things… Read more at wikipedia: https://en.wikipedia.org/wiki/ISO_7064

Installation

Install the released version:

pip install identifier-tools

Usage

Basic usage is to verify if the identifier has correct format, or if the identifier can be used in particular country:

>>> from identifier_tools.formats import verify_identifier_format, verify_national_identifier_country
>>> verify_identifier_format(identifier_type="GEN_VAT_CD", identifier="1111")
True
>>> verify_national_identifier_country(country_code="SK", national_id_type="SK_ICO_CD")
True

You can list all available identifiers in a particular country. Some countries has multiple identifiers with different priority, you can get the identifier rank as well:

>>> from identifier_tools.formats import get_country_identifiers, get_identifier_rank
>>> get_country_identifiers("DE")
[(1, 'DE_TRD_RGSTR_CD'), (2, 'DE_VAT_CD'), (3, 'DE_TAX_CD'), (4, 'DE_NOTAP_CD')]
>>> get_identifier_rank("DE_TAX_CD")
3

If you want to manually verify the identifier, it is possible to find a link provided by ECB:

>>> from identifier_tools.mappers import get_verification_register
>>> get_verification_register('SK_ICO_CD')
'https://rpo.statistics.sk/rpo'
>>> get_verification_register('US_EIN_CD')
('https://www.irs.gov/businesses/small-businesses-self-employed/employer-id-numbers-eins', 'https://eintaxid.com/')

Development

We look forward to any kind of improvements and support for new identifiers.

If you do add support for any identifier, checksum, etc. please add a link to the specific documentation that was used for implementation, so we can reference to it.

Clone a repository locally and make sure you work in your own branch and once you are happy with the functionality create pull request. All new code should be covered with tests. We try to use test driven development for the project.

If you find a bug feel free to create an issue with description, how ever we appreciate even more if you create failing test.

Release

Release is done via twine. The whole package is uploaded in the form of .dist file.

To create .dist file use command:

python setup.py sdist bdist_wheel

Now our binary .dist file is created, now we need to upload it using the below command:

python -m twine dist/*

Alternatively if you want to selfhost in a custom PyPI repo you can also upload there as well:

python -m twine upload--repository-url https://gitlab.com/custom/repo/path dist/* --cert /custom/cert

Testing

Tests are written in pytest and stored in tests directory. Library has 100% test coverage. If you found an error, write a failing test first.

Run the tests by following command:

pytest identifier_tools

Metadata

Release files for identifier-tools 2.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for identifier-tools 2.7.0
File Size Uploaded
identifier-tools-2.7.0.tar.gz 23.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for identifier-tools 2.7.0
File Interpreter ABI Platform
identifier_tools-2.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.6 kB

Release files / identifier-tools-2.7.0.tar.gz

Download URL identifier-tools-2.7.0.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
14333711a30e424413e6a51ef811e561e681e0f4baba41e1a3c2e2125cb1ddd3
BLAKE2b-256 checksum
How to use checksums
87741b659035bc2a4b51c75ad6d2ec2607680d5553c4f47b60563116e3a34e79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / identifier_tools-2.7.0-py3-none-any.whl

Download URL identifier_tools-2.7.0-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70b18adc85a92977ab0bad3faf1a34eb2ee46ec17a80468e87e44a0a6ce42858
BLAKE2b-256 checksum
How to use checksums
01617a096baba55257417065f2976e2df6febfe85a6438ed5a68945baffb65d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release history Release notifications | RSS feed

This release

2.7.0 This release

2 release files

2.6.3

2 release files

2.6.2

2 release files

2.6.1

2 release files

2.6.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page