### Install CodelistGenerator Development Version Source: https://github.com/darwin-eu/codelistgenerator/blob/main/README.md Install the latest development version of CodelistGenerator from GitHub using the remotes package. ```r install.packages("remotes") remotes::install_github("darwin-eu/CodelistGenerator") ``` -------------------------------- ### Install CodelistGenerator from CRAN Source: https://github.com/darwin-eu/codelistgenerator/blob/main/README.md Use this command to install the stable version of the CodelistGenerator package from CRAN. ```r install.packages("CodelistGenerator") ``` -------------------------------- ### Get Vocabulary Version Source: https://github.com/darwin-eu/codelistgenerator/blob/main/README.md Retrieve the version of the OMOP CDM vocabulary used in the connected CDM database. ```r vocabularyVersion(cdm = cdm) ``` -------------------------------- ### Get Candidate Codes for Asthma (Excluding Childhood) Source: https://github.com/darwin-eu/codelistgenerator/blob/main/README.md Refine the search for 'asthma' by excluding concepts containing 'childhood'. This helps in focusing the search on relevant conditions. ```r asthma_codes2 <- getCandidateCodes( cdm = cdm, keywords = "asthma", exclude = "childhood", domains = "Condition" ) asthma_codes2 |> glimpse() ``` -------------------------------- ### Get Drug Ingredient Codes Source: https://github.com/darwin-eu/codelistgenerator/blob/main/README.md Extract concept IDs for specified drug ingredients (e.g., aspirin, diclofenac) from the OMOP CDM vocabulary. The output is a list where each element contains the concept IDs for a given ingredient. ```r ing <- getDrugIngredientCodes(cdm = cdm, name = c("aspirin", "diclofenac"), nameStyle = "{concept_name}") ing$aspirin ing$diclofenac ``` -------------------------------- ### Get Candidate Codes for Asthma (Initial Search) Source: https://github.com/darwin-eu/codelistgenerator/blob/main/README.md Perform an initial systematic search for concepts related to 'asthma' within the 'Condition' domain. The results include concept ID, name, domain, vocabulary, and standard concept status. ```r asthma_codes1 <- getCandidateCodes( cdm = cdm, keywords = "asthma", domains = "Condition" ) asthma_codes1 |> glimpse() ``` -------------------------------- ### Connect to Eunomia CDM Database Source: https://github.com/darwin-eu/codelistgenerator/blob/main/README.md Connect to the Eunomia dataset using duckdb and create a CDMConnector object. Ensure Eunomia is required first. ```r requireEunomia() db <- DBI::dbConnect(duckdb::duckdb(), dbdir = eunomiaDir()) cdm <- cdmFromCon(db, cdmSchema = "main", writeSchema = "main", writePrefix = "cg_") ``` -------------------------------- ### Load Required Libraries Source: https://github.com/darwin-eu/codelistgenerator/blob/main/README.md Load dplyr, CDMConnector, and CodelistGenerator libraries for data manipulation and OMOP CDM operations. ```r library(dplyr) library(CDMConnector) library(CodelistGenerator) ``` -------------------------------- ### Summarise Code Use with Flextable Source: https://github.com/darwin-eu/codelistgenerator/blob/main/README.md Summarize the usage of a codelist (e.g., asthma codes) within the CDM and display the results using a styled flextable. This requires the flextable package. ```r library(flextable) asthma_code_use <- summariseCodeUse(list("asthma" = asthma_codes1$concept_id) |> newCodelist(), cdm = cdm ) tableCodeUse(asthma_code_use, type = "flextable", style = "darwin") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.