inst/doc/CreatingCovariatesUsingCohortAttributes.R

## ----echo=FALSE,message=FALSE,warning=FALSE,eval=TRUE-------------------------
library(FeatureExtraction)

## ----tidy=FALSE,eval=FALSE----------------------------------------------------
#  library(SqlRender)
#  sql <- readSql("LengthOfObsCohortAttr.sql")
#  sql <- render(sql,
#    cdm_database_schema = cdmDatabaseSchema,
#    cohort_database_schema = cohortDatabaseSchema,
#    cohort_table = "rehospitalization",
#    cohort_attribute_table = "loo_cohort_attr",
#    attribute_definition_table = "loo_attr_def",
#    cohort_definition_ids = c(1, 2)
#  )
#  sql <- translate(sql, targetDialect = connectionDetails$dbms)
#  
#  connection <- connect(connectionDetails)
#  executeSql(connection, sql)

## ----eval=FALSE---------------------------------------------------------------
#  looCovSet <- createCohortAttrCovariateSettings(
#    attrDatabaseSchema = cohortDatabaseSchema,
#    cohortAttrTable = "loo_cohort_attr",
#    attrDefinitionTable = "loo_attr_def",
#    includeAttrIds = c(),
#    isBinary = FALSE,
#    missingMeansZero = FALSE
#  )

## ----eval=FALSE---------------------------------------------------------------
#  covariates <- getDbCovariateData(
#    connectionDetails = connectionDetails,
#    cdmDatabaseSchema = cdmDatabaseSchema,
#    cohortDatabaseSchema = cohortDatabaseSchema,
#    cohortTable = "rehospitalization",
#    cohortIds = c(1),
#    covariateSettings = looCovSet
#  )

## ----eval=FALSE---------------------------------------------------------------
#  covariateSettings <- createCovariateSettings(
#    useDemographicsGender = TRUE,
#    useDemographicsAgeGroup = TRUE,
#    useDemographicsRace = TRUE,
#    useDemographicsEthnicity = TRUE,
#    useDemographicsIndexYear = TRUE,
#    useDemographicsIndexMonth = TRUE
#  )
#  
#  looCovSet <- createCohortAttrCovariateSettings(
#    attrDatabaseSchema = cohortDatabaseSchema,
#    cohortAttrTable = "loo_cohort_attr",
#    attrDefinitionTable = "loo_attr_def",
#    includeAttrIds = c()
#  )
#  
#  covariateSettingsList <- list(covariateSettings, looCovSet)
#  
#  covariates <- getDbCovariateData(
#    connectionDetails = connectionDetails,
#    cdmDatabaseSchema = cdmDatabaseSchema,
#    cohortDatabaseSchema = resultsDatabaseSchema,
#    cohortTable = "rehospitalization",
#    cohortIds = c(1),
#    covariateSettings = covariateSettingsList
#  )

Try the FeatureExtraction package in your browser

Any scripts or data that you put into this service are public.

FeatureExtraction documentation built on Oct. 18, 2024, 9:06 a.m.