Load all data needed to perform an SCCS analysis from the database.

getDbSccsData(
connectionDetails,
cdmDatabaseSchema,
oracleTempSchema = cdmDatabaseSchema,
outcomeDatabaseSchema = cdmDatabaseSchema,
outcomeTable = "condition_era",
outcomeIds,
exposureDatabaseSchema = cdmDatabaseSchema,
exposureTable = "drug_era",
exposureIds = c(),
useCustomCovariates = FALSE,
customCovariateDatabaseSchema = cdmDatabaseSchema,
customCovariateTable = "cohort",
customCovariateIds = c(),
useNestingCohort = FALSE,
nestingCohortDatabaseSchema = cdmDatabaseSchema,
nestingCohortTable = "cohort",
nestingCohortId = NULL,
deleteCovariatesSmallCount = 100,
studyStartDate = "",
studyEndDate = "",
cdmVersion = "5",
maxCasesPerOutcome = 0
)

## Arguments

connectionDetails An R object of type ConnectionDetails created using the function createConnectionDetails in the DatabaseConnector package. The name of the database schema that contains the OMOP CDM instance. Requires read permissions to this database. On SQL Server, this should specifiy both the database and the schema, so for example 'cdm_instance.dbo'. A schema where temp tables can be created in Oracle. The name of the database schema that is the location where the data used to define the outcome cohorts is available. If outcomeTable = CONDITION_ERA, outcomeDatabaseSchema is not used. Requires read permissions to this database. The tablename that contains the outcome cohorts. If outcomeTable is not CONDITION_OCCURRENCE or CONDITION_ERA, then expectation is outcomeTable has format of COHORT table: COHORT_DEFINITION_ID, SUBJECT_ID, COHORT_START_DATE, COHORT_END_DATE. A list of ids used to define outcomes. If outcomeTable = CONDITION_OCCURRENCE, the list is a set of ancestor CONCEPT_IDs, and all occurrences of all descendant concepts will be selected. If outcomeTable <> CONDITION_OCCURRENCE, the list contains records found in COHORT_DEFINITION_ID field. The name of the database schema that is the location where the exposure data used to define the exposure cohorts is available. If exposureTable = DRUG_ERA, exposureDatabaseSchema is not used but assumed to be cdmSchema. Requires read permissions to this database. The tablename that contains the exposure cohorts. If exposureTable <> DRUG_ERA, then expectation is exposureTable has format of COHORT table: cohort_concept_id, SUBJECT_ID, COHORT_START_DATE, COHORT_END_DATE. A list of identifiers to define the exposures of interest. If exposureTable = DRUG_ERA, exposureIds should be CONCEPT_ID. If exposureTable <> DRUG_ERA, exposureIds is used to select the cohort_concept_id in the cohort-like table. If no exposureIds are provided, all drugs or cohorts in the exposureTable are included as exposures. Create covariates from a custom table? The name of the database schema that is the location where the custom covariate data is available. Name of the table holding the custom covariates. This table should have the same structure as the cohort table. A list of cohort definition IDS identifying the records in the customCovariateTable to use for building custom covariates. Should the study be nested in a cohort (e.g. people with a specific indication)? If not, the study will be nested in the general population. The name of the database schema that is the location where the nesting cohort is defined. Name of the table holding the nesting cohort. This table should have the same structure as the cohort table. A cohort definition ID identifying the records in the nestingCohortTable to use as nesting cohort. The minimum count for a covariate to appear in the data to be kept. A calendar date specifying the minimum date where data is used. Date format is 'yyyymmdd'. A calendar date specifying the maximum date where data is used. Date format is 'yyyymmdd'. Define the OMOP CDM version used: currently support "4" and "5". If there are more than this number of cases for a single outcome cases will be sampled to this size. maxCasesPerOutcome = 0 indicates no maximum size.

## Value

Returns an object of type sccsData, containing information on the cases, their outcomes, exposures, and potentially other covariates. Information about multiple outcomes can be captured at once for efficiency reasons. This object is a list with the following components:

cases

An ffdf object listing the persons that have the outcome(s), their age, and observation time.

eras

An ffdf object listing the exposures, outcomes and other covariates.

covariateRef

An ffdf object describing the covariates that have been extracted.

A list of objects with information on how the sccsData object was constructed.

The generic summary() function has been implemented for this object.

## Details

Five different database schemas can be specified, for five different types of information: The cdmDatabaseSchema is used to extract patient age and observation period. The outcomeDatabaseSchema is used to extract information about the outcomes, the exposureDatabaseSchema is used to retrieve information on exposures, and the customCovariateDatabaseSchema is optionally used to find additional, user-defined covariates. All four locations could point to the same database schema. nestingCohortDatabaseSchema is optionally used to define a cohort in which the analysis is nested, for example a cohort of diabetics patients.