knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(DBI) library(dplyr) library(CodelistGenerator) library(CDMConnector)
Let´s say we have a mock vocabulary database with these hypothetical concepts and relationships.
knitr::include_graphics("mock_db_fig1.png")
cdm <- mockVocabRef(backend = "data_frame")
knitr::include_graphics("mock_db_fig2.png")
To find "Musculoskeletal disorder" we can search for that like so
codes <- getCandidateCodes( cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = FALSE, ) codes %>% glimpse()
Note, we would also identify it based on a partial match
codes <- getCandidateCodes( cdm = cdm, keywords = "Musculoskeletal", domains = "Condition", includeDescendants = FALSE ) codes %>% glimpse()
knitr::include_graphics("mock_db_fig7.png")
To include descendants of an identified code, we can set includeDescendants to TRUE
getCandidateCodes( cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = TRUE ) %>% glimpse()
We can also search for multiple keywords at the same time, and would have picked these all up with the following search
codes <- getCandidateCodes( cdm = cdm, keywords = c( "Musculoskeletal disorder", "arthritis", "arthrosis" ), domains = "Condition", includeDescendants = FALSE ) codes %>% glimpse()
knitr::include_graphics("mock_db_fig5.png")
To include the ancestors one level above the identified concepts we can set includeAncestor to TRUE
codes <- getCandidateCodes( cdm = cdm, keywords = "Osteoarthritis of knee", includeAncestor = TRUE, domains = "Condition" ) codes %>% glimpse()
knitr::include_graphics("mock_db_fig4.png")
We can also find concepts with multiple words even if they are in a different order. For example, a search for "Knee osteoarthritis" will pick up "Osteoarthritis of knee".
codes <- getCandidateCodes( cdm = cdm, keywords = "Knee osteoarthritis", domains = "Condition", includeDescendants = TRUE ) codes %>% glimpse()
knitr::include_graphics("mock_db_fig5.png")
We can also exclude specific terms
codes <- getCandidateCodes( cdm = cdm, keywords = "arthritis", exclude = "Hip osteoarthritis", domains = "Condition" ) codes %>% glimpse()
knitr::include_graphics("mock_db_fig6.png")
We can also pick up codes based on their synonyms. In this case "Arthritis" has a synonym of "Osteoarthrosis" and so a search of both the primary name of a concept and any of its associated synonyms would pick up this synonym and it would be included.
codes <- getCandidateCodes( cdm = cdm, keywords = "osteoarthrosis", domains = "Condition", searchInSynonyms = TRUE ) codes %>% glimpse()
Or we could have also picked up "Osteoarthrosis" by searching via non-standard.
codes <- getCandidateCodes( cdm = cdm, keywords = c("arthritis", "arthropathy"), domains = "Condition", searchNonStandard = TRUE ) codes %>% glimpse()
knitr::include_graphics("mock_db_fig8.png")
We can also include non-standard codes in our results like so
codes <- getCandidateCodes( cdm = cdm, keywords = c( "Musculoskeletal disorder", "arthritis", "arthropathy", "arthrosis" ), domains = "Condition", standardConcept = c("Standard", "Non-standard") ) codes %>% glimpse()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.