Given a set of instantiated cohorts get time series for the cohorts.
Source:R/TimeSeries.R
runCohortTimeSeriesDiagnostics.Rd
This function first generates a calendar period table, that has
calendar intervals between the timeSeriesMinDate
and timeSeriesMaxDate
.
Calendar Month, Quarter and year are supported.
For each of the calendar interval, time series data are computed. The returned
object is a R dataframe that will need to be converted to a time series object
to perform time series analysis.
Data Source time series: computes time series at the data source level i.e. observation period table. This output is NOT limited to individuals in the cohort table but is for ALL people in the datasource (i.e. present in observation period table)
Usage
runCohortTimeSeriesDiagnostics(
connectionDetails = NULL,
connection = NULL,
tempEmulationSchema = NULL,
cdmDatabaseSchema,
cohortDatabaseSchema = cdmDatabaseSchema,
cohortTable = "cohort",
runCohortTimeSeries = TRUE,
runDataSourceTimeSeries = FALSE,
timeSeriesMinDate = as.Date("1980-01-01"),
timeSeriesMaxDate = as.Date(Sys.Date()),
stratifyByGender = TRUE,
stratifyByAgeGroup = TRUE,
cohortIds = NULL
)
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.- 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.
- 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'.
- cohortDatabaseSchema
Schema name where your cohort table resides. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'.
- cohortTable
Name of the cohort table.
- runCohortTimeSeries
Generate and export the cohort level time series?
- runDataSourceTimeSeries
Generate and export the Data source level time series? i.e. using all persons found in observation period table.
- timeSeriesMinDate
(optional) Minimum date for time series. Default value January 1st 1980.
- timeSeriesMaxDate
(optional) Maximum date for time series. Default value System date.
- stratifyByGender
Do you want to stratify by Gender
- stratifyByAgeGroup
Do you want to stratify by Age group
- cohortIds
A vector of one or more Cohort Ids to compute time distribution for.