Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

NHI validator in Pkl

License

NotificationsYou must be signed in to change notification settings

James-Ansley/pkl-nhi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A function to check strings against the New Zealand Ministry of Health NHIValidation Routine.Supports the old and new NHI number formats specified inHISO 10046:2023.

Install

Add the following to your PklProject:

dependencies {  ["nhi"] {uri ="package://pkg.pkl-lang.org/github.com/James-Ansley/pkl-nhi/nhi@0.0.2"  }}

Usage

Use thenhi.isValid function:

import"@nhi/nhi.pkl"typealiasNhi =String(nhi.isValid(this))myOtherValidNhi:Nhi="ZAC5361"// worksmyOtherInvalidNhi:Nhi="ZZZ0044"// fails

Checks are case-insensitive.

Note: This does not check that the NHI number has beenassigned toa person, it merely checks the NHI is consistent with the HISO 10046:2023standard.

Excluding Testcases

NHI numbers that begin withZ are reserved for testing.If you wish to exclude these values, you will need to manually check for aZprefix:

import"@nhi/nhi.pkl"typealiasNhi =String(nhi.isValid(this),!startsWith("Z"),!startsWith("z"))myNhi1:Nhi="ABC12AY"// worksmyNhi2:Nhi="ZAC5361"// fails

Note: This check does not mean that the NHI number has beenassigned toa person, it just means that the NHI value is not reserved for testing.

See Also


[8]ページ先頭

©2009-2025 Movatter.jp