Creating covariates using cohort attributes Martijn J. Schuemie 2016-03-28

Contents 1 Introduction

1

2 Overview

1

2.1

Populating the cohort_attribute and attribute_definition tables . . . . . . . . . . . . . . . .

3 Example

1 2

3.1

Creating the cohort attributes and attributes definitions . . . . . . . . . . . . . . . . . . . . .

2

3.2

Using the attributes as covariates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

1

Introduction

This vignette assumes you are already familiar with the FeatureExtraction package. The FeatureExtraction package can generate a default set of covariates, such as one covariate for each condition found in the condition_occurrence table. However, for some reasons one might need other covariates than those included in the default set. In the vignette called Creating custom covariate builders a process is described for creating custom covariate builders that create covariates on the fly and can be re-used across studies. In contrast, this vignette describes a process that uses the cohort_attribute table in the common data model, and assumes the user has already populated this table with the requested covariates.

2

Overview

To construct custom covariates, the following steps must be taken: 1. Populate a table with the same structure as the cohort_attribute table in the common data model. 2. Populate a table with the same structure as the attribute_definition table in the common data model. 3. Use the createCohortAttrCovariateSettings function to create a covariateSettings object pointing to the two tables mentioned in the previous steps.

2.1

Populating the cohort_attribute and attribute_definition tables

The cohort_attribute should specify the values of the covariates for every person-cohort_start_date combination in the cohort(s) of interest. It should at least have the following fields: • cohort_definition_id, A key to link to the cohort table. On CDM v4, this field should be called cohort_concept_id. 1

• • • •

‘subject_id’, A key to link to the cohort table. ‘cohort_start_date’, A key to link to the cohort table. ‘attribute_definition_id’, An foreign key linking to the attribute definition table. ‘value_as_number’, A real number.

The first three fields act as a combined key to link the record to an entry in the cohort table. Note that records with zero values can be omitted. The attribute_definition table defines the attributes. It should have at least the following fields: • ‘attribute_definition_id’, A unique identifier of type integer. • ‘attribute_name’, A short description of the attribute. The first field links to the cohort_attribute table, the second field is used as the covariate name.

3 3.1

Example Creating the cohort attributes and attributes definitions

In this example we will create a single covariate: the length of observation prior to the cohort_start_date. We use the following SQL to construct a cohort_attribute table and a attribute_definition table: /*********************************** File LengthOfObsCohortAttr.sql ***********************************/ IF OBJECT_ID('@cohort_database_schema.@cohort_attribute_table', 'U') IS NOT NULL DROP TABLE @cohort_database_schema.@cohort_attribute_table; IF OBJECT_ID('@cohort_database_schema.@attribute_definition_table', 'U') IS NOT NULL DROP TABLE @cohort_database_schema.@attribute_definition_table; SELECT cohort_definition_id, subject_id, cohort_start_date, 1 AS attribute_definition_id, DATEDIFF(DAY, observation_period_start_date, cohort_start_date) AS value_as_number INTO @cohort_database_schema.@cohort_attribute_table FROM @cohort_database_schema.@cohort_table cohort INNER JOIN @cdm_database_schema.observation_period op ON op.person_id = cohort.subject_id WHERE cohort_start_date >= observation_period_start_date AND cohort_start_date <= observation_period_end_date {@cohort_definition_ids != ''} ? { AND cohort_definition_id IN (@cohort_definition_ids) } ; SELECT 1 AS attribute_definition_id, 'Length of observation in days' AS attribute_name INTO @cohort_database_schema.@attribute_definition_table;

2

