get_candidate_codes: Generate candidate codelist for the OMOP CDM

View source: R/get_candidate_codes.R

get_candidate_codesR Documentation

Generate candidate codelist for the OMOP CDM

Description

This function generates a set of codes that can be considered for creating a phenotype using the OMOP CDM.

Usage

get_candidate_codes(
  keywords,
  domains = c("Condition", "Drug", "Device", "Observation", "Procedure"),
  search.synonyms = FALSE,
  fuzzy.match = FALSE,
  fuzzy.match.max.distance = 0.1,
  exclude = NULL,
  include.descendants = TRUE,
  include.ancestor = FALSE,
  db,
  vocabulary_database_schema
)

Arguments

keywords

Character vector of words to search for. Where more than one word is given (e.g. "knee osteoarthritis"), all words will be identified but can be in different positions (e.g. "osteoarthritis of knee") should be identified.

domains

Character vector with one or more of the OMOP CDM domain (e.g. "Condition").

search.synonyms

Either TRUE or FALSE. If TRUE the code will also search via the concept synonym table.

fuzzy.match

Either TRUE or FALSE. If TRUE the fuzzy matches will be used, with approximate matches identified.

fuzzy.match.max.distance

The max.distance parmeter for fuzzy matching (see ??base::agrep for further details).

exclude

Character vector of words to search for to identify concepts to exclude.

include.descendants

Either TRUE or FALSE. If TRUE descendant concepts of identified concepts will be included in the candidate codelist.

include.ancestor

Either TRUE or FALSE. If TRUE the direct ancestor concepts of identified concepts will be included in the candidate codelist.

db

Database connection via DBI::dbConnect()

vocabulary_schema

Name of database schema with vocab tables

Value

Dataframe

Examples

untar(xzfile(system.file("sqlite", "cdm.tar.xz", package = "Eunomia"), open = "rb"),
       exdir =  tempdir())
db <- dbConnect(RSQLite::SQLite(), paste0(tempdir(),"\\cdm.sqlite"))
vocabulary_database_schema<-"main"
get_candidate_codes(keywords="asthma",
                   db=db,
                   vocabulary_schema = "main")
get_candidate_codes(keywords="asthma",
                   search.synonyms=TRUE,
                             fuzzy.match=TRUE,
                             exclude=NULL,
                             include.descendants=TRUE,
                             include.ancestor=FALSE,
                   db=db,
                   vocabulary_database_schema = "main")


edward-burn/CodelistGenerator documentation built on April 10, 2022, 11:02 a.m.