stdnum.nl.bsn

BSN (Burgerservicenummer, Dutch national identification number).

The BSN is a unique personal identifier and has been introduced as the successor to the sofinummer. The number consists of up to 9 digits (the leading 0’s are commonly left out) and contains a simple checksum.

More information:

>>> validate('1112.22.333')
'111222333'
>>> validate('1112.52.333')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('1112223334')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format('111222333')
'1112.22.333'
stdnum.nl.bsn.checksum(number)

Calculate the checksum over the number. A valid number should have a checksum of 0.

stdnum.nl.bsn.compact(number)

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

stdnum.nl.bsn.format(number)

Reformat the passed number to the standard presentation format.

stdnum.nl.bsn.is_valid(number)

Check if the number is a valid BSN.

stdnum.nl.bsn.validate(number)

Check if the number is a valid BSN. This checks the length and whether the check digit is correct.