Function for creating dataset which can be used as input for Cohort2Trajectory package
createC2TInput.Rd
Function for creating dataset which can be used as input for Cohort2Trajectory package
Examples
if (FALSE) { # \dontrun{
data <- readRDS("./snapshots/CohortContrastDataSnapshot.rds")
user <- Sys.getenv("DB_USERNAME")
pw <- Sys.getenv("DB_PASSWORD")
server <- stringr::str_c(Sys.getenv("DB_HOST"), "/", Sys.getenv("DB_NAME"))
port <- Sys.getenv("DB_PORT")
cdmSchema <-
Sys.getenv("OHDSI_CDM")
cdmVocabSchema <-
Sys.getenv("OHDSI_VOCAB")
cdmResultsSchema <-
Sys.getenv("OHDSI_RESULTS")
writeSchema <-
Sys.getenv("OHDSI_WRITE")
writePrefix <- "cc_"
db = DBI::dbConnect(
RPostgres::Postgres(),
dbname = Sys.getenv("DB_NAME"),
host = Sys.getenv("DB_HOST"),
user = Sys.getenv("DB_USERNAME"),
password = Sys.getenv("DB_PASSWORD"),
port = port
)
cdm <- CDMConnector::cdmFromCon(
con = db,
cdmSchema = cdmSchema,
achillesSchema = cdmResultsSchema,
writeSchema = list(schema = writeSchema, prefix = writePrefix)
)
data = createC2TInput(data, cdm)
} # }