relatedConcepts: Obtain related concepts for a set of SNOMED CT concepts

View source: R/hierarchy.R

relatedConceptsR Documentation

Obtain related concepts for a set of SNOMED CT concepts

Description

Returns concepts with a particular relation to a supplied set of SNOMED CT concepts

Usage

relatedConcepts(
  conceptIds,
  typeId = bit64::as.integer64("116680003"),
  tables = c("RELATIONSHIP", "STATEDRELATIONSHIP"),
  reverse = FALSE,
  recursive = FALSE,
  active_only = TRUE,
  SNOMED = getSNOMED()
)

Arguments

conceptIds

character or integer64 vector

typeId

concept ID of relationship type. Defaults to 116680003 = Is a

tables

vector of names of relationship table(s) to use; by default use both RELATIONSHIP and STATEDRELATIONSHIP

reverse

whether to reverse the relationship

recursive

whether to re-apply the function on the outputs

active_only

whether to limit the output to active concepts only

SNOMED

environment containing a SNOMED dictionary

Value

a data.table with the following columns: id, conceptId, type (only if include_synonyms = TRUE), term, active (only if active_only = FALSE)

Examples

# Load sample SNOMED CT dictionary
SNOMED <- sampleSNOMED()

# Example: anatomical site of a finding
findingSite <- function(x){
  relatedConcepts(as.SNOMEDconcept(x),
    typeId = as.SNOMEDconcept('Finding site'))
}

description(findingSite('Heart failure'))
# Heart structure (body structure)

anoopshah/Rdiagnosislist documentation built on April 21, 2023, 11:49 p.m.