Crates.io | nhs-number-cli |
lib.rs | nhs-number-cli |
version | 0.1.1 |
source | src |
created_at | 2025-05-09 18:09:35.082108+00 |
updated_at | 2025-05-12 09:44:56.963848+00 |
description | National Health Service (NHS) number for NHS England, NHS Wales, NHS Isle of Man. |
homepage | |
repository | https://github.com/GIG-Cymru-NHS-Wales/nhs-number-cli-using-rust/ |
max_upload_size | |
id | 1667452 |
size | 10,941 |
A National Health Service (NHS) Number is a unique number allocated in a shared numbering scheme to registered users of the three public health services in England, Wales, and the Isle of Man.
This tool is a command line interface that parses each standard input line into an NHS number, then validates the check digit is correct.
If the line is a valid NHS number, then print it.
If the line is an invalid NHS Number, or is unparseable, then print an error message.
If the line is blank, then skip it.
References:
Suppose you have a text file input.txt
that contains one NNS Number per line,
and some may be valid or invalid:
999 123 4560
999 123 4561
If you use Linux or macOS, then here's how to parse each line and validate it:
cat input.txt | nhs-number-cli
If you use Windows, then here's how to parse each line and validate it:
type input.txt | nhs-number-cli.exe
The commmand prints the valid NHS Number to stdout:
999 123 4560
The commmand prints the invalid NHS Number to stderr:
Error invalid line 1. Error: validate check digit failed. NHS Number: 999 123 4561
You can build a release for your own platform:
cargo build --release
You can download a prebuilt release for Windows:
We aim to add more prebuilt releases soon.