stdnum.cn.ric

RIC No. (Chinese Resident Identity Card Number).

The RIC No. is the unique identifier for issued to China (PRC) residents.

The number consist of 18 digits in four sections. The first 6 digits refers to the resident’s location, followed by 8 digits represeting the resident’s birth day in the form YYYY-MM-DD. The next 3 digits is the order code which is the code used to disambiguate people with the same date of birth and address code. Men are assigned to odd numbers, women assigned to even numbers. The final digit is the checksum.

>>> validate('360426199101010071')
'360426199101010071'
stdnum.cn.ric.calc_check_digit(number)

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

stdnum.cn.ric.compact(number)

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

stdnum.cn.ric.format(number)

Reformat the number to the standard presentation format.

stdnum.cn.ric.get_birth_date(number)

Split the date parts from the number and return the birth date. Note that in some cases it may return the registration date instead of the birth date and it may be a century off.

stdnum.cn.ric.get_birth_place(number)

Use the number to look up the place of birth of the person.

stdnum.cn.ric.is_valid(number)

Check if the number is a valid RIC number.

stdnum.cn.ric.validate(number)

Check if the number is a valid RIC number. This checks the length, formatting and birth date and place.