stdnum.jp.in

IN (個人番号, kojin bangō, Japanese Individual Number).

The Japanese Individual Number (個人番号, kojin bangō), often referred to as My number (マイナンバー, mai nambā), is assigned to identify citizens and residents. The number consists of 12 digits where the last digit is a check digit. No personal information (such as name, gender, date of birth, etc.) is encoded in the number.

More information:

>>> validate('6214 9832 0257')
'621498320257'
>>> validate('6214 9832 0258')
Traceback (most recent call last):
  ...
InvalidChecksum: ...
>>> validate('6214 9832 025X')
Traceback (most recent call last):
  ...
InvalidFormat: ...
>>> format('621498320257')
'6214 9832 0257'
stdnum.jp.in_.calc_check_digit(number: str) str

Calculate the check digit. The number passed should not have the check digit included.

stdnum.jp.in_.compact(number: str) str

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.jp.in_.format(number: str) str

Reformat the number to the presentation format found on My Number Cards.

stdnum.jp.in_.is_valid(number: str) bool

Check if the number is a valid IN.

stdnum.jp.in_.validate(number: str) str

Check if the number is valid. This checks the length and check digit.