Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/README
blob: e430706866b28ecbfbbd55af16e184c2e3cfaf4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
python-stdnum
=============

A Python module to parse, validate and reformat standard numbers and codes
in different formats. It contains a large collection of number formats.

Basically any number or code that has some validation mechanism available
or some common formatting is eligible for inclusion in this library.

https://arthurdejong.org/python-stdnum/


Available formats
-----------------

Currently this package supports the following formats:

 * NIPT (Numri i Identifikimit për Personin e Tatueshëm, Albanian VAT number)
 * CBU (Clave Bancaria Uniforme, Argentine bank account number)
 * CUIT (Código Único de Identificación Tributaria, Argentinian tax number)
 * Austrian Company Register Numbers
 * UID (Umsatzsteuer-Identifikationsnummer, Austrian VAT number)
 * ABN (Australian Business Number)
 * ACN (Australian Company Number)
 * TFN (Australian Tax File Number)
 * BTW, TVA, NWSt, ondernemingsnummer (Belgian enterprise number)
 * EGN (ЕГН, Единен граждански номер, Bulgarian personal identity codes)
 * PNF (ЛНЧ, Личен номер на чужденец, Bulgarian number of a foreigner)
 * VAT (Идентификационен номер по ДДС, Bulgarian VAT number)
 * BIC (ISO 9362 Business identifier codes)
 * CNPJ (Cadastro Nacional da Pessoa Jurídica, Brazillian company identifier)
 * CPF (Cadastro de Pessoas Físicas, Brazillian national identifier)
 * BN (Canadian Business Number)
 * SIN (Canadian Social Insurance Number)
 * CAS RN (Chemical Abstracts Service Registry Number)
 * Swiss social security number ("Sozialversicherungsnummer")
 * UID (Unternehmens-Identifikationsnummer, Swiss business identifier)
 * VAT, MWST, TVA, IVA, TPV (Mehrwertsteuernummer, the Swiss VAT number)
 * RUT (Rol Único Tributario, Chilean national tax number)
 * RIC No. (Chinese Resident Identity Card Number)
 * NIT (Número De Identificación Tributaria, Colombian identity code)
 * CUSIP number (financial security identification number)
 * Αριθμός Εγγραφής Φ.Π.Α. (Cypriot VAT number)
 * DIČ (Daňové identifikační číslo, Czech VAT number)
 * RČ (Rodné číslo, the Czech birth number)
 * IdNr (Steuerliche Identifikationsnummer, German personal tax number)
 * Ust ID Nr. (Umsatzsteur Identifikationnummer, German VAT number)
 * Wertpapierkennnummer (German securities identification code)
 * CPR (personnummer, the Danish citizen number)
 * CVR (Momsregistreringsnummer, Danish VAT number)
 * Cedula (Dominican Republic national identification number)
 * NCF (Números de Comprobante Fiscal, Dominican Republic receipt number)
 * RNC (Registro Nacional del Contribuyente, Dominican Republic tax number)
 * EAN (International Article Number)
 * CI (Cédula de identidad, Ecuadorian personal identity code)
 * RUC (Registro Único de Contribuyentes, Ecuadorian company tax number)
 * Isikukood (Estonian Personcal ID number)
 * KMKR (Käibemaksukohuslase, Estonian VAT number)
 * Registrikood (Estonian organisation registration code)
 * CCC (Código Cuenta Corriente, Spanish Bank Account Code)
 * CIF (Certificado de Identificación Fiscal, Spanish company tax number)
 * CUPS (Código Unificado de Punto de Suministro, Supply Point Unified Code)
 * DNI (Documento nacional de identidad, Spanish personal identity codes)
 * Spanish IBAN (International Bank Account Number)
 * NIE (Número de Identificación de Extranjeros, Spanish foreigner number)
 * NIF (Número de Identificación Fiscal, Spanish VAT number)
 * Referencia Catastral (Spanish real estate property id)
 * SEPA Identifier of the Creditor (AT-02)
 * Euro banknote serial numbers
 * EIC (European Energy Identification Code)
 * NACE (classification for businesses in the European Union)
 * VAT (European Union VAT number)
 * ALV nro (Arvonlisäveronumero, Finnish VAT number)
 * Finnish Association Identifier
 * HETU (Henkilötunnus, Finnish personal identity code)
 * Veronumero (Finnish individual tax number)
 * Y-tunnus (Finnish business identifier)
 * NIF (Numéro d'Immatriculation Fiscale, French tax identification number)
 * NIR (French personal identification number)
 * SIREN (a French company identification number)
 * SIRET (a French company establishment identification number)
 * n° TVA (taxe sur la valeur ajoutée, French VAT number)
 * NHS (United Kingdom National Health Service patient identifier)
 * SEDOL number (Stock Exchange Daily Official List number)
 * UPN (English Unique Pupil Number)
 * VAT (United Kingdom (and Isle of Man) VAT registration number)
 * FPA, ΦΠΑ, ΑΦΜ (Αριθμός Φορολογικού Μητρώου, the Greek VAT number)
 * GRid (Global Release Identifier)
 * OIB (Osobni identifikacijski broj, Croatian identification number)
 * ANUM (Közösségi adószám, Hungarian VAT number)
 * IBAN (International Bank Account Number)
 * PPS No (Personal Public Service Number, Irish personal number)
 * VAT (Irish tax reference number)
 * IMEI (International Mobile Equipment Identity)
 * IMO number (International Maritime Organization number)
 * IMSI (International Mobile Subscriber Identity)
 * Aadhaar (Indian digital resident personal identity number)
 * PAN (Permanent Account Number, Indian income tax identifier)
 * Kennitala (Icelandic personal and organisation identity code)
 * VSK number (Virðisaukaskattsnúmer, Icelandic VAT number)
 * ISAN (International Standard Audiovisual Number)
 * ISBN (International Standard Book Number)
 * ISIL (International Standard Identifier for Libraries)
 * ISIN (International Securities Identification Number)
 * ISMN (International Standard Music Number)
 * ISO 6346 (International standard for container identification)
 * ISSN (International Standard Serial Number)
 * Codice Fiscale (Italian tax code for individuals)
 * Partita IVA (Italian VAT number)
 * LEI (Legal Entity Identifier)
 * PVM (Pridėtinės vertės mokestis mokėtojo kodas, Lithuanian VAT number)
 * TVA (taxe sur la valeur ajoutée, Luxembourgian VAT number)
 * PVN (Pievienotās vērtības nodokļa, Latvian VAT number)
 * n° TVA (taxe sur la valeur ajoutée, Monacan VAT number)
 * MEID (Mobile Equipment Identifier)
 * VAT (Maltese VAT number)
 * RFC (Registro Federal de Contribuyentes, Mexican tax number)
 * NRIC No. (Malaysian National Registration Identity Card Number)
 * Brin number (Dutch number for schools)
 * BSN (Burgerservicenummer, Dutch national identification number)
 * BTW-nummer (Omzetbelastingnummer, the Dutch VAT number)
 * Onderwijsnummer (Dutch student school number)
 * Postcode (Dutch postal code)
 * MVA (Merverdiavgift, Norwegian VAT number)
 * Orgnr (Organisasjonsnummer, Norwegian organisation number)
 * NIP (Numer Identyfikacji Podatkowej, Polish VAT number)
 * PESEL (Polish national identification number)
 * REGON (Rejestr Gospodarki Narodowej, Polish register of economic units)
 * NIF (Número de identificação fiscal, Portuguese VAT number)
 * CF (Cod de înregistrare în scopuri de TVA, Romanian VAT number)
 * CNP (Cod Numeric Personal, Romanian Numerical Personal Code)
 * PIB (Poreski Identifikacioni Broj, Serbian tax identification number)
 * ИНН (Идентификационный номер налогоплательщика, Russian tax identifier)
 * Orgnr (Organisationsnummer, Swedish company number)
 * VAT (Moms, Mervärdesskatt, Swedish VAT number)
 * ID za DDV (Davčna številka, Slovenian VAT number)
 * IČ DPH (IČ pre daň z pridanej hodnoty, Slovak VAT number)
 * RČ (Rodné číslo, the Slovak birth number)
 * COE (Codice operatore economico, San Marino national tax number)
 * T.C. Kimlik No. (Turkish personal identification number)
 * ATIN (U.S. Adoption Taxpayer Identification Number)
 * EIN (U.S. Employer Identification Number)
 * ITIN (U.S. Individual Taxpayer Identification Number)
 * PTIN (U.S. Preparer Tax Identification Number)
 * RTN (Routing transport number)
 * SSN (U.S. Social Security Number)
 * TIN (U.S. Taxpayer Identification Number)

Furthermore a number of generic check digit algorithms are available:

 * the Verhoeff algorithm
 * the Damm algorithm
 * the Luhn and Luhn mod N algorithms
 * some algorithms described in ISO/IEC 7064: Mod 11, 2, Mod 37, 2,
   Mod 97, 10, Mod 11, 10 and Mod 37, 36

Basically any number or code that has some validation mechanism available
or some common formatting is eligible for inclusion into this library.

These modules generally do not provide background information on the meaning
and use of the specified numbers, only parsing and handling functions.

Interface
---------

All modules implement a common interface. For example for ISBN validation:

    >>> from stdnum import isbn
    >>> isbn.validate('978-9024538270')
    '9789024538270'
    >>> isbn.validate('978-9024538271')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...

Most of these modules implement the following functions:

 * `validate()`
    validate the correctness of the passed number and return a compact
    representation of the number invalid numbers are rejected with one of the
    exceptions from the stdnum.exceptions module
 * `compact()`
   return a compact representation of the number or code this function
   generally does not do validation but may raise exceptions for wildly
   incorrect numbers
 * `format()`
   return a formatted version of the number in the preferred format this
   function generally expects to be passed a valid number or code

Apart from the above, the module may add extra parsing, validation or
conversion functions.

Requirements
------------

The modules should not require any external Python modules and should be pure
Python. The modules are developed and tested with Python 2.7 and 3.6 but may
also work with older versions of Python.

Copyright
---------

Copyright (C) 2010-2018 Arthur de Jong and others

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA

Feedback and bug reports
------------------------

If you have any questions regarding python-stdnum, would like to report a bug
or request addition of a format please send an email to
  <python-stdnum-users@lists.arthurdejong.org>
Patches and code contributions are more than welcome.