diff --git a/docs/_assets/_images/done_all.svg b/docs/_assets/_images/done_all.svg new file mode 100644 index 0000000..365da05 --- /dev/null +++ b/docs/_assets/_images/done_all.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/_assets/_images/heroCodeSnippet.png b/docs/_assets/_images/heroCodeSnippet.png new file mode 100644 index 0000000..7edbb50 Binary files /dev/null and b/docs/_assets/_images/heroCodeSnippet.png differ diff --git a/docs/_assets/_snippets/live-usage-warning.md b/docs/_assets/_snippets/live-usage-warning.md new file mode 100644 index 0000000..8130147 --- /dev/null +++ b/docs/_assets/_snippets/live-usage-warning.md @@ -0,0 +1,6 @@ +!!! danger "IMPORTANT: **You should never need to generate an NHS Number for a live system**" + Live NHS, CHI, H&C and IHI numbers are _always_ generated by some kind of central authority or registry, such as the NHS Spine in England, and they are assigned to patients, often at or near birth or at the point of becoming a user of that health system. + + Unless you represent a central health authority, you should not need to generate an NHS Number for a live system. If you are a patient, you should never need to generate an NHS Number for yourself. + + This package is intended for use in testing and development environments where you need to generate NHS Numbers for testing, research purposes, or synthetic data generation. diff --git a/docs/_assets/_snippets/scottish-chi-number.md b/docs/_assets/_snippets/scottish-chi-number.md new file mode 100644 index 0000000..4fcd559 --- /dev/null +++ b/docs/_assets/_snippets/scottish-chi-number.md @@ -0,0 +1,2 @@ +!!! note "Scottish CHI Number validation" + At present, this library does not reliably validate Scottish CHI Numbers. This is because the first 6 digits of a Scottish CHI Number must be a valid DDMMYY Date of Birth, and this library does not currently check for this. At the moment, only the correct number range is checked for. \ No newline at end of file diff --git a/docs/_assets/_stylesheets/extra.css b/docs/_assets/_stylesheets/extra.css new file mode 100644 index 0000000..d555327 --- /dev/null +++ b/docs/_assets/_stylesheets/extra.css @@ -0,0 +1,46 @@ +:root { + --nhs-core-blue: #005EB8; + --nhs-core-white: #FFFFFF; + --md-accent-fg-color: var(--nhs-core-blue); + --md-primary-fg-color--dark: var(--nhs-core-blue); + --md-typeset-a-color: var(--nhs-core-blue); +} + +.md-header__ellipsis .md-ellipsis { + font-size: 1.5rem; +} + +/* nav */ + +/* mobile nav sidebar */ +@media screen and (max-width: 76.1875em) { + .md-nav--primary .md-nav__title[for=__drawer] { + background-color: white; + color: black; + } +} + +[dir=ltr] .md-header__title { + margin-left: 0.1rem; +} + +.md-header__button.md-logo >svg { + height: 2rem; + fill: var(--nhs-core-white) +} + +.md-banner { + display: flex; +} + +.md-banner__inner.md-grid.md-typeset{ + max-height: 1rem; +} + +.md-header, .md-tabs { + background-color: var(--nhs-core-blue); +} + +.md-nav__item .md-nav__link--active { + color: var(--nhs-core-blue); +} diff --git a/docs/changelog.md b/docs/changelog.md index ab82596..eab17c1 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -3,8 +3,15 @@ title: Changelog authors: Dr Marcus Baw --- +## 1.3.4 +- Revert of the new logo, minor edits to the documentation, accepted Anchit PR +- Reverted to plain code rather than Carbon for the code snippets. +- No changes to Python code + ## 1.3.3 +- Aesthetic documentation updates + ## 1.3.2 * GitHub action for CI/CD to publish to live PyPi diff --git a/docs/contributors.md b/docs/contributors.md index a1a5060..179565c 100644 --- a/docs/contributors.md +++ b/docs/contributors.md @@ -5,11 +5,11 @@ authors: Dr Marcus Baw ## Acknowledgements -This package is a collaboration between a number of individuals, groups and teams, who were each separately maintaining some kind of NHS Number Python package. We felt that rather than having several packages with overlapping functionality, it would be better to combine our efforts into a single package. +This package is a collaboration between several individuals, groups and teams, each separately maintaining some NHS Number Python package. Rather than having several packages with overlapping functionality, it was thought that combining efforts into a single package would be better. -The package derives from code written by Andy Law at the Roslin Institute, and in an effort to place it under the aegis of an Organisation on GitHub, it has been adopted by the [Faculty of Clinical Informatics](https://www.facultyofclinicalinformatics.org.uk/), with the collective aim to develop it into the canonical NHS Number package for Python. +The package derives from code written by Andy Law at the Roslin Institute, and to place it under the aegis of an Organisation on GitHub, it has been adopted by the [Faculty of Clinical Informatics](https://www.facultyofclinicalinformatics.org.uk/), with the collective aim to develop it into the canonical NHS Number package for Python. -### Authors and contributors +## Authors and contributors - [Andy Law](https://github.com/andylaw) - author of the PyPi package [nhs-number](https://pypi.org/project/nhs-number/), head of research computing at The Roslin Institute. diff --git a/docs/developing.md b/docs/developing.md index f88d764..707e5f4 100644 --- a/docs/developing.md +++ b/docs/developing.md @@ -1,5 +1,4 @@ --- -title: Developing authors: Dr Marcus Baw --- @@ -11,7 +10,7 @@ authors: Dr Marcus Baw ├── tests/ # Python package tests ├── __init__.py ├── LICENSE # MIT License -├── mkdocs.yml # configuration file for the Material for MkDocs documentation site +├── mkdocs.yml # Configuration file for the Material for MkDocs documentation site ├── netlify.toml # Netlify build file - required for Netlify to build the documentation site ├── pyproject.toml # Poetry configuration file - defines dependencies, etc ├── pytest.ini # pytest configuration file - defines test discovery, etc @@ -21,36 +20,6 @@ authors: Dr Marcus Baw └── setup.cfg ``` -## Useful URLs - -### Github :simple-github: - -`nhs-number` GitHub repo - -### PyPi :simple-pypi: - -`nhs-number` on PyPI -`nhs-number` on **Test** PyPi - -### Netlify :simple-netlify: - - - -### uk-fci.tech domain :material-domain: - -The `uk-fci.tech` domain is managed on NameCheap by @pacharanero - -## Documentation - -The main documentation site is at . Pushes of code to the `main` branch will trigger a publication to Netlify automatically. - -Non-`main` branches of the documentation are automatically published to Netlify for review purposes: - -* `develop` -> -* `staging` -> - -When developing the documentation site, we recommend the use of a linter such as [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) for VSCode to standardise formatting. - ## Testing This project uses `pytest` for testing. The test suite can be run with: @@ -59,18 +28,20 @@ This project uses `pytest` for testing. The test suite can be run with: poetry run pytest ``` -## Building locally + ## Publishing to PyPi +This project uses [Poetry](https://python-poetry.org/docs/) for dependency management and packaging. + +Any edit **MUST** have a new version number otherwise it will be rejected by PyPi. + +To publish a new version to PyPi, update the version number in `pyproject.toml`. + +Also add a note to the `docs/changelog.md` file to explain the updates. + Publication to PyPi is handled by GitHub Actions. The workflows are defined in the `.github/workflows` folder. Pushes of code to the `staging` branch will trigger a publication to Test PyPi. Pushes of code to the `main` branch will trigger a publication to live PyPi. - -## External Documentation References - -* Poetry -* Material for MkDocs -* Netlify available build environments diff --git a/docs/documentation.md b/docs/documentation.md new file mode 100644 index 0000000..86a9899 --- /dev/null +++ b/docs/documentation.md @@ -0,0 +1,18 @@ +--- +authors: Dr Marcus Baw, Dr Anchit Chandran +--- + +The main documentation site is at . Pushes of code to the `main` branch will automatically trigger a publication to Netlify. + +Non-`main` branches of the documentation are automatically published to Netlify for review purposes: + +* `develop` -> +* `staging` -> + +## Material for MkDocs + +We use [MkDocs](https://www.mkdocs.org/) along with the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme. + +You can suggest changes directly through PRs. + +When developing the documentation site, we recommend the use of a linter such as [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) for VSCode to standardise formatting. diff --git a/docs/index.md b/docs/index.md index f7aaaeb..2702d42 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,29 +3,46 @@ ```python >>> import nhs_number -# test a valid number ->>> nhs_number.is_valid('1234567891') +# Validation +>>> nhs_number.is_valid('469 819 4180') True + +# Generation (for testing purposes) +>>> nhs_number.generate(quantity=5, for_region=nhs_number.REGION_ENGLAND) +['6239431915', '7634140872', '4069990771', '4453051670', '4843474045'] + +# Normalisation +>>> nhs_number.normalise_number("406-999-0771") +'4069990771' ``` +
Validation, generation and normalisation of NHS Numbers
+ A Python package to provide utilities for NHS Numbers, including validity checks, normalisation, and generation. -This package is a collaboration between a number of individuals, groups and teams, who were each separately maintaining some kind of NHS Number Python package. See [Contributors](./contributors.md) for more information. +While validating an NHS Number is straightforward to achieve in code, it seems wasteful for developers to implement their own solutions. Further, many developers are likely unaware of the various rules and nuances of NHS/CHI/H&C Numbers across the UK Nations. -While validating an NHS Number is not particularly difficult to achieve in code, it seems wasteful for developers to have to implement their own solutions, and it is likely that many developers will not be aware of the various rules and nuances of NHS/CHI/H&C Numbers across the UK Nations. This package aims to provide a single, well-maintained, and well-documented solution for all developers to use. +This package aims to provide a single, well-maintained, well-documented solution for all developers. + +`nhs-number` is a collaboration between several individuals, groups and teams, each separately maintaining an NHS Number Python package. See [Contributors](./contributors.md) for more information. ## Features -- Validation of NHS Numbers using the check-digit algorithm. -- Normalisation of NHS Numbers from various string formats to a standard 10-digit string format. -- Additional details and information on an NHS number such as the region it is valid for, and the reason it is not valid, if invalid. -- Generation of valid and invalid NHS Numbers for testing purposes, for any selected Region. Note that you should **never** need to generate an NHS Number for a live system (See [Important Note](#important-note) below) +- **Validation** of NHS Numbers using the check-digit algorithm. +- **Generation** of valid and invalid NHS Numbers for testing purposes, for any selected `Region`. +- **Normalisation** of NHS Numbers from various string formats to a standard 10-digit string format. +- Additional details and information on an NHS number, such as the region for which it's valid, and the reason for invalidity, if invalid. + +--8<-- +docs/_assets/_snippets/live-usage-warning.md +--8<-- -!!! warning "Important note about Scottish CHI Number validation" -At present this library does not reliably validate Scottish CHI Numbers. This is because the first 6 digits of a Scottish CHI Number must be a valid DDMMYY Date of Birth, and this library does not currently check for this. At the moment only the correct number range is checked for. +--8<-- +docs/_assets/_snippets/scottish-chi-number.md +--8<-- ## Roadmap -- Additional validation for Scottish CHI numbers to ensure the first 6 digits are a valid DDMMYY Date of Birth. -- Generation of valid Scottish CHI numbers along same rules. +- Additional validation for Scottish CHI numbers to ensure the first 6 digits are a valid `DDMMYY` Date of Birth. +- Generation of valid Scottish CHI numbers along the same rules. - Validation and generation of [IHI Numbers for the Republic of Ireland](ihi-ireland.md), subject to contributors wanting to collaborate on this, and there being a demand for implementation. diff --git a/docs/installation.md b/docs/installation.md index dbb5f96..8682c51 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,10 +1,8 @@ --- -title: nhs-number +title: Install authors: Dr Marcus Baw --- -## Installation - To install using `pip`: ```bash diff --git a/docs/nhs-numbers.md b/docs/nhs-numbers.md index 2342ef5..89c03a1 100644 --- a/docs/nhs-numbers.md +++ b/docs/nhs-numbers.md @@ -5,43 +5,47 @@ authors: Dr Marcus Baw, Matt Stibbs ## What is an NHS Number? -The NHS Number is a single patient identifier used across the NHS. In the various UK Nations it referred to by different terminology and may have different validation rules. +The NHS Number is a single patient identifier used across the NHS. In the various UK Nations, it is referred to by different terminology and may have different validation rules. ### How do I find out my NHS Number? -Identifying individual NHS Numbers is outside the scope of this package, but if you are curious you can find out your NHS number here [NHS website](https://www.nhs.uk/nhs-services/online-services/find-nhs-number/) for patients in England, Wales and the IOM, and here [NHS Scotland](https://www.nhsinform.scot/care-support-and-rights/nhs-services/nhs-number) for patients in Scotland. +Identifying individual NHS Numbers is outside the scope of this package. Still, if you are curious, you can find out your NHS number here [NHS website](https://www.nhs.uk/nhs-services/online-services/find-nhs-number/) for patients in England, Wales and the IOM, and here [NHS Scotland](https://www.nhsinform.scot/care-support-and-rights/nhs-services/nhs-number) for patients in Scotland. -### England, Wales and the Isle of Man 🏴󠁧󠁢󠁥󠁮󠁧󠁿 🏴󠁧󠁢󠁷󠁬󠁳󠁿 🇮🇲 +### England, Wales and the Isle of Man The NHS Number is a single patient identifier used across the NHS in England, Wales, and the Isle of Man. In 2015, the NHS Number was legally mandated to be used as a single patient identifier across health and care with the introduction of the [The Health and Social Care (Safety and Quality) Bill](https://www.digitalhealth.net/2015/10/nhs-number-use-becomes-law/). -The use of the NHS number in health and care organisations in England is specified in an the [Information Standards Board](https://digital.nhs.uk/data-and-information/information-standards) standard [ISB 0149 NHS Number](https://digital.nhs.uk/data-and-information/information-standards/information-standards-and-data-collections-including-extractions/publications-and-notifications/standards-and-collections/isb-0149-nhs-number) (Note that these NHS Digital links, while live at the time of editing this documentation, may at some stage move to NHS England following the merger of those organisations, which is ongoing, in 2023) +The use of the NHS number in health and care organisations in England is specified in the [Information Standards Board](https://digital.nhs.uk/data-and-information/information-standards) standard [ISB 0149 NHS Number](https://digital.nhs.uk/data-and-information/information-standards/information-standards-and-data-collections-including-extractions/publications-and-notifications/standards-and-collections/isb-0149-nhs-number) (Note that these NHS Digital links, while live at the time of editing this documentation, may at some stage move to NHS England following the merger of those organisations, which is ongoing, in 2023) -### Scotland 🏴󠁧󠁢󠁳󠁣󠁴󠁿 +### Scotland -Scotland calls the identifier a Community Health Index (CHI) Number, and it uses a similar standard for check-digit validation. However, the first 6 digits of the number are the date of birth in the format DDMMYY, rather than a sequential number. Following this there is a 3 sequence number. The ninth digit is always even for females and odd for males. +Scotland calls the identifier a Community Health Index (CHI) Number, using a similar standard for check-digit validation. However, the first 6 digits of the number are the date of birth in the format `DDMMYY` rather than a sequential number. Following this, there is a 3-sequence number. -### Northern Ireland 🏴󠁧󠁢󠁮󠁩󠁲󠁿 🇬🇧 +The ninth digit is always even for females and odd for males. -Northern Ireland have similar single patient identifiers, referred to as the Health and Care Number (H&C Number) +### Northern Ireland -### Republic of Ireland 🇮🇪 +Northern Ireland has similar single patient identifiers, referred to as the Health and Care Number (H&C Number). -While the Republic of Ireland is of course its own sovereign state, independent from the UK, using its own Individual Health Identifier (IHI) number, it is included here for completeness because the IHI _internally_ uses the range of identifiers reserved for it as per the table below, and the NHS Number may possibly be used in cross-border care. +### Republic of Ireland -For more detail see [Individual Health Identifier (IHI)](./ihi-ireland.md) +While the Republic of Ireland is its own sovereign state, independent from the UK, using its own Individual Health Identifier (IHI) number, it is included here for completeness because the IHI _internally_ uses the range of identifiers reserved for it as per the table below and the NHS Number may possibly be used in cross-border care. + +For more detail, see [Individual Health Identifier (IHI)](./ihi-ireland.md). ## NHS Number Ranges ### Live NHS Number Ranges -This tables shows how different ranges within the standard number format are distributed across the UK and Ireland. `n` represents a digit 0-9 which is the check digit. +This table shows how different ranges within the standard number format are distributed across the UK and Ireland. + +`n` represents a digit, `0-9`, which is the check digit. |
Range
| Usage | Description | | ------------------------------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| 010000000n - 319999999n | Scotland | Used for Scottish [Community Health Index (CHI)]() numbers, which have historically contained the date of birth as the first 6 digits | +| 010000000n - 319999999n | Scotland | Used for Scottish [Community Health Index (CHI)]() numbers, which have historically contained the date of birth as the first 6 digits. | | 320000000n - 399999999n | Northern Ireland | Used for NI Health and Care Numbers. | | 400000000n - 499999999n | England, Wales, IOM | Used for NHS numbers in England, Wales and the Isle of Man. | | 600000000n - 799999999n | England, Wales, IOM | Used for NHS numbers in England, Wales and the Isle of Man. | @@ -49,7 +53,7 @@ This tables shows how different ranges within the standard number format are dis ### Test/Unallocated Number Ranges -This tables shows the ranges not assigned to live use (e.g. testing, unallocated) +This table shows the ranges not assigned to live use (e.g. testing, unallocated). |
Range
| Usage | Description | | ------------------------------------ | ------- | ------------------------------------------------------------- | @@ -59,7 +63,9 @@ This tables shows the ranges not assigned to live use (e.g. testing, unallocated ## NHS Number Check Digit Validation -NHS Numbers in England, Wales and the Isle of Man are a simple 9-digit number with a check digit. The check digit is calculated using a variation of the [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) (also known as the [Modulus 11 algorithm](https://en.wikipedia.org/wiki/Check_digit#Modulus_11)). This check digit is intended only to make the number somewhat resistant to accidental transcription errors, not to make it cryptographically secure. +NHS Numbers in England, Wales and the Isle of Man are a simple 9-digit number with a check digit. The check digit is calculated using a variation of the [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) (also known as the [Modulus 11 algorithm](https://en.wikipedia.org/wiki/Check_digit#Modulus_11)). + +This check digit is intended to make the number somewhat resistant to accidental transcription errors, not to make it cryptographically secure. ### Information Sources diff --git a/docs/usage.md b/docs/usage.md index 9565422..9618341 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -3,94 +3,131 @@ title: Usage authors: Dr Marcus Baw, Matt Stibbs --- -## Usage +--8<-- +docs/_assets/_snippets/live-usage-warning.md +--8<-- -!!! danger "IMPORTANT: **You should never need to generate an NHS Number for a live system**" - Live NHS, CHI, H&C and IHI numbers are _always_ generated by some kind of central authority or registry, such as the NHS Spine in England, and they are assigned to patients, often at or near birth, or at the point of becoming a user of that health system. +## `is_valid()` - In general unless you are representing a central health authority, you should never need to generate an NHS Number for a live system. If you are a patient, you should never need to generate an NHS Number for yourself. +Returns `True` if the NHS Number is valid. +Returns `False` if the NHS Number is not valid. - This package is intended for use in testing and development environments, where you need to generate NHS Numbers for testing or research purposes, or for use in synthetic data generation. +**Arguments**: -### `is_valid()` - -Returns `True` if the NHS Number is valid, `False` if not. +- `nhs_number` (*required, `str`*): The NHS Number to validate. Valid formats are: + - `123 456 7890` + - `123-456-7890` + - `1234567890` +- `for_region` (*optional, default=None, `Region`*): If provided, additionally validates number is included within the given [`Region`](#regions) range. ```python ->>> import nhs_number +import nhs_number + +nhs_number.is_valid('4698194180') +# True -# test a valid number ->>> nhs_number.is_valid('1234567891') -True +nhs_number.is_valid('1234567890') +# False +``` -# test an invalid number ->>> nhs_number.is_valid('1234567890') -False +The `for_region` parameter takes any of the [`nhs_number.REGION_*`](#regions) constants: -# test whether a number is valid for a specific region -# the for_region parameter can be any of the REGION_* constants (see below) ->>> nhs_number.is_valid('7709030025', for_region=nhs_number.REGION_ENGLAND) -True +```python +nhs_number.is_valid('7709030025', for_region=nhs_number.REGION_ENGLAND) +# True ``` -!!! warning "Important note about Scottish CHI Number validation" - At present this library does not reliably validate Scottish CHI Numbers. This is because the first 6 digits of a Scottish CHI Number must be a valid DDMMYY Date of Birth, and this library does not currently check for this. At the moment only the correct number range is checked for. +--8<-- +docs/_assets/_snippets/scottish-chi-number.md +--8<-- + +## `normalise_number()` + +Returns normalised 10-digit NHS Number without spaces, as a string. -### `normalise_number()` +**Arguments**: + +- `nhs_number` (*required, `str | int`*): The NHS Number `int` or `str` to normalise. ```python ->>> import nhs_number +import nhs_number + +nhs_number.normalise_number('123 456 7891') +# '1234567891' + +nhs_number.normalise_number('1234567891') +# '1234567891' + +nhs_number.normalise_number('123-456-7890') +# '1234567890' +``` + +## `generate()` ->>> nhs_number.normalise_number('123 456 7891') -'1234567891' +Returns list of valid or invalid normalised NHS numbers, as strings, for testing. ->>> nhs_number.normalise_number('1234567891') -'1234567891' +**Arguments**: ->>> nhs_number.normalise_number('123-456-7890') -'1234567890' +- `valid` (*optional, default=True, `bool`*): Determines whether generated numbers are valid or invalid. +- `for_region` (*optional, default=None, `Region`*): If provided, generates numbers within the given [`Region`](#regions) range. +- `quantity` (*optional, default=1, `int`*): Determines number of NHS number strings returned. + +```python +import nhs_number + +nhs_number.generate() +# ['1633104249'] + +nhs_number.generate(quantity=5) +# ['1633104249', '1633104257', '1633104265', '1633104273', '1633104281'] ``` -### `generate()` +The `for_region` parameter takes any of the [`nhs_number.REGION_*`](#regions) constants: ```python +nhs_number.generate(for_region=nhs_number.REGION_ENGLAND) +# ['7709030025'] +``` + +## `NhsNumber` object ->>> import nhs_number +For further details on the NHS number, including further [`Region`](#regions)-specific information, instantiate an `NhsNumber` object using a valid NHS number as a string: -# generate a single valid NHS Number ->>> nhs_number.generate() -['1633104249'] +```python +from nhs_number import NhsNumber -# generate multiple valid NHS Numbers ->>> nhs_number.generate(quantity=5) -['1633104249', '1633104257', '1633104265', '1633104273', '1633104281'] +nhs_number = NhsNumber('9876543210') -# generate a single valid NHS Number for a specific region -# the for_region parameter can be any of the REGION_* constants (see below) ->>> nhs_number.generate(for_region=nhs_number.REGION_ENGLAND) -['7709030025'] +vars(nhs_number) +# {'nhs_number': '9876543210', 'identifier_digits': '987654321', 'check_digit': 0, 'valid': True, 'calculated_checksum': 0, 'region': , 'region_comment': 'Not to be issued (Synthetic/test patients PDS)'} ``` -### Regions +## Regions -You can obtain Region objects via the package's `REGION_*` constants: +You can obtain Region objects via the package's `REGION_*` constants. See [NHS Number Ranges](nhs-numbers.md#nhs-number-ranges) for details on ranges. +Obtain a dictionary of available `Range` objects: ```python ->>> import nhs_number +import nhs_number -# returns a Dict of all Region objects ->>> nhs_number.REGIONS -{'UNALLOCATED': , 'SCOTLAND': , 'NORTHERN_IRELAND': , 'ENGLAND_WALES_IOM': , 'RESERVED': , 'EIRE': , 'SYNTHETIC': } +nhs_number.REGIONS +# {'UNALLOCATED': , 'SCOTLAND': , 'NORTHERN_IRELAND': , 'ENGLAND_WALES_IOM': , 'RESERVED': , 'EIRE': , 'SYNTHETIC': } +``` -# returns a Region object for England ->>> nhs_number.ENGLAND_WALES_IOM - +Get a Region object for England: +```python +nhs_number.ENGLAND_WALES_IOM +# +``` -# each Region has some aliases for ease of use ->>> nhs_number.ENGLAND_WALES_IOM == nhs_number.REGION_ENGLAND -True +Each Region has some aliases for ease of use: +```python +nhs_number.ENGLAND_WALES_IOM == nhs_number.REGION_ENGLAND +# True ``` -!!! warning "Important note about Scottish CHI Number Generation" - At present this library does not reliably generate valid Scottish CHI Numbers. This is because the first 6 digits of a Scottish CHI Number amust be a valid DDMMYY Date of Birth, and this library does not currently check for this. +--8<-- +docs/_assets/_snippets/scottish-chi-number.md +--8<-- + diff --git a/docs/useful_urls.md b/docs/useful_urls.md new file mode 100644 index 0000000..815a51e --- /dev/null +++ b/docs/useful_urls.md @@ -0,0 +1,20 @@ +--- +authors: Dr Marcus Baw, Dr Anchit Chandran +--- + +## :simple-github: Github + +- `nhs-number` GitHub repo + +## :simple-pypi: PyPi + +- `nhs-number` on PyPI +- `nhs-number` on **Test** PyPi + +## :simple-netlify: Netlify + +- + +## :material-domain: uk-fci.tech domain + +- The `uk-fci.tech` domain is managed on NameCheap by @pacharanero diff --git a/mkdocs.yml b/mkdocs.yml index b410eb7..727d93e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -8,12 +8,17 @@ copyright: Copyright © 2021-2023 Andy Law, The University of Edinburgh, and # explicitly defines the Nav so we can set order of pages other than default alphabetical nav: - - Introduction: "index.md" - - About NHS Numbers: "nhs-numbers.md" - - Installation: "installation.md" - - Usage: "usage.md" + - Introduction: + - "index.md" + - About NHS Numbers: "nhs-numbers.md" + - Getting Started: + - Installation: "installation.md" + - Usage: "usage.md" + - Developer Guide: + - Project Structure: "developing.md" + - Documentation: 'documentation.md' + - Useful URLs: "useful_urls.md" - Contributors: "contributors.md" - - Developing: "developing.md" - Changelog: "changelog.md" # footer links and variables @@ -29,13 +34,28 @@ theme: name: material icon: logo: material/check-all + favicon: _assets/_images/done_all.svg + custom_dir: 'overrides' features: - content.action.edit # explicitly adds edit button (Material4MkDocs9.0) - content.action.view # explicitly adds view button (Material4MkDocs9.0) - content.code.copy - content.code.select - content.code.annotate - - navigation.footer + - navigation.expand + - navigation.footer # explicitly adds footer prev/next (Material4MkDocs9.0) + - navigation.instant + - navigation.tabs + - navigation.tabs.sticky + - navigation.top + - navigation.tracking + - toc.follow + +watch: + - overrides + +extra_css: + - _assets/_stylesheets/extra.css # markdown additional features markdown_extensions: @@ -51,5 +71,8 @@ markdown_extensions: line_spans: __span pygments_lang_class: true - pymdownx.inlinehilite - - pymdownx.snippets - pymdownx.superfences + - pymdownx.snippets: + check_paths: true + - toc: + permalink: false diff --git a/overrides/main.html b/overrides/main.html new file mode 100644 index 0000000..c27fe4a --- /dev/null +++ b/overrides/main.html @@ -0,0 +1,7 @@ +{% extends "base.html" %} + + +{% block styles %} + +{{ super() }} +{% endblock %} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 5e57031..fe6dc65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nhs-number" -version = "1.3.3" +version = "1.3.4" description = "Python package to provide utilities for NHS Numbers, including validity checks, normalisation, and generation." authors = [ "Andy Law ",