Setup

To follow the demonstrations of this presentation you will need R installed and an IDE like R Studio or Positron.

And some R packages, please copy paste this code to make sure you have all the packages we need:

install.packages(c(
  "CDMConnector", "duckdb", "CohortConstructor", "PhenotypeR", "gt", "visOmopResults",
  "ggplot2", "plotly", "flextable", "omock", "here", "CohortSurvival"
))

In addition we will use synthetic OMOP CDM datasets to conduct the workshop. In order to download your data set in your laptop you must follow these steps:

  • Create a folder: For example: ‘/Users/martics/Documents/OMOP/’

  • Open your R environment file, run the following code in the console:

usethis::edit_r_environ()
  • Write the following:
OMOP_DATA_FOLDER="path/to/your/folder"
  • Restart R
options(timeout = 600)
omock::downloadMockDataset(datasetName = "synpuf-1k_5.3")
omock::downloadMockDataset(datasetName = "delphi-100k_5.4")

If you are all set you should be able to run the following code:

library(omock)
library(CohortConstructor)
Warning: package 'CohortConstructor' was built under R version 4.4.3
library(PhenotypeR)
cdm <- mockCdmFromDataset(datasetName = "synpuf-1k_5.3", source = "duckdb")
cdm
── # OMOP CDM reference (duckdb) of synpuf-1k_5.3 ──────────────────────────────
• omop tables: care_site, cdm_source, concept, concept_ancestor, concept_class,
concept_relationship, concept_synonym, condition_era, condition_occurrence,
cost, death, device_exposure, domain, dose_era, drug_era, drug_exposure,
drug_strength, fact_relationship, location, measurement, metadata, note,
note_nlp, observation, observation_period, payer_plan_period, person,
procedure_occurrence, provider, relationship, source_to_concept_map, specimen,
visit_detail, visit_occurrence, vocabulary
• cohort tables: -
• achilles tables: -
• other tables: -

Alternatively you can connect to an smaller dataset: GiBleed

cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb")
ℹ Loading bundled GiBleed tables from package data.
ℹ Adding drug_strength table.
ℹ Creating local <cdm_reference> object.
ℹ Inserting <cdm_reference> into duckdb.
cdm

── # OMOP CDM reference (duckdb) of GiBleed ────────────────────────────────────
• omop tables: care_site, cdm_source, concept, concept_ancestor, concept_class,
concept_relationship, concept_synonym, condition_era, condition_occurrence,
cost, death, device_exposure, domain, dose_era, drug_era, drug_exposure,
drug_strength, fact_relationship, location, measurement, metadata, note,
note_nlp, observation, observation_period, payer_plan_period, person,
procedure_occurrence, provider, relationship, source_to_concept_map, specimen,
visit_detail, visit_occurrence, vocabulary
• cohort tables: -
• achilles tables: -
• other tables: -

Alternative (use posit cloud)

Join posit cloud here.