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')

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

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

Reformat the number to the standard presentation format.

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.

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

Check if the number is a valid RIC number.

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