We substitute the arguments in this SQL with actual values, translate it to the right SQL dialect, and execute the SQL using SqlRender: library(SqlRender) sql <- readSql("HospitalizationCohorts.sql") sql <- renderSql(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 sql <- translateSql(sql, targetDialect = connectionDetails$dbms)$sql connection <- connect(connectionDetails) executeSql(connection, sql)

3.2

Using the attributes as covariates

To use the constructed attributes as covariates in a predictive model, we need to create a covariateSettings object: looCovSet <- createCohortAttrCovariateSettings(attrDatabaseSchema = cohortDatabaseSchema, cohortAttrTable = "loo_cohort_attr", attrDefinitionTable = "loo_attr_def", includeAttrIds = c()) We can then use these settings to fetch the covariates object: covariates <- getDbCovariateData(connectionDetails = connectionDetails, cdmDatabaseSchema = cdmDatabaseSchema, cohortDatabaseSchema = resultsDatabaseSchema, cohortTable = "rehospitalization", cohortIds = 1, covariateSettings = looCovSet, cdmVersion = cdmVersion) In this case we will have only one covariate for our predictive model, the length of observation. In most cases, we will want our custom covariates in addition to the default covariates. We can do this by creating a list of covariate settings: covariateSettings <- createCovariateSettings(useCovariateDemographics = TRUE, useCovariateDemographicsGender = TRUE, useCovariateDemographicsRace = TRUE, useCovariateDemographicsEthnicity = TRUE, useCovariateDemographicsAge = TRUE, useCovariateDemographicsYear = TRUE, useCovariateDemographicsMonth = TRUE) looCovSet <- createCohortAttrCovariateSettings(attrDatabaseSchema = cohortDatabaseSchema, cohortAttrTable = "loo_cohort_attr", attrDefinitionTable = "loo_attr_def", includeAttrIds = c()) 3

covariateSettingsList <- list(covariateSettings, looCovSet) covariates <- getDbCovariateData(connectionDetails = connectionDetails, cdmDatabaseSchema = cdmDatabaseSchema, cohortDatabaseSchema = resultsDatabaseSchema, cohortTable = "rehospitalization", cohortIds = 1, covariateSettings = covariateSettingsList, cdmVersion = cdmVersion) In this example both demographic covariates and our length of observation covariate will be generated and can be used in our predictive model.

4

Creating covariates using cohort attributes - GitHub

Mar 28, 2016 - 3.1 Creating the cohort attributes and attributes definitions . ... covariate builders that create covariates on the fly and can be re-used across ...

209KB Sizes 3 Downloads 280 Views

Recommend Documents

Creating Boost.Asio extensions - GitHub
What are I/O service objects, I/O services and I/O objects? How do I access ... visible in user code, I/O services do the hard ... Not all I/O services share a system ...

Creating signatures for ClamAV - GitHub
Dec 9, 2007 - 2 Debug information from libclamav .... The hash-based signatures shall not be used for text files, HTML and any other .... 10 = PDF files.

Creating custom covariate builders - GitHub
Mar 28, 2016 - A function that creates a covariateSettings object for the custom covariates. 2. ... cdmDatabaseSchema: The name of the database schema that ...

time-lapse attributes storage sites using novel 2 ...
Oct 16, 2013 - to receive free e-mail alerts when new articles cite this article here click ... Downloaded from ... the three-dimensional (3D) distribution of CO2 during the injec- ..... Novel time-lapse AVA attributes. 360 δθ δθ. t f. t f. W t f

Using py-aspio - GitHub
Jan 17, 2017 - Load ASP program and input/output specifications from file ..... Programs can be loaded from files or strings: .... AI Magazine, 37(3):53–68.

Using FeatureExtraction - GitHub
Oct 27, 2017 - Venous thrombosis. 3. 20-24. 2. Medical history: Neoplasms. 25-29. 4. Hematologic neoplasm. 1. 30-34. 6. Malignant lymphoma. 0. 35-39. 7. Malignant neoplasm of anorectum. 0. 40-44. 9. Malignant neoplastic disease. 6. 45-49. 11. Maligna

Using SqlRender - GitHub
6. 3.5 Case sensitivity in string comparisons . .... would have had no clue the two fields were strings, and would incorrectly leave the plus sign. Another clue that.

Attributes-Attitudes.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item.

Creating a Native iOS Warehouse Application - GitHub
Dec 13, 2013 - 3. Step 3: Run the New iOS App. Tutorial: Creating a Native iOS Warehouse App ... To call this method, the app sends a message to the shared ..... Use the Xcode editor to add these stubs the same way you added the ...

Species Identification using MALDIquant - GitHub
Jun 8, 2015 - Contents. 1 Foreword. 3. 2 Other vignettes. 3. 3 Setup. 3. 4 Dataset. 4. 5 Analysis. 4 .... [1] "F10". We collect all spots with a sapply call (to loop over all spectra) and ..... similar way as the top 10 features in the example above.

Introduction to phylogenetics using - GitHub
Oct 6, 2016 - 2.2 Building trees . ... Limitations: no model comparison (can't test for the 'best' tree, or the 'best' model of evolution); may be .... more efficient data reduction can be achieved using the bit-level coding of polymorphic sites ....

Instructions for using FALCON - GitHub
Jul 11, 2014 - College of Life and Environmental Sciences, University of Exeter, ... used in FALCON is also available (see FALCON_Manuscript.pdf. ). ... couraged to read the accompanying technical document to learn ... GitHub is an online repository

Creating a Modern PhoneGap Plugin - GitHub
Social Plugins: Email, X SocialSharing. Audio Plugins: DBMeter, Native Audio, Media Picker. Misc: Barcode Scanner, In App Purchase, Google Maps, Vuforia (AR), Microsoft ACE. (native controls), Tesseract (OCR, iOS). Photo by skeeze (https://pixabay.co

Multichannel Shopper Segments and Their Covariates (PDF ...
that make shopping more enjoyable, Indeed, this approach views .... nicely with this point of view. That is ...... Profile of the final segments (LCA) (N= 360).

sim-cohort-3-flier.pdf
Number CMS-1G1-14-001 from the U.S Department of Health. and Human Services (HHS), Centers for Medicare & Medicaid. Services (CMS). The Colorado State Innovation Model (SIM), a. four-year initiative, is funded by up to $65 million from CMS. The conte

Google​​Finance​​Attributes
"​marketcap​"​​-​​The​​market​​capitalization​​of​​the​​stock. ... "​shares​"​​-​​The​​number​​of​​outstanding​​shares.

Creating Thinking Maps Using PowerPoint
Jul 21, 2008 - shapes using auto shapes. ▫ Use text boxes where needed. ▫ Insert pictures using clip art. ▫ Apply sounds and animation using action settings. Sports ... Three Little. Pigs. Goldilocks and the. Three. Bears. Animals. Woods. Wolf.

Vector Autoregressive Model with Covariates -
Dec 11, 2015 - Multivariate autogressive (MAR) and vector autoregressive (VAR) are the same thing, ecologists call them. MAR. Here we fit a MAR(1) model and include covariates. The model is fit using stats::ar(), vars::VAR(), and a model written in S

Single studies using the CaseControl package - GitHub
Jun 29, 2016 - Loading data on the cases and potential controls from the database .... for which no matching control was found be removed from the analysis.

Using the USART in AVR-GCC - GitHub
Jul 17, 2016 - 1.1 What is the USART? ... three wires for bi-directional communication (Rx, Tx and GND). 1.2 The .... #define USART_BAUDRATE 9600.

Image matting using comprehensive sample sets - GitHub
Mar 25, 2014 - If αz = 1 or 0, we call pixel z definite foreground or definite background, ..... In Proceedings of the 2013 IEEE Conference on Computer Vi-.

Single studies using the SelfControlledCaseSeries package - GitHub
Transforming the data into a format suitable for an SCCS study. .... Now we can tell SelfControlledCaseSeries to extract all necessary data for our analysis:.