trud

R package wrapper for the NHS TRUD API

https://github.com/ropensci/trud

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: joss.theoj.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.6%) to scientific vocabulary

Keywords

api-wrapper ehr icd nhs snomed-ct
Last synced: 4 months ago · JSON representation

Repository

R package wrapper for the NHS TRUD API

Basic Info
Statistics
  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • Open Issues: 2
  • Releases: 3
Topics
api-wrapper ehr icd nhs snomed-ct
Created about 2 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Codemeta

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# trud 


[![pkgcheck](https://github.com/ropensci/trud/actions/workflows/pkgcheck.yaml/badge.svg)](https://github.com/ropensci/trud/actions/workflows/pkgcheck.yaml) [![Codecov test coverage](https://codecov.io/gh/ropensci/trud/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ropensci/trud?branch=main)
[![R-CMD-check](https://github.com/ropensci/trud/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/trud/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/trud)](https://CRAN.R-project.org/package=trud)
[![](https://cranlogs.r-pkg.org/badges/last-month/trud)](https://cran.r-project.org/package=trud)
[![CRAN downloads](https://cranlogs.r-pkg.org/badges/grand-total/trud)](https://CRAN.R-project.org/package=trud)
[![Repo Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Status at rOpenSci Software Peer Review](https://badges.ropensci.org/705_status.svg)](https://github.com/ropensci/software-review/issues/705)
[![status](https://joss.theoj.org/papers/810bf12b9b80b17cadc82397f5022154/status.svg)](https://joss.theoj.org/papers/810bf12b9b80b17cadc82397f5022154)


The goal of `trud` is to provide a convenient R interface to the [National Health Service (NHS) England Technology Reference data Update Distribution (TRUD)](https://isd.digital.nhs.uk/trud/users/guest/filters/0/api).

The NHS TRUD service provides essential reference files that underpin a wide range of electronic health record (EHR) areas, both in the UK and internationally. These files include clinical coding systems such as ICD, Read codes, prescription codes, and the SNOMED CT ontology, with regular updates to reflect new knowledge and changes in clinical practice. NHS TRUD content supports key research areas like disease phenotyping, cohort selection, epidemiology, health services research, and the development of risk prediction models.

`trud` enables seamless, programmatic retrieval and updating of NHS TRUD release items, removing the need for manual downloads and reducing the risk of errors or version drift. This helps researchers maintain reproducible, up-to-date analyses — whether as part of ad-hoc studies or automated pipelines.

To learn more about NHS TRUD and its available resources, visit the [NHS TRUD website](https://isd.digital.nhs.uk/trud/users/guest/filters/0/home).

## Installation

You can install this package from CRAN:

``` r
install.packages("trud")
```

Or you can install the development version  of `trud` from either [GitHub](https://github.com/ropensci/trud) with:

``` r
# install.packages("pak")
pak::pak("ropensci/trud")
```

... or [R Universe](https://ropensci.r-universe.dev/builds) with:

``` r
install.packages("trud", repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'))
```

You will also need to [sign up for a free account](https://isd.digital.nhs.uk/trud/users/guest/filters/0/account/form) with NHS TRUD and set up your API key as described in `vignette("trud")`.

## Getting Started

### Understanding TRUD Subscriptions

**Important**: NHS TRUD operates on a subscription model. After creating your account, you must individually subscribe to each item you want to access through the [NHS TRUD website](https://isd.digital.nhs.uk/trud/users/guest/filters/0/categories/1).

### Recommended Workflow

**Step 0**: Set up your TRUD API key as an environmental variable named `TRUD_API_KEY`. For example, create or edit your project `.Renviron` file with `usethis::edit_r_environ()`, then populate as follows (replacing `e963cc518cc41500e1a8940a93ffc3c0915e2983` with your own API key):[^1]

[^1]: You will also need to restart your R session to set any environmental variables that have been newly-added to your project `.Renviron` file.

```
TRUD_API_KEY=e963cc518cc41500e1a8940a93ffc3c0915e2983
```

**Step 1**: Check what you're already subscribed to:

```{r subscribed-items}
library(trud)

# See items you can currently access
get_subscribed_metadata()
```

**Step 2**: Browse all available items (note: subscription required for access):

```{r browse-items}
# List all available TRUD items
trud_items()
```

**Step 3**: Subscribe to additional items you need via the [NHS TRUD website](https://isd.digital.nhs.uk/trud/users/guest/filters/0/categories/1), then access them:

```{r access-items, eval=FALSE}
# After subscribing to an item (e.g., item 394), you can:

# Get metadata
metadata <- get_item_metadata(394)

# Download the item
file_path <- download_item(394, directory = tempdir())
```

## Available functionality

The main functions provided by `trud` are:

- `get_subscribed_metadata()`: Shows items you can currently access
- `trud_items()`: Lists all available items
- `get_item_metadata()`: Retrieves metadata for a specific item
- `download_item()`: Downloads files for a specific item

Please see `vignette("trud")` for further information and getting started.

## Citing trud

If you find `trud` useful, please consider citing it. Citation details are available [here](https://docs.ropensci.org/trud/authors.html#citation).

## Community guidelines

Feedback, bug reports, and feature requests are welcome; file issues or seek support [here](https://github.com/ropensci/trud/issues). If you would like to contribute to the package, please see our [contributing guidelines](https://docs.ropensci.org/trud/CONTRIBUTING.html).
  
Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.

Owner

  • Name: rOpenSci
  • Login: ropensci
  • Kind: organization
  • Email: info@ropensci.org
  • Location: Berkeley, CA

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "trud",
  "description": "Provides a convenient R interface to the 'National Health Service NHS Technology Reference Update Distribution (TRUD) API', allowing users to list available releases for their subscribed items, retrieve metadata, and download release files. For more information on the API, see <https://isd.digital.nhs.uk/trud/users/guest/filters/0/api>.",
  "name": "trud: Query the 'NHS TRUD API'",
  "relatedLink": [
    "https://docs.ropensci.org/trud/",
    "https://CRAN.R-project.org/package=trud"
  ],
  "codeRepository": "https://github.com/ropensci/trud",
  "issueTracker": "https://github.com/ropensci/trud/issues",
  "license": "https://spdx.org/licenses/MIT",
  "version": "0.1.0.9000",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.4.2 (2024-10-31)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Alasdair",
      "familyName": "Warwick",
      "email": "alasdair.warwick.19@ucl.ac.uk",
      "@id": "https://orcid.org/0000-0002-0800-2890"
    },
    {
      "@type": "Person",
      "givenName": "Robert",
      "familyName": "Luben",
      "@id": "https://orcid.org/0000-0002-5088-6343"
    },
    {
      "@type": "Person",
      "givenName": "Abraham",
      "familyName": "Olvera-Barrios",
      "@id": "https://orcid.org/0000-0002-3305-4465"
    },
    {
      "@type": "Person",
      "givenName": "Chuin Ying",
      "familyName": "Ung",
      "@id": "https://orcid.org/0000-0001-8487-4589"
    }
  ],
  "copyrightHolder": [
    {
      "@type": "Person",
      "givenName": "Alasdair",
      "familyName": "Warwick",
      "email": "alasdair.warwick.19@ucl.ac.uk",
      "@id": "https://orcid.org/0000-0002-0800-2890"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Alasdair",
      "familyName": "Warwick",
      "email": "alasdair.warwick.19@ucl.ac.uk",
      "@id": "https://orcid.org/0000-0002-0800-2890"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "version": ">= 3.0.0",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    },
    {
      "@type": "SoftwareApplication",
      "identifier": "withr",
      "name": "withr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=withr"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 4.2.0"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "cli",
      "name": "cli",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=cli"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "dplyr",
      "name": "dplyr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=dplyr"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "httr2",
      "name": "httr2",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=httr2"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "purrr",
      "name": "purrr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=purrr"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "rlang",
      "name": "rlang",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rlang"
    },
    "7": {
      "@type": "SoftwareApplication",
      "identifier": "rvest",
      "name": "rvest",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rvest"
    },
    "8": {
      "@type": "SoftwareApplication",
      "identifier": "stringr",
      "name": "stringr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=stringr"
    },
    "9": {
      "@type": "SoftwareApplication",
      "identifier": "tibble",
      "name": "tibble",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tibble"
    },
    "SystemRequirements": null
  },
  "fileSize": "587.246KB",
  "releaseNotes": "https://github.com/ropensci/trud/blob/master/NEWS.md",
  "readme": "https://github.com/ropensci/trud/blob/main/README.md",
  "contIntegration": [
    "https://github.com/ropensci/trud/actions/workflows/pkgdown.yaml",
    "https://app.codecov.io/gh/ropensci/trud?branch=main",
    "https://github.com/ropensci/trud/actions/workflows/R-CMD-check.yaml"
  ],
  "developmentStatus": "https://www.repostatus.org/#active",
  "keywords": [
    "api-wrapper",
    "ehr",
    "icd",
    "nhs",
    "snomed-ct"
  ]
}

GitHub Events

Total
  • Create event: 1
  • Release event: 2
  • Issues event: 2
  • Watch event: 1
  • Issue comment event: 6
  • Push event: 8
Last Year
  • Create event: 1
  • Release event: 2
  • Issues event: 2
  • Watch event: 1
  • Issue comment event: 6
  • Push event: 8

Dependencies

.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • cli * imports
  • dplyr * imports
  • httr2 * imports
  • magrittr * imports
  • purrr * imports
  • rlang * imports
  • rvest * imports
  • stringr * imports
  • tibble * imports
  • tidyselect * imports
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite