Checks a string against the New Zealand Ministry of Health NHI Validation Routine
npm install nhi-validator




Checks a string against the New Zealand Ministry of Health NHI Validation
Routine.
Supports the old and new NHI number formats specified in
HISO 10046:2023.
``sh`
npm install nhi-validator
`js
import {validateNHI} from 'nhi-validator'
validateNHI('WLD9413') // => true
validateNHI('zsc21tn') // => true
validateNHI('zzZ0044') // => false
validateNHI('ZZZ00AA') // => false
`
Checks are case-insensitive.
NHI numbers that begin with Z are reserved for testing.Z
If you wish to exclude these values, you will need to manually check for a
prefix:
`js
import {validateNHI} from 'nhi-validator'
let value = 'zvb97xq'
validateNHI(value) // => true
!value.toUpperCase().startsWith('Z') && validateNHI(value) // => false
``
_nhi-validator_ is available under the MIT License.
Eli Lamb - elilambnz
James Ansley - James-Ansley
- https://www.tewhatuora.govt.nz/publications/hiso-100462023-consumer-health-identity-standard/
- https://www.tewhatuora.govt.nz/our-health-system/digital-health/health-identity/national-health-index/information-for-health-it-vendors-and-developers
Derived from python-nhi written by
James Ansley.
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.
If you're interested in contributing, please read
our contributing docs
before submitting a pull request.