Skip to main content

A function to check strings against the New Zealand Ministry of Health NHI Validation Routine

Project description

NHI

Repository License PyPi

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

For the other versions of this library, see:

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.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_nhi-1.2.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file python_nhi-1.2.2.tar.gz.

File metadata

  • Download URL: python_nhi-1.2.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for python_nhi-1.2.2.tar.gz
Algorithm Hash digest
SHA256 b1ab6ad261667306a0fe2e8a9fb5eb513c30c2a862678afcf1d8a24777f2243a
MD5 b59f209b0b8a87157e771fac8aa5bf43
BLAKE2b-256 3d80eea192b6f87d4aa9076e9d2432daa3c8761b8fec4bc61c467fc9efeb9db9

See more details on using hashes here.

File details

Details for the file python_nhi-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: python_nhi-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for python_nhi-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 def62c258328430da4806c1889b92f96b606611d89061eabf7991d8ae26a2bb8
MD5 83d9dcb342fb44a58f8a906f73a0e2f6
BLAKE2b-256 8f407ddbc6f570c5842b058d7ae3b88efc191efbb4d9709ca071bb1284803182

See more details on using hashes here.

Supported by

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