instantiateCohortSet: Instantiate a set of cohort

View source: R/CohortConstruction.R

instantiateCohortSetR Documentation

Instantiate a set of cohort

Description

This function instantiates a set of cohort in the cohort table, using definitions that are fetched from a WebApi interface. Optionally, the inclusion rule statistics are computed and stored in the inclusionStatisticsFolder.

Usage

instantiateCohortSet(
  connectionDetails = NULL,
  connection = NULL,
  cdmDatabaseSchema,
  oracleTempSchema = NULL,
  cohortDatabaseSchema = cdmDatabaseSchema,
  cohortTable = "cohort",
  cohortIds = NULL,
  minCellCount,
  generateInclusionStats = FALSE,
  inclusionStatisticsFolder = NULL,
  createCohortTable = FALSE,
  incremental = FALSE,
  incrementalFolder = NULL
)

Arguments

connectionDetails

An object of type connectionDetails as created using the createConnectionDetails function in the DatabaseConnector package. Can be left NULL if connection is provided.

connection

An object of type connection as created using the connect function in the DatabaseConnector package. Can be left NULL if connectionDetails is provided, in which case a new connection will be opened at the start of the function, and closed when the function finishes.

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'.

oracleTempSchema

Should be used in Oracle to specify a schema where the user has write privileges for storing temporary tables.

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.

cohortIds

Optionally, provide a subset of cohort IDs to restrict the construction to.

generateInclusionStats

Compute and store inclusion rule statistics?

inclusionStatisticsFolder

The folder where the inclusion rule statistics are stored. Can be left NULL if generateInclusionStats = FALSE.

createCohortTable

Create the cohort table? If incremental = TRUE and the table already exists this will be skipped.

incremental

Create only cohorts that haven't been created before?

incrementalFolder

If incremental = TRUE, specify a folder where records are kept of which definition has been executed.

packageName

The name of the package containing the cohort definitions. Can be left NULL if baseUrl and cohortSetReference have been specified.

cohortToCreateFile

The location of the cohortToCreate file within the package. Is ignored if baseUrl and cohortSetReference have been specified.

baseUrl

The base URL for the WebApi instance, for example: "http://server.org:80/WebAPI". Can be left NULL if packageName and cohortToCreateFile have been specified.

cohortSetReference

A data frame with four columns, as described in the details. Can be left NULL if packageName and cohortToCreateFile have been specified.

Details

Currently two ways of executing this function are supported, either (1) embedded in a study package, assuming the cohort definitions are stored in that package using the ROhdsiWebApi::insertCohortDefinitionSetInPackage, or (2) by using a WebApi interface to retrieve the cohort definitions.

When using this function from within a study package, use the packageName and cohortToCreateFile to specify the name of the study package, and the name of the cohortToCreate file within that package, respectively

When using this function using a WebApi interface, use the baseUrl and cohortSetReference to specify how to connect to the WebApi, and which cohorts to fetch, respectively.

The cohortSetReference argument must be a data frame with the following columns:

atlasId

The cohort ID in ATLAS.

atlasName

The full name of the cohort. This will be shown in the Shiny app.

cohortId

The cohort ID to use in the package. Usually the same as the cohort ID in ATLAS.

name

A short name for the cohort, to use to create file names. do not use special characters.


ohdsi-studies/IbdCharacterization documentation built on July 26, 2024, 11:20 p.m.