Skip to main content

A small package to perform checksum validation on NHS numbers.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nhssums-0.1.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

nhssums-0.1.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file nhssums-0.1.2.tar.gz.

File metadata

  • Download URL: nhssums-0.1.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for nhssums-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4ce20206bea41f24c1970561bfda8666fcf4a6cadc6fd9fe0c60afe5a6f702e0
MD5 596a04cf31fa6dff40ae2c4160246cdc
BLAKE2b-256 b0ee80660206764563869d48a6b10f645a8f4b2fb28bd899edc30983259a5d53

See more details on using hashes here.

File details

Details for the file nhssums-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: nhssums-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for nhssums-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1adaa860fa321fb4a34827116e2367f6e55da6a2c76f96b9e458d6b079e40dd4
MD5 3df150623dd87ab81ec0f0cff1fd6501
BLAKE2b-256 074d70af4e8006b509776864d692145d594a321965be6b5fd4d64f62db95e4f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page