View source: R/exportPatientLevel.R
exportPatientLevel | R Documentation |
Exports patient-level files for custom data analysis.
exportPatientLevel(andromeda, outputPath)
andromeda |
( |
outputPath |
( |
NULL
if (interactive()) {
library(CDMConnector)
library(DBI)
library(TreatmentPatterns)
con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomiaDir())
cdm <- cdmFromCon(con, cdmSchema = "main", writeSchema = "main")
cohortSet <- readCohortSet(
path = system.file(package = "TreatmentPatterns", "exampleCohorts")
)
cdm <- generateCohortSet(
cdm = cdm,
cohortSet = cohortSet,
name = "cohort_table"
)
cohorts <- cohortSet %>%
# Remove 'cohort' and 'json' columns
select(-"cohort", -"json") %>%
mutate(type = c("event", "event", "event", "event", "exit", "event", "event", "target")) %>%
rename(
cohortId = "cohort_definition_id",
cohortName = "cohort_name",
) %>%
select("cohortId", "cohortName", "type")
outputEnv <- computePathways(
cohorts = cohorts,
cohortTableName = "cohort_table",
cdm = cdm
)
exportPatientLevel(outputEnv, tempdir())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.