MyNixOS website logo
Description

Tools for Working with NHS Number Checksums.

Provides functions for working with NHS number checksums. The UK's National Health Service issues NHS numbers to all users of its services and this package implements functions for verifying that the numbers are valid according to the checksum scheme the NHS use. Numbers can be validated and checksums created.

nhsnumber

CRAN status R-CMD-check codecov Lifecycle: stable

The goal of nhsnumber is to provide some simple functions for working with NHS numbers in R.

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.

Installation

You can install the released version of nhsnumber from CRAN with:

install.packages("nhsnumber")

You can install the development version of nhsnumber from GitHub with:

devtools::install_github("sellorm/nhsnumber")

Example

The is_valid function takes a vector of NHS numbers and returns TRUE or FALSE depending on whether the checksum is successfully validated.

x <- c(9876543210, 1234567890, 1234567881)
nhsnumber::is_valid(x)

Which returns:

TRUE FALSE  TRUE

It's also possible to generate the checksums using the get_checksum function. This function uses the 9 core digits and returns either the checksum on its own, or the full 10 digit number.

nhsnumber::get_checksum(123456788)

which returns:

1

or with the full output:

nhsnumber::get_checksum(123456788, full_output = TRUE)

Which returns:

1234567881

Some number combinations are invalid and these will throw an error, for example:

nhsnumber::get_checksum(123456789)

Which results in this:

Error in nhsnumber::get_checksum(123456789) : Input sequence is invalid
           Checksum was 10 which is not permissable
Metadata

Version

0.1.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows