Get SNOMED CT UK Monolith Edition from NHS TRUD
Source:R/get_snomed_ct_uk_monlith.R
get_snomed_ct_uk_monolith.RdDownloads the SNOMED CT UK Monolith Edition (item 1799) from NHS TRUD.
Usage
get_snomed_ct_uk_monolith(
dir_path = tempdir(),
release = "latest",
overwrite = FALSE,
quiet = FALSE
)Arguments
- dir_path
Directory path to download to. Defaults to
tempdir().- release
Character string specifying which release to download. Can be:
"latest"(default) - Downloads the most recent releaseA specific release identifier string (e.g.,
"uk_sct2mo_41.3.0_20251217000001Z.zip")
- overwrite
Logical. If
TRUE, re-downloads and overwrites existing files. Default isFALSE.- quiet
Logical. If
TRUE, suppresses informational messages. Default isFALSE.
Details
This function requires a valid NHS TRUD API key set as an environment
variable TRUD_API_KEY. You must also be subscribed to item 1799 on the
NHS TRUD website.
By default, the latest release is downloaded. The function checks if the
target zip file already exists and skips the download if so (unless
overwrite = TRUE).
The returned zip file path can be passed directly to
read_snomed_ct_uk_monolith(), which will extract the contents on-demand.
See also
read_snomed_ct_uk_monolith()to read the downloaded data into Rtrud::download_item()for the underlying download functiontrud::get_item_metadata()to retrieve available release identifiers
Examples
if (FALSE) { # \dontrun{
# Download latest SNOMED CT UK Monolith to tempdir
snomed_zip <- get_snomed_ct_uk_monolith()
# Get available releases
metadata <- trud::get_item_metadata(1799, release_scope = "all")
available_releases <- purrr::map_chr(metadata$releases, "id")
# Download specific release
snomed_zip <- get_snomed_ct_uk_monolith(
release = "uk_sct2mo_41.3.0_20251217000001Z.zip"
)
# Download to specific directory for persistent storage
snomed_zip <- get_snomed_ct_uk_monolith(
dir_path = "~/data/snomed",
overwrite = TRUE
)
# Read the downloaded data (extracts on-demand)
snomed <- read_snomed_ct_uk_monolith(snomed_zip)
} # }