stdnum.ch.ssn¶
Swiss social security number (“Sozialversicherungsnummer”).
Also known as “Neue AHV Nummer”.
The Swiss Sozialversicherungsnummer is used to identify indivduals for taxation and pension purposes.
The number is validated using EAN-13, though dashes are substitued for dots.
>>> compact('756.9217.0769.85')
'7569217076985'
>>> format('7569217076985')
'756.9217.0769.85'
>>> validate('7569217076985')
'7569217076985'
>>> validate('756.9217.0769.85')
'7569217076985'
>>> validate('756.9217.0769.84')
Traceback (most recent call last):
...
InvalidChecksum: ...
Traceback (most recent call last):
...
InvalidChecksum: ...
-
stdnum.ch.ssn.compact(number)¶ Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.
-
stdnum.ch.ssn.format(number)¶ Reformat the passed number to the standard format.
-
stdnum.ch.ssn.is_valid(number)¶ Checks to see if the number provided is a valid Sozialversicherungsnummer.
-
stdnum.ch.ssn.validate(number)¶ Checks to see if the number provided is a valid Swiss Sozialversicherungsnummer.