Skip to content

A function to easily create synthea base synthetic omop CDMs in R

License

Notifications You must be signed in to change notification settings

ablack3/SyntheaCdmFactory

Repository files navigation

SyntheaCdmFactory

The goal of SyntheaCdmFactory is to create synthetic OMOP CDMs

Installation

You can install the development version of SyntheaCdmFactory from GitHub with:

# install.packages("devtools")
devtools::install_github("ablack3/SyntheaCdmFactory")

Example

This is a basic example which shows you how to solve a common problem:

library(SyntheaCdmFactory)

# install the synthea java library. Only do this once.
install_synthea()

# manually download vocab bundle from https://drive.google.com/drive/folders/1JobUvAafcg6xu03kf_NB-iX--iRfiigR?usp=sharing

# point R to the location

# this step might be automated in the future.
vocab_path <- "~/Downloads/vocabulary_bundle_v5_0-22-JUN-22.zip"

# may take a few minutes to run
synthesize_cdm(path = here::here("hiv_cdm.duckdb"), 
               vocab_path = "~/Downloads/vocabulary_bundle_v5_0-22-JUN-22.zip",
               n_persons = 100,
               modules =  "hiv",
               age = c(0, 100),
               format = "duckdb",
               overwrite = TRUE,
               seed = 1)

Now we have a new cdm with 100 HIV patients

con <- DBI::dbConnect(duckdb::duckdb(), here::here("hiv_cdm.duckdb"))

DBI::dbListTables(con)

DBI::dbGetQuery(con, "select count(*) as n_persons from main.person;")

Attribution

This package relies heavily on code copied from ETLSyntheaBuilder by Anthony Molinaro, Clair Blacketer, and Frank DeFalco and would not be possible without their work.

About

A function to easily create synthea base synthetic omop CDMs in R

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages