Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/pfwd/nhsnumber-validation
- Owner: pfwd
- Created: 2011-08-22T23:02:33.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2020-02-21T14:41:43.000Z (over 4 years ago)
- Last Synced: 2023-10-20T22:19:24.516Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 256 KB
- Stars: 12
- Watchers: 7
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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