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:2023.
Install
pip install python-nhi
Usage
from nhi import is_nhi
print(is_nhi("WLD9413")) # True
print(is_nhi("zsc21tn")) # 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:2023 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 = "zvb97xq"
print(is_nhi(value)) # True
print(not value.upper().startswith("Z") and is_nhi(value)) # False
Note: This check 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
File details
Details for the file python-nhi-1.2.0.tar.gz
.
File metadata
- Download URL: python-nhi-1.2.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afbf5fa1fefd26308bc814bc148cef25cfdcea9c1ab1e1793602cf01684e7736 |
|
MD5 | 54146de55f17ae0ad3b3a629a0dcf0f9 |
|
BLAKE2b-256 | 7284c4d9ab6ac0c4dc38540a962a06b32d0e01194050aeba47acf1202d644c73 |
File details
Details for the file python_nhi-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: python_nhi-1.2.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbf1df74f720564ba07ebe8c1ed4264bf33a585616add1f3edbf3c56c544b326 |
|
MD5 | e13cff7571ef073924b148d5430a1d55 |
|
BLAKE2b-256 | 9718a95246c3344b69f04becf2c5e56073b929866c4d32f24a6e4cfb0ea359ac |