getCohortCovariateData {PatientLevelPrediction} | R Documentation |
Extracts covariates based on cohorts
Description
Extracts covariates based on cohorts
Usage
getCohortCovariateData(
connection,
tempEmulationSchema = NULL,
oracleTempSchema = NULL,
cdmDatabaseSchema,
cdmVersion = "5",
cohortTable = "#cohort_person",
rowIdField = "row_id",
aggregated,
cohortIds,
covariateSettings,
...
)
Arguments
connection |
The database connection |
tempEmulationSchema |
The schema to use for temp tables |
oracleTempSchema |
DEPRECATED The temp schema if using oracle |
cdmDatabaseSchema |
The schema of the OMOP CDM data |
cdmVersion |
version of the OMOP CDM data |
cohortTable |
the table name that contains the target population cohort |
rowIdField |
string representing the unique identifier in the target population cohort |
aggregated |
whether the covariate should be aggregated |
cohortIds |
cohort id for the target cohort |
covariateSettings |
settings for the covariate cohorts and time periods |
... |
additional arguments from FeatureExtraction |
Details
The user specifies a cohort and time period and then a covariate is constructed whether they are in the cohort during the time periods relative to target population cohort index
Value
CovariateData object with covariates, covariateRef, and analysisRef tables
Examples
library(DatabaseConnector)
connectionDetails <- Eunomia::getEunomiaConnectionDetails()
# create some cohort of people born in 1969, index date is their date of birth
con <- connect(connectionDetails)
executeSql(con, "INSERT INTO main.cohort
SELECT 1969 as COHORT_DEFINITION_ID, PERSON_ID as SUBJECT_ID,
BIRTH_DATETIME as COHORT_START_DATE, BIRTH_DATETIME as COHORT_END_DATE
FROM main.person WHERE YEAR_OF_BIRTH = 1969")
covariateData <- getCohortCovariateData(connection = con,
cdmDatabaseSchema = "main",
aggregated = FALSE,
rowIdField = "SUBJECT_ID",
cohortTable = "cohort",
covariateSettings = createCohortCovariateSettings(
cohortName="summerOfLove",
cohortId=1969,
settingId=1,
cohortDatabaseSchema="main",
cohortTable="cohort"))
covariateData$covariateRef
covariateData$covariates
[Package PatientLevelPrediction version 6.4.1 Index]