Skip to main content

nhssums

lifecycle: experimental

The nhssums package provides functions for working with NHS number checksums.

NHS Number Overview

NHS numbers are issued to patients of the NHS in the UK.

The number consists of 9 digits and a single digit checksum.

For more information, please see the NHS number Wikipedia article on the subject.

Instalation

To install the published version of the package from PyPI:

python3 -m pip install nhssums

Usage

Use is_valid() to iterate over a list of numbers:

>>> nhssums = [1234567881, 1234567806, 123456876, 1234512343]
>>> nhssums.is_valid(nhs_numbers)
[True, True, False, True]

To check if the checksum is valid for a single number, use is_number_valid():

>>> import nhssums
>>> nhssums.is_number_valid(1234567881)
True
>>> nhssums.is_number_valid(1234567882)
False

Finally, generate_checksum() will return a valid checksum, for a given input number. It can also return the full number (input + checksum) if required:

>>> nhssums.generate_checksum(123451234)
3
>>> nhssums.generate_checksum(123451234, full_output = True)
1234512343

License

This package is released under an MIT license.

Metadata

Release files for nhssums 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nhssums 0.1.2
File Size Uploaded
nhssums-0.1.2.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nhssums 0.1.2
File Interpreter ABI Platform
nhssums-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / nhssums-0.1.2.tar.gz

Download URL nhssums-0.1.2.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4ce20206bea41f24c1970561bfda8666fcf4a6cadc6fd9fe0c60afe5a6f702e0
BLAKE2b-256 checksum
How to use checksums
b0ee80660206764563869d48a6b10f645a8f4b2fb28bd899edc30983259a5d53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.9

Release files / nhssums-0.1.2-py3-none-any.whl

Download URL nhssums-0.1.2-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1adaa860fa321fb4a34827116e2367f6e55da6a2c76f96b9e458d6b079e40dd4
BLAKE2b-256 checksum
How to use checksums
074d70af4e8006b509776864d692145d594a321965be6b5fd4d64f62db95e4f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.9

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page