Skip to contents

This function extracts target cohort counts across databases in the results for specified target.

Usage

getTargetCounts(
  connectionHandler,
  schema,
  cTablePrefix = "c_",
  cgTablePrefix = "cg_",
  databaseTable = "database_meta_data",
  characterizationTargetIds = NULL,
  databaseIds = NULL,
  includeNames = TRUE
)

Arguments

connectionHandler

A connection handler that connects to the database and extracts sql queries. Create a connection handler via `ResultModelManager::ConnectionHandler$new()`.

schema

The result database schema (e.g., 'main' for sqlite)

cTablePrefix

The prefix used for the characterization results tables

cgTablePrefix

The prefix used for the cohort generator results tables

databaseTable

The name of the table with the database details (default 'database_meta_data')

characterizationTargetIds

The characterization target cohort ids of interest

databaseIds

(optional) A vector of database IDs to restrict to

includeNames

whether to add the database names and cohort names

Value

Returns a data.frame with the columns:

  • settingId the setting id

  • databaseId the unique identifier of the database

  • characterizationTargetId the target cohort unique identifier

  • N the number of people in the cohort

Details

Specify the connectionHandler, the schema and the characterization target IDs

Examples

conDet <- getExampleConnectionDetails()

connectionHandler <- ResultModelManager::ConnectionHandler$new(conDet)
#> Connecting using SQLite driver

cc <- getTargetCounts(
connectionHandler = connectionHandler, 
schema = 'main'
)