stdnum.pk.cnic

CNIC number (Pakistani Computerised National Identity Card number).

The CNIC (Computerised National Identity Card, قومی شناختی کارڈ) or SNIC (Smart National Identity Card) is issued by by Pakistan’s NADRA (National Database and Registration Authority) to citizens of 18 years or older.

The number consists of 13 digits and encodes the person’s locality (5 digits), followed by 7 digit serial number an a single digit indicating gender.

More Information:

>>> validate('34201-0891231-8')
'3420108912318'
>>> validate('42201-0397640-8')
'4220103976408'
>>> get_gender('42201-0397640-8')
'F'
>>> get_province('42201-0397640-8')
'Sindh'
>>> format('3420108912318')
'34201-0891231-8'
stdnum.pk.cnic.compact(number)

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

stdnum.pk.cnic.format(number)

Reformat the number to the standard presentation format.

stdnum.pk.cnic.get_gender(number)

Get the person’s birth gender (‘M’ or ‘F’).

stdnum.pk.cnic.get_province(number)

Get the person’s birth gender (‘M’ or ‘F’).

stdnum.pk.cnic.is_valid(number)

Check if the number is a valid CNIC.

stdnum.pk.cnic.validate(number)

Check if the number is a valid CNIC. This checks the length, formatting and some digits.