Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pfwd/nhsnumber-validation

Example scripts that validate a NHS number written in various langauges
https://github.com/pfwd/nhsnumber-validation

Last synced: 3 days ago
JSON representation

Example scripts that validate a NHS number written in various langauges

Awesome Lists containing this project

README

        

### NHS Number Validation Examples

The NHS Number is 10 digits long. The last digit is the "Check Number" or "Check Digit ". This is used to validate the full NHS Number. A calculation is made on the first 9 digits and its sum is compared against the check digit to see if the NHS Number is correct.

## The calculation

1) Multiply each of the first nine digits by a defined weight. The weight is shown below:

1 - 10

2 - 9

3 - 8

4 - 7

5 - 6

6 - 5

7 - 4

8 - 3

9 - 2

For example if the 2nd digit is 3 then its 3 x 8. If fourth digit is 7 then its 7 x 4

2) Get the sum of the 9 multiplications.

3) Divide this sum by 11 and get the remainder

4) Subtract 11 from the remainder to get the total

5) If the total is 11 then the identifier is 0, otherwise the identifier is the total

6) If the identifier is 10 then the NHS Number is wrong

7) If the identifier equals the check number then the NHS number is correct