Skip to contents

Executes IR analysis given a design, options, and connection settings.

Usage

executeAnalysis(
  connectionDetails = NULL,
  connection = NULL,
  incidenceDesign,
  buildOptions,
  sourceName = "default"
)

Arguments

connectionDetails

An R object of type connectionDetails created using the function createConnectionDetails in the DatabaseConnector package. Either the connection or connectionDetails argument should be specified.

connection

A connection to the server containing the schema as created using the connect function in the DatabaseConnector package. Either the connection or connectionDetails argument should be specified.

incidenceDesign

A string object containing valid JSON that represents cohort incidence design

buildOptions

the parameters to use in building the analysis queries, created by buildOptions()

sourceName

the source name to attach to the results

Value

A named list of data.frame objects containing the IR results. The list includes incidence_summary, target_def, outcome_def, tar_def, age_group_def, and subgroup_def, each representing one result table produced during execution.

Details

This method performs the entire cohort incidence analysis in one step without the need for creating any permenant tables.

The process for calculating the cohort incidence is as follows:

  • Create the time at risk episodes from the target cohorts, using the specified startWith, endWith and offsets

  • Calculate the excluded time by finding the overlap of TAR with the following:

    1. Outcome cohort episodes (adding the clean window to each outcome episode end date)

    1. Exclusion cohort that was specified in the outcome definition excludeCohortId.

  • Count the distinct persons, distinct persons with cases, total time at risk and total cases, and calcuate the proportion and rates.

The resut contains the following dataframes:

incidence_summary:

NameDescription
REF_IDThe reference id specified in buildOptions() to track results to the analysis execution.
SOURCE_NAMEThe name of the source for these results
TARGET_COHORT_DEFIITION_IDThe cohort ID of the target population
TAR_IDThe TAR identifier
SUBGROUP_IDThe subgroup identifier
OUTCOME_IDThe outcome identifier
AGE_GROUP_IDThe age ID for this strata representing the age band specified in the strata settings
GENDER_IDThe gender concept ID for this gender strata
GENDER_NAMEThe name of the gender
START_YEARThe year strata, defined by using the year the TAR started
PERSONS_AT_RISK_PEDistinct persons at risk before removing excluded time from TAR
PERSONS_AT_RISKDistinct persons at risk after removing excluded time from TAR. A person must have at least 1 day TAR to be included.
PERSON_DAYS_PETotal TAR (in days) before excluded time was removed from TAR.
PERSON_DAYSTotal TAR (in days) after excluded time was removed from TAR.
PERSON_OUTCOMES_PEDistinct persons with outcome before removing excluded time from TAR
PERSON_OUTCOMESDistinct persons with outcome after removing excluded time from TAR. A person must have at least 1 day TAR to be included.
OUTCOMES_PENumber of cases before excluding TAR.
OUTCOMESNumber of cases after excluding TAR.
INCIDENCE_PROPORTION_P100PThe Incidence Proportion (per 100 people), calculated by person_outcomes / persons_at_risk * 100
INCIDENCE_RATE_P100PYThe Incidence Rate (per 100 person years), calculated by outcomes / person_days / 365.25 * 100
target_def:
NameDescription
—–——–
REF_IDThe reference id specified in buildOptions() to track results to the analysis execution.
TARGET_COHORT_DEFIITION_IDThe cohort ID of the target population
TARGET_NAMEThe name of the target cohort

outcome_def:

NameDescription
REF_IDThe reference id specified in buildOptions() to track results to the analysis execution.
OUTCOME_IDThe outcome identifier
OUTCOME_COHORT_DEFINITION_IDThe cohort ID of the outcome population
OUTCOME_NAMEThe outcome name
CLEAN_WINDOWThe clean window for this outcome definition
EXCLUDED_COHORT_DEFINITION_IDThe cohort used to exclude TAR

tar_def:

NameDescription
REF_IDThe reference id specified in buildOptions() to track results to the analysis execution.
TAR_IDThe TAR identifier
TAR_START_WITHIndicates if the TAR starts with the 'start' or 'end' of the target cohort episode
TAR_START_OFFSETThe days added to the date field specified in TAR_START_WITH
TAR_END_WITHIndicates if the TAR ends with the 'start' or 'end' of the target cohort episode
TAR_END_OFFSETThe days added to the date field specified in TAR_END_WITH

age_group_def:

NameDescription
REF_IDThe reference id specified in buildOptions() to track results to the analysis execution.
AGE_GROUP_IDThe age ID for this strata representing the age band specified in the strata settings
AGE_GROUP_NAMEThe name for this age group
MIN_AGEThe minimum age for this group
MAX_AGEthe max age for this group

subgroup_def:

NameDescription
REF_IDThe reference id specified in buildOptions() to track results to the analysis execution.
SUBGROUP_NAMEThe name of the subgroup