pydentic 0.0.1.dev3
Pydantic Identifiers
License: BSD-3-Clause
Requires Python: >=3.6.1

# Pydentic

**_Pydentic_** is a thin wrapper over _[python-stdnum]_ to facilitate the use
of its extensive collection of validators and formatters in _[Pydantic]_ models.

```
pip install pydentic
```

## Features

Automatic validation and formatting.

```python
from pydentic.strings import Iban
from pydantic import BaseModel

class User(BaseModel):
    name: str
    iban: Iban

user = User(name='John Doe', iban='es1000750080110600658108')
print(user)

#> name='John Doe' iban='ES10 0075 0080 1106 0065 8108'
```

```python
# note the extra last character
user = User(name='John Doe', iban='es1000750080110600658108Ñ')

# raises
...
pydantic.error_wrappers.ValidationError: 1 validation error for User
iban
  es1000750080110600658108Ñ (type=value_error.format; error=invalid literal for int() with base 36: 'Ñ')
```

Title and description in the JSON Schema.
```json
{
  "title": "User",
  "type": "object",
  "properties": {
    "name": {
      "title": "Name",
      "type": "string"
    },
    "iban": {
      "title": "IBAN",
      "description": "International Bank Account Number",
      "type": "string"
    }
  },
  "required": ["user", "iban"]
}
```

The classes `Isan`, `Isbn`, and `Issn` include a `urn` property that, not
surprisingly, returns their URN.

```python
from pydentic.strings import Isbn
from pydantic import BaseModel

class Book(BaseModel):
    author: str
    title: str
    isbn: Isbn

book = Book(author='D. Hofstadter', title='GEB', isbn='978-0-465-02656-2')
print(book.isbn.urn)

#> urn:isbn:9780465026562
```

## Identifiers

The list below contains some available international identifiers. There are
around 200 more identifiers included (see [the python-stdnum docs] for the
complete list.)


| identifier   | spec       | description |
| ------------ | ---------- | ----------- |
| BIC          | [ISO 9362] | [Business Identifier Code][BIC]
| BIC-Code     | ISO 6346   | [International standard for container identification][BIC-Code]
| Bitcoin address |         |
| CAS RN       |            | [Chemical Abstracts Service Registry Number][CASRN]
| CUSIP number |            | [financial security identification number ][CUSIP]
| EAN          |            | [International Article Number][EAN]
| FIGI         | [OMG FIGI] | [Financial Instrument Global Identifier][FIGI]
| GRid         |            | [Global Release Identifier][GRid]
| GS1-128      |            | GS-1 (product information) using [Code 128 barcodes][C128]
| IBAN         | ISO 13616  | [International Bank Account Number][IBAN]
| IMEI         |            | International Mobile Equipment Identity
| IMO number   |            | [International Maritime Organization number][IMO]
| IMSI         |            | [International Mobile Subscriber Identity][IMSI]
| ISAN         | ISO 15706  | [International Standard Audiovisual Number][ISAN]
| ISBN         | ISO 2108   | [International Standard Book Number][ISBN]
| ISIL         | ISO 15511  | [International Standard Identifier for Libraries][ISIL]
| ISIN         | ISO 6166   | International Securities Identification Number
| ISMN         | ISO 10957  | [International Standard Music Number][ISMN] for notated music
| ISSN         | ISO 3297   | [International Standard Serial Number][ISSN]
| LEI          | ISO 17442  | [Legal Entity Identifier][LEI]
| MAC address  |            | Media Access Control address
| MEID         |            | Mobile Equipment Identifier
|              | ISO 11649  | Structured Creditor Reference

[Pydantic]: https://github.com/samuelcolvin/pydantic
[python-stdnum]: https://github.com/arthurdejong/python-stdnum
[the python-stdnum docs]: https://arthurdejong.org/python-stdnum/formats

[BIC]: https://www.swift.com/standards/data-standards/bic-business-identifier-code "(SWIFT) Society for Worldwide Interbank Financial Telecommunication"
[BIC-Code]: https://www.bic-code.org/ "Bureau International des Containers et du Transport Intermodal"
[CASRN]: https://www.cas.org/support/documentation/chemical-substances/faqs "(CAS) Chemical Abstracts Service"
[CUSIP]: https://www.cusip.com/identifiers.html#/CUSIP "CUSIP Global Services"
[C128]: https://en.wikipedia.org/wiki/Code_128
[EAN]: https://www.gs1.org/standards/barcodes/ean-upc "GS1 - EAN/UPC"
[FIGI]: https://www.openfigi.com/ "Open FIGI"
[GRid]: https://www.ifpi.org/resource/grid/ "(IFPI) International Federation of the Phonographic Industry. I've said \"pho-no-gra-phic\""
[IBAN]: https://www.swift.com/standards/data-standards/iban-international-bank-account-number "(SWIFT) Society for Worldwide Interbank Financial Telecommunication"
[IMO]: https://www.imo.org/en/OurWork/MSAS/Pages/IMO-identification-number-scheme.aspx "(IMO) International Maritime Organization"
[IMSI]: https://imsiadmin.com/
[ISAN]: https://www.isan.org/ "ISAN International Agency"
[ISBN]: https://www.isbn-international.org/content/what-isbn "International ISBN Agency"
[ISIL]: https://english.slks.dk/libraries/library-standards/isil/ "Danish Agency for Culture and Palaces (ISIL international authority)"
[ISMN]: https://www.ismn-international.org/ "International ISMN Agency"
[ISSN]: https://portal.issn.org/ "ISSN International Centre"
[LEI]: https://www.gleif.org/en/about-lei/introducing-the-legal-entity-identifier-lei "(GLEIF) Global Legal Entity Identifier Foundation"

<!-- standard specs -->
[ISO 9362]: https://www.iso9362.org/isobic/overview.html
[OMG FIGI]: https://www.omg.org/spec/FIGI/1.0