The NHSNumberValidator is an open source project that validates a given number against the rules used to identify valid NHS numbers.
A NHS Number is a unique ten digit number which is given to all registered patients in England and Wales. It is used to identify a patent and their records. The NHS Number is used by local GP’s and Hospitals. Usually the NHS Number can be found on letters sent from your doctor.
The NHS number is ten digits in length. It is shown on letters in the following format xxx-xxx-xxxx. The first nine digits are the identifier and the tenth number is the check digit which is used to check the validity of the identifier. The check digit is calculated using the Modules 11 algorithm.
The NHSNumberValidator uses the standard method of validating the a NHS number. Please see the page xxx for the validation method
The University of Nottingham has created an open source program called OpenPseudonymiser. The program incorporates the C# flavor of the NHSNumberValidator to validate NHS numbers. It is used within (but not limited too) NHS clinical computer systems to pseudonymise datasets by creating a digest of one or more columns of a CSV file. More information can be found on the OpenPseudonymiser website
Currently there are two flavors of the NHSNumberValidator that can be used. One is written in PHP and the other is in C#. Both work in a similar fashion and give the same results. They are just written in different languages.
The source code is on GitHub and can be found at https://github.com/pfwd/NHSNumber-Validation