LanguageValues and typesStandard typesTax and identity numbers
IdentityDocument
On this page
An identity document: its kind, the country, its number and when it expires.
Use it for identity checks that accept several kinds of document. When you take only one kind, PassportNumber or DrivingLicenceNumber says so.
Shape
| Field | Type | Required? |
|---|---|---|
kind |
IdentityDocumentKind |
Yes |
country |
Country |
Yes |
number |
Text |
Yes |
expires |
CalendarDate |
No |
Write every field when you build one, and give a field that isn't required as none.
Its parts keep these rules, and a value that breaks one fails with the rule's name:
number_of_kind_and_country: number is in the form of its kind of document from its country
Example
IdentityDocument { kind: IdentityDocumentKind.passport country: Country.gb number: "123456789" expires: "2031-05-01"}
Good to know
- The number is checked against the form for that kind from that country.
- Give
expires: nonefor a document with no expiry date. text.formatshows only the last four characters.==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.- A field that holds one counts as personal data (
government_id), so you don't mark it yourself.
In JSON
An object of its parts, in a request, a response or json.write:
{"kind":"passport","country":"GB","number":"123456789","expires":"2030-01-31"}{"kind":"identity_card","country":"DE","number":"L01X00T47","expires":null}
When you read one, a field that isn't required may be left out, or sent as null.
Details
Text form, storage, how it is shown, and operations
IdentityDocument is in the group Tax and identity numbers, and has been in Jadpo since 0.1.0.
Text form
It has no single text form, so text.from and text.parse don't take it.
How it is stored
It is stored in 4 columns, each named for the field, _ and its suffix. This is {"kind":"identity_card","country":"DE","number":"L01X00T47","expires":null}:
| Column | Type | Holds |
|---|---|---|
<field>_kind |
text |
'identity_card' |
<field>_country |
text |
'DE' |
<field>_number |
text |
'L01X00T47' |
<field>_expires |
date |
NULL::date |
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"kind":"passport","country":"GB","number":"123456789","expires":"2030-01-31"} |
•••• 6789 |
{"kind":"identity_card","country":"DE","number":"L01X00T47","expires":null} |
•••• 0T47 |
Operations
It also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-identity-document.md.Built from Jadpo main at aee2e8f.