Skip to contents

TODO need to sort repeated rows

Usage

omop_relations(
  c_id = NULL,
  c_ids = NULL,
  d_ids = NULL,
  v_ids = NULL,
  cc_ids = NULL,
  standard = NULL,
  r_ids = NULL,
  itself = FALSE,
  names2avoid = c("SNOMED CT core", "Defined", "Primitive"),
  messages = TRUE,
  nsteps = 1,
  add_step_column = TRUE,
  join_names = TRUE
)

orels(
  c_id = NULL,
  c_ids = NULL,
  d_ids = NULL,
  v_ids = NULL,
  cc_ids = NULL,
  standard = NULL,
  r_ids = NULL,
  itself = FALSE,
  names2avoid = c("SNOMED CT core", "Defined", "Primitive"),
  messages = TRUE,
  nsteps = 1,
  add_step_column = TRUE,
  join_names = TRUE
)

Arguments

c_id

single omop concept_id or exact concept_name to get relations of, default NULL returns all

c_ids

one or more concept_id to filter by, default NULL for all

d_ids

one or more domain_id to filter by, default NULL for all

v_ids

one or more vocabulary_id to filter by, default NULL for all

cc_ids

one or more concept_class_id to filter by, default NULL for all

standard

one or more standard_concept to filter by, default NULL for all, S,C

r_ids

one or more relationship_id to filter by, default NULL for all, e.g c('Is a','Subsumes')

itself

whether to include relations to concept itself, default=FALSE

names2avoid

concept names to avoid, defaults to generic concepts with lots relations, can be set to NULL

messages

whether to print info messages, default=TRUE

nsteps

number of recursions to search

add_step_column

whether to add column with step level, default=TRUE

join_names

whether to join on concept_names, default=TRUE

Value

a dataframe of concepts and attributes Is' is a non standard relationship_id

Examples

omop_relations("Non-invasive blood pressure")
#> recursively querying concept relations of: Non-invasive blood pressure - may take more than a few seconds
#> step 1 of 1
#>    querying concept relations of: Non-invasive blood pressure - may take a few seconds
#> returning 8 concepts
#> # A tibble: 9 × 14
#>   concept_id_1 concept_name_1        concept_id_2 concept_name_2 relationship_id
#>          <int> <chr>                        <int> <chr>          <chr>          
#> 1     36716965 Non-invasive blood p…     36716965 Non-invasive … Is             
#> 2     36716965 Non-invasive blood p…     40642538 Primitive      Has status     
#> 3     36716965 Non-invasive blood p…     40642539 SNOMED CT core Has Module     
#> 4     36716965 Non-invasive blood p…      4326744 Blood pressure Is a           
#> 5     36716965 Non-invasive blood p…      4354254 Non-invasive … Subsumes       
#> 6     36716965 Non-invasive blood p…     36716283 Pressure       Has property   
#> 7     36716965 Non-invasive blood p…      4014241 Structure of … Inheres in     
#> 8     36716965 Non-invasive blood p…     36717771 Cardiac proce… Characterizes  
#> 9     36716965 Non-invasive blood p…      4149267 Quantitative   Has scale type 
#> # ℹ 9 more variables: valid_start_date <date>, valid_end_date <date>,
#> #   invalid_reason <chr>, domain_id <chr>, vocabulary_id <chr>,
#> #   concept_class_id <chr>, standard_concept <chr>, concept_code <chr>,
#> #   step <dbl>
omop_relations("Non-invasive blood pressure",nsteps=2,r_ids=c('Is a','Subsumes'))
#> recursively querying concept relations of: Non-invasive blood pressure - may take more than a few seconds
#> step 1 of 2
#>    querying concept relations of: Non-invasive blood pressure - may take a few seconds
#> returning 2 concepts
#> step 2 of 2
#>    querying concept relations of: Non-invasive blood pressure - may take a few seconds
#> returning 2 concepts
#>    querying concept relations of: Blood pressure - may take a few seconds
#> returning 29 concepts
#>    querying concept relations of: Non-invasive arterial pressure - may take a few seconds
#> returning 4 concepts
#> # A tibble: 38 × 14
#>    concept_id_1 concept_name_1       concept_id_2 concept_name_2 relationship_id
#>           <int> <chr>                       <int> <chr>          <chr>          
#>  1     36716965 Non-invasive blood …     36716965 Non-invasive … Is             
#>  2     36716965 Non-invasive blood …      4326744 Blood pressure Is a           
#>  3     36716965 Non-invasive blood …      4354254 Non-invasive … Subsumes       
#>  4     36716965 Non-invasive blood …      4326744 Blood pressure Is a           
#>  5     36716965 Non-invasive blood …      4354254 Non-invasive … Subsumes       
#>  6      4326744 Blood pressure            4080904 Wedge pressur… Subsumes       
#>  7      4326744 Blood pressure            4090818 Venous pressu… Subsumes       
#>  8      4326744 Blood pressure            4152194 Systolic bloo… Subsumes       
#>  9      4326744 Blood pressure            4173359 Wedge pressur… Subsumes       
#> 10      4326744 Blood pressure            4194579 24 hour blood… Subsumes       
#> # ℹ 28 more rows
#> # ℹ 9 more variables: valid_start_date <date>, valid_end_date <date>,
#> #   invalid_reason <chr>, domain_id <chr>, vocabulary_id <chr>,
#> #   concept_class_id <chr>, standard_concept <chr>, concept_code <chr>,
#> #   step <dbl>
#omop_relations("lenalidomide")
#omop_relations(1633308)
#cmde <- omop_relations(v_ids="Cancer Modifier")
# because of R argument matching, you can just use the first unique letters of
# arguments e.g. v for v_ids, cc for cc_ids
chemodrugs <- orels("Cytotoxic chemotherapeutic", v="HemOnc", d="Regimen")
#> recursively querying concept relations of: Cytotoxic chemotherapeutic - may take more than a few seconds
#> step 1 of 1
#>    querying concept relations of: Cytotoxic chemotherapeutic - may take a few seconds
#> returning 0 concepts