Skip to contents

This function extracts all incidence rates across databases in the results for specified target and outcome cohorts.

Usage

getIncidenceRates(
  connectionHandler,
  schema,
  ciTablePrefix = "ci_",
  cgTablePrefix = "cg_",
  databaseTable = "database_meta_data",
  targetIds = NULL,
  outcomeIds = NULL
)

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)

ciTablePrefix

The prefix used for the cohort incidence 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')

targetIds

A vector of integers corresponding to the target cohort IDs

outcomeIds

A vector of integers corresponding to the outcome cohort IDs

Value

Returns a data.frame with the columns:

  • databaseName the name of the database

  • targetName the target cohort name

  • targetId the target cohort unique identifier

  • outcomeName the outcome name

  • outcomeId the outcome unique identifier

  • cleanWindow clean windown around outcome

  • subgroupName name for the result subgroup

  • ageGroupName name for the result age group

  • genderName name for the result gender group

  • startYear name for the result start year

  • tarStartWith time at risk start reference

  • tarStartOffset time at risk start offset from reference

  • tarEndWith time at risk end reference

  • tarEndOffset time at risk end offset from reference

  • personsAtRiskPe persons at risk per event

  • personsAtRisk persons at risk

  • personDaysPe person days per event

  • personDays person days

  • personOutcomesPe person outcome per event

  • personOutcomes persons outcome

  • outcomesPe number of outcome per event

  • outcomes number of outcome

  • incidenceProportionP100p incidence proportion per 100 persons

  • incidenceRateP100py incidence rate per 100 person years

Details

Specify the connectionHandler, the schema and the target/outcome cohort IDs

Examples

conDet <- getExampleConnectionDetails()

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

ir <- getIncidenceRates(
connectionHandler = connectionHandler, 
schema = 'main'
)