stdnum.ca.bc_phn

BC PHN (British Columbia Personal Health Number).

A unique, numerical, lifetime identifier used in the specific identification of an individual client or patient who has had any interaction with the British Columbia health system. It is assigned only to and used by one person and will not be assigned to any other person.

The existence of a PHN does not imply eligibility for health care services in BC or provide any indication of an individual’s benefit status.

The PNH is a 10-digit number where the first digit is always 9, and the last digit is a MOD-11 check digit.

More information:

>>> validate('9698 658 215')
'9698658215'
>>> format('9698658215')
'9698 658 215'
>>> validate('9698648215')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('5736504210')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('9736A04212')
Traceback (most recent call last):
    ...
InvalidFormat: ...
stdnum.ca.bc_phn.calc_check_digit(number)

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

stdnum.ca.bc_phn.compact(number)

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

stdnum.ca.bc_phn.format(number)

Reformat the number to the standard presentation format.

stdnum.ca.bc_phn.is_valid(number)

Check if the number is a valid PHN.

stdnum.ca.bc_phn.validate(number)

Check if the number is a valid PHN. This checks the length, formatting and check digit.