Creates a set of predefined cohorts in a cohort table. WARNING: this will delete all existing cohorts in the table!

createCohorts(
  connectionDetails,
  cdmDatabaseSchema = "main",
  cohortDatabaseSchema = "main",
  cohortTable = "cohort"
)

Arguments

connectionDetails

The connection details to connect to the (Eunomia) database.

cdmDatabaseSchema

The name of the database schema holding the CDM data.

cohortDatabaseSchema

The name of the database schema where the cohorts will be written.

cohortTable

The name of the table in the cohortDatabaseSchema where the cohorts will be written.

Value

A data frame listing all created cohorts.

Examples

connectionDetails <- getEunomiaConnectionDetails()
createCohorts(connectionDetails)

connection <- connect(connectionDetails)

sql <- "SELECT COUNT(*)
FROM main.cohort
WHERE cohort_definition_id = 1;"

renderTranslateQuerySql(connection, sql)

disconnect(connection)