dataExtract: This extracts the history features for each person in the...

Description Usage Arguments Value See Also Examples

Description

This function connects to the CDM and constructs the data used to do the clustering - this is either condition_concept_ids that are recorded during the defined time period relative to the cohort start date for each person in the cohort or covariate concept_sets that are specified by using the 'default' grouping or inputing a dataframe with columns: definition and concept_id specifiying the concept_ids that make up each covariate definition, see examples below.

Usage

1
2
3
4
dataExtract(dbconnection = NULL, cdmDatabaseSchema = NULL,
  cohortDatabaseSchema = NULL, cohortid = 100, ageMin = NULL,
  ageMax = NULL, gender = NULL, type = "group", groupDef = "default",
  historyStart = 1, historyEnd = 180, ffloc = NULL, debug = NULL, ...)

Arguments

dbconnection

class:connectionDetails - the database connection details requires Library(DatabaseConnector)

cdmDatabaseSchema

class:character - database schema containing cdm tables

cohortDatabaseSchema

class:character - database schema containing cohort

cohortid

class:numeric - id of cohort in cohort table

gender

class:numeric - gender concept_id (8507- male; 8532-female)

type

class:character - features used by clustering (condition i.e. all condition_concept_ids or group i.e. concept sets),

groupDef

class:dataframe - a dataframe containing covariate concept_sets - must have the columns definition and concept_id

historyStart

class:numeric days prior to index to start searching person records for features

historyEnd

class:numeric days prior to index to stop searching person records for features

ffloc

class:character - specifies the directory where the ff files are stored

debug

class:character - default(NULL) otherise specifies the directory where the main SQL for extraction is written to for debugging

minAge

class:numeric default(NULL)- the minimum age a person in the cohort must be to be included in the data

maxAge

class:numeric default(NULL)- the maximum age a person in the cohort must be to be included in the data

Value

clusterData class:clusterData - a list containing:

strata

an ffdf containing the age/gender/row_id for each person in the cohort

covariates

an ffdf containing the covariates for each person in the cohort

covariateRef

an ffdf containing details about the covariates

metadata

a list containing details about the data extraction

See Also

DatabaseConnector, OhdsiRTools, SqlRender, ggplot2, reshape2, dplyr, plyr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# to extract the males ages between 30 and 45 in cdm_test.dbo.cohort with id 21
# and find whether they have the default concept definitions 1 to 60 days prior
# to cohort start:
dbconnection <- DatabaseConnector::createConnectionDetails(dbms = dbms,server = server,
user = user,password = pw,port = port,schema = cdmDatabaseSchema)

data <- dataExtract(dbconnection, cdmDatabaseSchema='cdm_test.dbo',
                    cohortDatabaseSchema='cdm_test.dbo', cohort_id=21,
                    minAge = 30, maxAge=45, gender=8507,
                    type='group', groupDef='default',
                    historyStart=1,historyEnd=60,
                    ffloc='C:fftemps')

# to extract the cluster data using user specified concept sets:
# where definition 1 contains concept_ids: 101,32011,1 and 63434
#       definition 2 contains concept_ids: 12,13
#       definition 3 contains concept_ids: 450453,21435324,232,3424,4534435 and 3453
groupDef <- data.frame(covariate=c(1,1,1,1,2,2,3,3,3,3,3,3),
                       concept_id =c(c(101,32011,1,63434), c(12,13),
                                     c(450453,21435324,232,3424,4534435,3453))
data <- dataExtract(dbconnection, cdmDatabaseSchema='cdm_test.dbo',
                    cohortDatabaseSchema='cdm_test.dbo', cohort_id=21,
                    type='group', groupDef=groupDef,
                    historyStart=1,historyEnd=180,
                    ffloc='C:fftemps')

jreps/patientCluster documentation built on May 20, 2019, 10:46 a.m.