Given a table with cohort_definition_id, subject_id, cohort_start_date, cohort_end_date execute era logic. This will delete and replace the original rows with the cohort_definition_id(s). edit privileges to the cohort table is required.
Usage
eraFyCohorts(
connectionDetails = NULL,
connection = NULL,
sourceCohortDatabaseSchema = NULL,
sourceCohortTable = "cohort",
targetCohortDatabaseSchema = NULL,
targetCohortTable,
oldCohortIds,
newCohortId,
eraconstructorpad = 0,
cdmDatabaseSchema = NULL,
purgeConflicts = FALSE,
isTempTable = FALSE,
tempEmulationSchema = getOption("sqlRenderTempEmulationSchema")
)
Arguments
- connectionDetails
An object of type
connectionDetails
as created using thecreateConnectionDetails
function in the DatabaseConnector package. Can be left NULL ifconnection
is provided.- connection
An object of type
connection
as created using theconnect
function in the DatabaseConnector package. Can be left NULL ifconnectionDetails
is provided, in which case a new connection will be opened at the start of the function, and closed when the function finishes.- sourceCohortDatabaseSchema
Schema name where your source cohort tables reside. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'.
- sourceCohortTable
The name of the source cohort table.
- targetCohortDatabaseSchema
Schema name where your target cohort tables reside. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'.
- targetCohortTable
The name of the target cohort table.
- oldCohortIds
An array of 1 or more integer id representing the cohort id of the cohort on which the function will be applied.
- newCohortId
The cohort id of the output cohort.
- eraconstructorpad
Optional value to pad cohort era construction logic. Default = 0. i.e. no padding.
- cdmDatabaseSchema
Schema name where your patient-level data in OMOP CDM format resides. Note that for SQL Server, this should include both the database and schema name, for example 'cdm_data.dbo'.
- purgeConflicts
If there are conflicts in the target cohort table i.e. the target cohort table already has records with newCohortId, do you want to purge and replace them with transformed. By default - it will not be replaced, and an error message is thrown.
- isTempTable
Is the output a temp table. If yes, a new temp table is created. This will required an active connection. Any old temp table is dropped and replaced.
- tempEmulationSchema
Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created.