A function to check strings against the New Zealand Ministry of Health NHI Validation Routine
Project description
Python-NHI
A function to check strings against the New Zealand Ministry of Health NHI Validation Routine. Supports the old and new NHI number formats specified in HISO 10046:2022.
Install
pip install python-nhi
Usage
from nhi import is_nhi
print(is_nhi("WLD9413")) # True
print(is_nhi("aDh48zj")) # True
print(is_nhi("zzZ0044")) # False
print(is_nhi("ZZZ00AA")) # False
Checks are case-insensitive.
Note: This does not check that the NHI number has been assigned to a person, it merely checks the NHI is consistent with the HISO 10046:2022 standard.
Excluding Testcases
NHI numbers that begin with Z
are reserved for testing.
If you wish to exclude these values, you will need to manually check for a Z
prefix:
from nhi import is_nhi
value = "zBc42dq"
print(is_nhi(value)) # True
print(not value.upper().startswith("Z") and is_nhi(value)) # False
Note: This does not mean that the NHI number has been assigned to a person, it just means that the NHI value is not reserved for testing.
See Also
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_nhi-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4c29cce20ae8da78360010886eba99b31d999b18575841bd75040d50de285cc |
|
MD5 | 3de96b66797d5882e60c1bdfbf3524dd |
|
BLAKE2b-256 | ae8d943472e0acdc9294283381affc7350986719285148b83a9174f2be184224 |