### Install DrugExposureDiagnostics from CRAN Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Use this command to install the stable version of the package from CRAN. ```r install.packages("DrugExposureDiagnostics") ``` -------------------------------- ### Install DrugExposureDiagnostics Development Version Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Use this command to install the latest development version of the package from GitHub. Requires the 'remotes' package. ```r install.packages("remotes") remotes::install_github("darwin-eu/DrugExposureDiagnostics") ``` -------------------------------- ### Connect to Mock Database Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Establishes a connection to a mock drug exposure database using the mockDrugExposure() function. This is a simplified setup for demonstration purposes. ```r # conn <- DBI::dbConnect( # RPostgres::Postgres(), # dbname = dbname, # port = port, # host = host, # user = user, # password = password, # bigint = c("numeric") # ) # cdm <- CDMConnector::cdmFromCon( # con = conn, # cdmSchema = "cdm schema name" # ) cdm <- mockDrugExposure() ``` -------------------------------- ### Load Required Libraries Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Loads the necessary R libraries for using the DrugExposureDiagnostics package and its dependencies. ```r library(DrugExposureDiagnostics) library(CDMConnector) library(dplyr) ``` -------------------------------- ### Accessing Drug Exposure Check Results Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Demonstrates how to access overall and concept-specific drug exposure duration check results from the 'all_checks' object. These results are typically tibbles containing various statistical summaries. ```r all_checks$drugExposureDurationOverall #> # A tibble: 1 × 18 #> # Rowwise: ingredient_concept_id #> ingredient_concept_id ingredient n_records n_sample n_person #> #> 1 1125315 acetaminophen 44 10000 25 #> # ℹ 13 more variables: n_non_negative_days , n_negative_days , #> # proportion_negative_days , minimum_drug_exposure_days , #> # q05_drug_exposure_days , q10_drug_exposure_days , #> # q25_drug_exposure_days , median_drug_exposure_days , #> # q75_drug_exposure_days , q90_drug_exposure_days , #> # q95_drug_exposure_days , maximum_drug_exposure_days , #> # result_obscured all_checks$drugExposureDurationByConcept #> # A tibble: 6 × 20 #> # Rowwise: drug_concept_id, drug, ingredient_concept_id #> drug_concept_id drug ingredient_concept_id ingredient n_records n_sample #> #> 1 1127078 acetamino… 1125315 acetamino… 8 10000 #> 2 1127433 acetamino… 1125315 acetamino… 8 10000 #> 3 19133768 acetamino… 1125315 acetamino… 8 10000 #> 4 40162522 acetamino… 1125315 acetamino… 12 10000 #> 5 40229134 acetamino… 1125315 acetamino… 6 10000 #> 6 40231925 acetamino… 1125315 acetamino… NA NA #> # ℹ 14 more variables: n_person , n_non_negative_days , #> # n_negative_days , proportion_negative_days , #> # minimum_drug_exposure_days , q05_drug_exposure_days , #> # q10_drug_exposure_days , q25_drug_exposure_days , #> # median_drug_exposure_days , q75_drug_exposure_days , #> # q90_drug_exposure_days , q95_drug_exposure_days , #> # maximum_drug_exposure_days , result_obscured ``` -------------------------------- ### Citation for DrugExposureDiagnostics Package Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md This code displays the recommended citation for the DrugExposureDiagnostics R package, including version and commit information. It also provides a BibTeX entry for LaTeX users. ```r citation("DrugExposureDiagnostics") #> To cite package 'DrugExposureDiagnostics' in publications use:> #> #> Inberg G, Burn E, Burkard T (2026). _DrugExposureDiagnostics:> #> Diagnostics for OMOP Common Data Model Drug Records_. R package> #> version 1.1.7, commit a2252b98a38603ab7c8342d3a91bd25a13ecf65b,> #> .> #> #> A BibTeX entry for LaTeX users is> #> #> @Manual{,> #> title = {DrugExposureDiagnostics: Diagnostics for OMOP Common Data Model Drug Records},> #> author = {Ger Inberg and Edward Burn and Theresa Burkard},> #> year = {2026},> #> note = {R package version 1.1.7, commit a2252b98a38603ab7c8342d3a91bd25a13ecf65b},> #> url = {https://github.com/darwin-eu/DrugExposureDiagnostics},> #> } ``` -------------------------------- ### Write Drug Exposure Check Results to Disk Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Saves the results of drug exposure diagnostics checks to CSV files. Specify the database ID and the output folder where the files should be written. ```r writeResultToDisk( all_checks, databaseId = "Synthea", outputFolder = tempdir() ) ``` -------------------------------- ### Inspect Output Structure Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Displays the names of all the tibbles contained within the output list generated by the executeChecks function. This helps in understanding the structure of the diagnostic results. ```r names(all_checks) ``` -------------------------------- ### Execute All Drug Exposure Checks Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Runs all available diagnostic checks for a specified ingredient (acetaminophen, concept ID 1125315). Ensure the 'bigint' parameter is set correctly when connecting to a real database to avoid merge errors. ```r all_checks <- executeChecks( cdm = cdm, ingredients = 1125315, checks = c( "missing", "exposureDuration", "type", "route", "sourceConcept", "daysSupply", "verbatimEndDate", "dose", "sig", "quantity", "diagnosticsSummary" ) ) ``` -------------------------------- ### Summarize Drug Concept Information Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Displays a detailed summary of the conceptSummary tibble, showing all columns and their data types. This is useful for understanding the structure of the drug concept data. ```r glimpse(all_checks$conceptSummary) ``` -------------------------------- ### Select Drug and Concept ID Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Extracts the 'drug_concept_id' and 'drug' columns from the conceptSummary tibble. This snippet is useful for obtaining a concise list of drug concepts and their identifiers. ```r all_checks$conceptSummary %>% select("drug_concept_id", "drug") ``` -------------------------------- ### View Missing Values by Drug Concept Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Accesses and displays a tibble summarizing missing values broken down by specific drug concepts. This allows for a more granular analysis of data completeness for individual drugs. ```r all_checks$missingValuesByConcept ``` -------------------------------- ### View Overall Missing Values in Drug Exposures Source: https://github.com/darwin-eu/drugexposurediagnostics/blob/main/README.md Accesses and displays a tibble summarizing missing values across all drug exposure records. This is useful for a general overview of data completeness. ```r all_checks$missingValuesOverall ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.