This function compares a vector of concept_ids identifiers against a target set defined by an ECL expression target_ecl. It returns TRUE if the concept belongs to the target set, FALSE if it does not, or NA if it is not found in the branch.

concept_included_in(
  concept_ids,
  target_ecl,
  silent = FALSE,
  endpoint = snomedizer_options_get("endpoint"),
  branch = snomedizer_options_get("branch"),
  encoding = "UTF-8"
)

Arguments

concept_ids

character vector of identifiers of concepts to be analysed

target_ecl

character ECL expression defining the target set of concepts. The "<<" operator is required to include subtypes of a concept

silent

whether to hide progress bar. Default is FALSE

endpoint

URL of a SNOMED CT Terminology Server REST API endpoint. See snomedizer_options.

branch

a string for the name of the API endpoint branch to use (most commonly "MAIN"). See snomedizer_options.

encoding

HTTP charset parameter to use (default is "UTF-8")

Value

a logical vector with the same order as concept_ids indicating whether each concept is included in the target set or not. NA is returned when concept_ids are not present on the target branch, or in case of a REST error caused by invalid concept_ids or target_ecl.

Examples

concept_included_in(
  concept_ids = "16227691000119107",  # Post-surgical excision site
  target_ecl = "<<123037004"          # Subtypes of 'body structure'
)
#> [1] TRUE
concept_included_in(
  concept_ids = "48800003",           # Ear lobule structure
  target_ecl = "<<233604007"          # Subtypes of 'pneumonia'
)
#> [1] FALSE
concept_included_in(
  concept_ids = "39732311000001104",  # Medical product only found UK Edition
  target_ecl = "27658006"             # Products containing amoxicillin
)
#> [1] NA
concept_included_in(
  concept_ids = "233604007",          # Pneumonia
  target_ecl = "<<64572001 :
         116676008 = <<409774005"     # Disorders with inflammation as associated morphology
)
#> [1] TRUE
concept_included_in(
  concept_ids = "233604007",          # Pneumonia
  target_ecl = "<<64572001 :
         116676008 = <<409774005"     # Disorders with inflammation as associated morphology
)
#> [1] TRUE
concept_included_in(
  concept_ids = "10625071000119104",  # Bronchopneumonia caused by bacteria (disorder) |
  target_ecl = "<<233604007 MINUS <<53084003"
                                      # Pneumonia excluding all bacterial pneumonia concepts
)
#> [1] FALSE