nhi-validator
v2.1.2
Published
Checks a string against the New Zealand Ministry of Health NHI Validation Routine
Readme
nhi-validator
Checks a string against the New Zealand Ministry of Health NHI Validation Routine.
Getting Started
npm install nhi-validatorimport { validateNHI } from 'nhi-validator'
validateNHI('WLD9413') // => true
validateNHI('zsc21tn') // => true
validateNHI('zzZ0044') // => false
validateNHI('ZZZ00AA') // => falseChecks are case-insensitive.
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:
import { validateNHI } from 'nhi-validator'
let value = 'zvb97xq'
validateNHI(value) // => true
!value.toUpperCase().startsWith('Z') && validateNHI(value) // => falseLicense
nhi-validator is available under the MIT License.
Maintainers
Eli Lamb - elilambnz
James Ansley - James-Ansley (GitHub) / jamesansley (Codeberg)
See Also
- https://www.tewhatuora.govt.nz/health-services-and-programmes/digital-health/data-and-digital-standards/health-information-standards-organisation-hiso#hiso-documents
- https://www.tewhatuora.govt.nz/health-services-and-programmes/health-identity/national-health-index/upcoming-changes-nhi
Acknowledgments
- Elixir, JavaScript, PKL, Python, and Rust packages for New Zealand Ministry of Health NHI Validation (HISO 10046:2025) - jamesansley/nhi
Disclaimer
This repository contains NHI numbers provided in examples and tests, however, no identification with actual persons (living or deceased) is intended. If you believe that an NHI number that belongs to a real person has been included in this repository, please get in contact to remove it.
Contributing
If you're interested in contributing, please read our contributing docs before submitting a pull request.
