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 representing 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: str) str

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

stdnum.cn.ric.compact(number: str) str

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

stdnum.cn.ric.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.cn.ric.get_birth_date(number: str) date

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: str) dict[str, str]

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

stdnum.cn.ric.is_valid(number: str) bool

Check if the number is a valid RIC number.

stdnum.cn.ric.validate(number: str) str

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