Skip to main content

Library that helps working with different identifier types.

Project description

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

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

identifier-tools-2.7.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

identifier_tools-2.7.0-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file identifier-tools-2.7.0.tar.gz.

File metadata

  • Download URL: identifier-tools-2.7.0.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for identifier-tools-2.7.0.tar.gz
Algorithm Hash digest
SHA256 14333711a30e424413e6a51ef811e561e681e0f4baba41e1a3c2e2125cb1ddd3
MD5 76c8d69ae5d70a43b6df5a901624166e
BLAKE2b-256 87741b659035bc2a4b51c75ad6d2ec2607680d5553c4f47b60563116e3a34e79

See more details on using hashes here.

File details

Details for the file identifier_tools-2.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for identifier_tools-2.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70b18adc85a92977ab0bad3faf1a34eb2ee46ec17a80468e87e44a0a6ce42858
MD5 acc8dcada2e539d6e6da37b711a79604
BLAKE2b-256 01617a096baba55257417065f2976e2df6febfe85a6438ed5a68945baffb65d6

See more details on using hashes here.

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