{"id":23421247,"url":"https://github.com/nhsdigital/nrlf-converter","last_synced_at":"2025-10-19T11:11:55.989Z","repository":{"id":163980834,"uuid":"639376293","full_name":"NHSDigital/nrlf-converter","owner":"NHSDigital","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-21T11:40:37.000Z","size":152,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-05-21T16:21:51.678Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NHSDigital.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-11T10:51:18.000Z","updated_at":"2024-05-21T16:21:51.678Z","dependencies_parsed_at":null,"dependency_job_id":"dc958af5-86c1-4cb6-9863-2478d980882b","html_url":"https://github.com/NHSDigital/nrlf-converter","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fnrlf-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fnrlf-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fnrlf-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Fnrlf-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NHSDigital","download_url":"https://codeload.github.com/NHSDigital/nrlf-converter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248016489,"owners_count":21033983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-23T02:14:33.869Z","updated_at":"2025-10-19T11:11:50.952Z","avatar_url":"https://github.com/NHSDigital.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NRL to R4 Conversion\n\nConverts the core NRL event to a valid FHIR R4 DocumentReference\n\n- [For users](#for-users)\n  - [Installation](#installation-into-spineii)\n  - [Usage](#usage)\n- [For developers](#for-developers)\n  - [In General](#in-general)\n  - [First time setup](#first-time-setup)\n  - [Every time you start a new session](#every-time-you-start-a-new-session)\n  - [Workflow](#workflow)\n  - [Workflow gory details](#workflow-gory-details)\n  - [Tests](#tests)\n    - [Unit](#unit)\n\n# For Users of this package\n\n## Installation into spineii\n\nhttps://nhsd-confluence.digital.nhs.uk/display/SPINE/Import+the+NRLF+R4+Converter+Package+into+Spine\n\n## Usage\n\nYou give it an \"NRL Document Reference\" (here we describe as a `document_pointer`) and\nyou get back an \"R4 DocumentReference\" (here we described as a `document_reference`).\n\nBoth input and output are `dict` objects. You must also supply an NHS Number, expected\nto be consistent with the logical ID of the `document_pointer` - however we do not\nvalidate this. You must also supply an ASID.\n\n```python\nfrom nrlf_converter import nrl_to_r4\n\ndocument_reference = nrl_to_r4(document_pointer={...}, nhs_number=\"12345678910\", asid=\"230811201350\")\n```\n\nIf the NRL-to-R4 conversion is unsuccessful, one of the following errors is raised:\n\n- `ValidationError`: Your `document_pointer` has broken our data contract. It probably means\n  that we'll need to update our data contract and add a new test case for our integration tests.\n- `BadRelatesTo`: You `document_pointer` is superseding (\"replaces\") another, but the fields are inconsistent.\n- `CustodianError`: We were unable to parse an ODS code from your `document_pointer.custodian` field.\n  It probably means that we'll need to update our data contract and add a new test case for our integration tests.\n\nYou can catch these errors by importing them from the top-level module:\n\n```python\nfrom nrlf_converter import nrl_to_r4, ValidationError, BadRelatesTo, CustodianError\n\ntry:\n  document_reference = nrl_to_r4(document_pointer={...}, nhs_number=\"12345678910\", asid=\"230811201350\")\nexcept ValidationError:\n  ...\nexcept BadRelatesTo:\n  ...\nexcept CustodianError:\n  ...\n```\n\nFurthermore, just because the conversion is successful doesn't mean that `document_reference` will be valid in NRLF. If your receive any rejections, it is likely that we'll need to update our data contract and add a new test case for our integration tests.\n\n# For Developers of this package\n\n## In general\n\n```console\nmake help\n```\n\n\u003e 💡 HINT: You might find it extra helpful to have [bash-completion](https://github.com/scop/bash-completion)\n\u003e installed which will tab-complete the `make` commands for you.\n\u003e\n\u003e \u003e Mac Users:\n\u003e \u003e\n\u003e \u003e ```\n\u003e \u003e brew install bash-completion@2\n\u003e \u003e ```\n\u003e \u003e\n\u003e \u003e and add the following line near the top of `~/.bash_profile`:\n\u003e \u003e\n\u003e \u003e ```\n\u003e \u003e [[ -r \"/usr/local/etc/profile.d/bash_completion.sh\" ]] \u0026\u0026 . \"/usr/local/etc/profile.d/bash_completion.sh\"\n\u003e \u003e ```\n\n### First time setup\n\n```console\nmake venv--install\n```\n\n### Every time you start a new session\n\n```console\npoetry shell\n```\n\nor without a new shell\n\n```console\nsource .venv/bin/activate\n```\n\n## Workflow\n\nTo create new features:\n\n1. Create feature branch\n2. Make sure the version is greater than the latest tag with `make ci--version-greater-than-latest-tag`\n3. If you need to increment the version use `make pkg--helpers--increment-version--patch` (you can also change the version manually inside the `pyproject.toml`)\n4. Create your Pull Request\n5. Merge your Pull Request.\n\nTo create a release from the latest tag (with wheels, tarballs etc, ready for spineii):\n\n1. Follow the Create a Release instructions\n2. Once the Release Action has finished, the wheel or tarball required for spineii can be found in https://github.com/NHSDigital/nrlf-converter/releases\n\n## Workflow gory details\n\n### Feature branches\n\nCreate features branches according to the naming convention:\n\n```\nfeature/\u003cJIRA-TICKET-ID\u003e-\u003cshort_camel_case_description\u003e\n```\n\nIf there has been a recent release then you will need to bump `[tool.poetry] version` in `pyproject.toml` to be semantically greater than the latest tag. Github actions will remind you of this when you create a Pull Request.\n\nNote that you can check that value of the latest tag with:\n\n```console\nmake pkg--helpers--latest-tag\n```\n\n### Increment version\n\nIncrement patch version (e.g. `0.0.1` --\u003e `0.0.2`):\n\n```console\nmake pkg--helpers--increment-version--patch\n```\n\nIncrement minor version (e.g. `0.0.3` --\u003e `0.1.0`):\n\n```console\nmake pkg--helpers--increment-version--minor\n```\n\n### Releases\n\nCreate a release:\n\n```console\nmake pkg--helpers--create-release-from-version\n```\n\nA tag will be created tag based on the version specified in the `pyproject.toml`, then pushed to GitHub in order to trigger a release.\n\n### Publish to PyPI\n\nUPDATE\n\n## Tests\n\n### Unit\n\n```\nmake test--unit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhsdigital%2Fnrlf-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhsdigital%2Fnrlf-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhsdigital%2Fnrlf-converter/lists"}