UNPKG

1.12 kBMarkdownView Raw
1# NHS Validation
2[![Testing](https://github.com/JoshWalshaw/NHS-Validation/actions/workflows/testing.yaml/badge.svg?branch=main)](https://github.com/JoshWalshaw/NHS-Validation/actions/workflows/testing.yaml)
3
4A package containing several validation tools useful for working with NHS or UK medical data.
5
6
7## NHS Numbers
8This package allows you to validate if a string provided, has the potential to be a valid NHS Number - as well as generate an example NHS compliant number.
9
10NHS numbers follow a slightly modified version of [Modulus 11](https://www.loc.gov/issn/check.html) algorithm. Specific information on the format for the NHS can be found [here](https://en.wikipedia.org/wiki/NHS_number#Format).
11
12Current basic usage is as follows.
13
14```js
15import { NHSNumber } from 'nhs-validation'
16
17const nhsNumber = NHSNumber.generate();
18
19console.log('Is valid? ', NHSNumber.validate(nhsNumber) ); // true
20console.log('Is valid? ', NHSNumber.validate('671 668 9966') ); // true
21console.log('Is valid? ', NHSNumber.validate('000 000 0001') ); // false
22```
23
24## Read / Clinical Codes
25TODO - Coming soon