Let´s say we have a mock vocabulary database with these hypothetical concepts and relationships.
To find “Musculoskeletal disorder” we can search for that like so
<- getCandidateCodes(
codes cdm = cdm,
keywords = "Musculoskeletal disorder",
domains = "Condition",
includeDescendants = FALSE,
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
1 | Musculoskeletal disorder | condition | clinical finding | snomed | From initial search |
Note, we would also identify it based on a partial match
<- getCandidateCodes(
codes cdm = cdm,
keywords = "Musculoskeletal",
domains = "Condition",
includeDescendants = FALSE
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
1 | Musculoskeletal disorder | condition | clinical finding | snomed | From initial search |
To include descendants of an identified code, we can set includeDescendants to TRUE
kable(getCandidateCodes(
cdm = cdm,
keywords = "Musculoskeletal disorder",
domains = "Condition",
includeDescendants = TRUE
))
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
1 | Musculoskeletal disorder | condition | clinical finding | snomed | From initial search |
2 | Osteoarthrosis | condition | clinical finding | snomed | From descendants |
3 | Arthritis | condition | clinical finding | snomed | From descendants |
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From descendants |
5 | Osteoarthritis of hip | condition | clinical finding | snomed | From descendants |
We can also search for multiple keywords at the same time, and would have picked these all up with the following search
<- getCandidateCodes(
codes cdm = cdm,
keywords = c(
"Musculoskeletal disorder",
"arthritis",
"arthrosis"
),domains = "Condition",
includeDescendants = FALSE
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
1 | Musculoskeletal disorder | condition | clinical finding | snomed | From initial search |
3 | Arthritis | condition | clinical finding | snomed | From initial search |
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From initial search |
5 | Osteoarthritis of hip | condition | clinical finding | snomed | From initial search |
2 | Osteoarthrosis | condition | clinical finding | snomed | From initial search |
To include the ancestors one level above the identified concepts we can set includeAncestor to TRUE
<- getCandidateCodes(
codes cdm = cdm,
keywords = "Osteoarthritis of knee",
includeAncestor = TRUE,
domains = "Condition"
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From initial search |
3 | Arthritis | condition | clinical finding | snomed | From ancestor |
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”.
<- getCandidateCodes(
codes cdm = cdm,
keywords = "Knee osteoarthritis",
domains = "Condition",
includeDescendants = TRUE
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From initial search |
We can also exclude specific terms
<- getCandidateCodes(
codes cdm = cdm,
keywords = "arthritis",
exclude = "Hip osteoarthritis",
domains = "Condition"
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
3 | Arthritis | condition | clinical finding | snomed | From initial search |
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From initial search |
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.
<- getCandidateCodes(
codes cdm = cdm,
keywords = "osteoarthrosis",
domains = "Condition",
searchInSynonyms = TRUE
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
2 | Osteoarthrosis | condition | clinical finding | snomed | From initial search |
3 | Arthritis | condition | clinical finding | snomed | In synonyms |
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From descendants |
5 | Osteoarthritis of hip | condition | clinical finding | snomed | From descendants |
Or, in this case, we can get the same result by searching via synonyms. In this case when using searchViaSynonyms=TRUE, “Arthritis” (which gets identified first) has a synonym of “Osteoarthrosis”, and based on this synonym we can also include the “Osteoarthrosis” concept.
<- getCandidateCodes(
codes cdm = cdm,
keywords = "arthritis",
domains = "Condition",
searchViaSynonyms = TRUE
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
3 | Arthritis | condition | clinical finding | snomed | From initial search |
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From initial search |
5 | Osteoarthritis of hip | condition | clinical finding | snomed | From initial search |
2 | Osteoarthrosis | condition | clinical finding | snomed | Via synonyms |
We could have also picked up “Osteoarthrosis” by doing fuzzy matching which allows for some differences in spelling.
<- getCandidateCodes(
codes cdm = cdm,
keywords = "arthritis",
domains = "Condition",
fuzzyMatch = TRUE,
maxDistanceCost = 0.2
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
2 | Osteoarthrosis | condition | clinical finding | snomed | From initial search |
3 | Arthritis | condition | clinical finding | snomed | From initial search |
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From initial search |
5 | Osteoarthritis of hip | condition | clinical finding | snomed | From initial search |
Or we could have also picked up “Osteoarthrosis” by searching via non-standard.
<- getCandidateCodes(
codes cdm = cdm,
keywords = c("arthritis", "arthropathy"),
domains = "Condition",
searchNonStandard = TRUE
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
3 | Arthritis | condition | clinical finding | snomed | From initial search |
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From initial search |
5 | Osteoarthritis of hip | condition | clinical finding | snomed | From initial search |
2 | Osteoarthrosis | condition | clinical finding | snomed | From non-standard |
We can also include non-standard codes in our results like so
<- getCandidateCodes(
codes cdm = cdm,
keywords = c(
"Musculoskeletal disorder",
"arthritis",
"arthropathy",
"arthrosis"
),domains = "Condition",
standardConcept = c("Standard", "Non-standard")
)
kable(codes)
concept_id | concept_name | domain_id | concept_class_id | vocabulary_id | found_from |
---|---|---|---|---|---|
1 | Musculoskeletal disorder | condition | clinical finding | snomed | From initial search |
3 | Arthritis | condition | clinical finding | snomed | From initial search |
4 | Osteoarthritis of knee | condition | clinical finding | snomed | From initial search |
5 | Osteoarthritis of hip | condition | clinical finding | snomed | From initial search |
8 | Knee osteoarthritis | condition | diagnosis | read | From initial search |
17 | Arthritis | condition | icd code | icd10 | From initial search |
7 | Degenerative arthropathy | condition | diagnosis | read | From initial search |
2 | Osteoarthrosis | condition | clinical finding | snomed | From initial search |