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
codes <- getCandidateCodes(
cdm = cdm,
keywords = "Musculoskeletal disorder",
domains = "Condition",
includeDescendants = FALSE,
)
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> ✔ 1 candidate concept identified
#>
#> Time taken: 0 minutes and 1 seconds
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
codes <- getCandidateCodes(
cdm = cdm,
keywords = "Musculoskeletal",
domains = "Condition",
includeDescendants = FALSE
)
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> ✔ 1 candidate concept identified
#>
#> Time taken: 0 minutes and 0 seconds
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
))
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> condition domain: Adding descendants
#> ✔ 5 candidate concepts identified
#>
#> Time taken: 0 minutes and 1 seconds
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
codes <- getCandidateCodes(
cdm = cdm,
keywords = c(
"Musculoskeletal disorder",
"arthritis",
"arthrosis"
),
domains = "Condition",
includeDescendants = FALSE
)
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> ✔ 5 candidate concepts identified
#>
#> Time taken: 0 minutes and 1 seconds
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
codes <- getCandidateCodes(
cdm = cdm,
keywords = "Osteoarthritis of knee",
includeAncestor = TRUE,
domains = "Condition"
)
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> condition domain: Adding descendants
#> condition domain: Adding ancestor
#> ✔ 2 candidate concepts identified
#>
#> Time taken: 0 minutes and 1 seconds
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”.
codes <- getCandidateCodes(
cdm = cdm,
keywords = "Knee osteoarthritis",
domains = "Condition",
includeDescendants = TRUE
)
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> condition domain: Adding descendants
#> ✔ 1 candidate concept identified
#>
#> Time taken: 0 minutes and 1 seconds
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
codes <- getCandidateCodes(
cdm = cdm,
keywords = "arthritis",
exclude = "Hip osteoarthritis",
domains = "Condition"
)
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> condition domain: Adding descendants
#> ✔ 2 candidate concepts identified
#>
#> Time taken: 0 minutes and 1 seconds
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.
codes <- getCandidateCodes(
cdm = cdm,
keywords = "osteoarthrosis",
domains = "Condition",
searchInSynonyms = TRUE
)
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> condition domain: Adding concepts using synonymns
#> condition domain: Adding descendants
#> ✔ 4 candidate concepts identified
#>
#> Time taken: 0 minutes and 1 seconds
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 we could have also picked up “Osteoarthrosis” by searching via non-standard.
codes <- getCandidateCodes(
cdm = cdm,
keywords = c("arthritis", "arthropathy"),
domains = "Condition",
searchNonStandard = TRUE
)
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> condition domain: Adding descendants
#> condition domain: Adding codes from non-standard
#> ✔ 4 candidate concepts identified
#>
#> Time taken: 0 minutes and 1 seconds
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
codes <- getCandidateCodes(
cdm = cdm,
keywords = c(
"Musculoskeletal disorder",
"arthritis",
"arthropathy",
"arthrosis"
),
domains = "Condition",
standardConcept = c("Standard", "Non-standard")
)
#> condition domain: Limiting to domains of interest
#> condition: Getting concepts to include
#> condition domain: Adding descendants
#> ✔ 8 candidate concepts identified
#>
#> Time taken: 0 minutes and 1 seconds
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 |