Skip to main content

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

python-nhi-1.2.0.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

python_nhi-1.2.0-py3-none-any.whl (4.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page