Added R project to create pdf
This commit is contained in:
parent
014eafca1b
commit
f7ea9da12b
|
@ -0,0 +1,512 @@
|
|||
library(BigKnn)
|
||||
library(caret)
|
||||
2
|
||||
# general initial settings `50g' means 50GB - you may need to reduce
|
||||
options(fftempdir = "drive:/FFtemp")
|
||||
h2o.init(nthreads = -1, max_mem_size = '50g')
|
||||
dbms <- "pdw"
|
||||
user <- mblacke
|
||||
pw <- N8wgd=p34
|
||||
server <- "jrdusapsctl01"
|
||||
port <- 17001
|
||||
oracleTempSchema <- NULL
|
||||
cdmVersion <- 5
|
||||
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = dbms,
|
||||
server = server,
|
||||
user = user,
|
||||
password = pw,
|
||||
port = port)
|
||||
conn <- DatabaseConnector::connect(connectionDetails)
|
||||
dbms <- "pdw"
|
||||
user <- "mblacke"
|
||||
pw <- "N8wgd=p34"
|
||||
server <- "jrdusapsctl01"
|
||||
port <- 17001
|
||||
oracleTempSchema <- NULL
|
||||
cdmVersion <- 5
|
||||
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = dbms,
|
||||
server = server,
|
||||
user = user,
|
||||
password = pw,
|
||||
port = port)
|
||||
conn <- DatabaseConnector::connect(connectionDetails)
|
||||
dbms="pdw",
|
||||
server="JRDUSAPSCTL01",
|
||||
port="17001"
|
||||
oracleTempSchema <- NULL
|
||||
cdmVersion <- 5
|
||||
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = dbms,
|
||||
server = server,
|
||||
port = port)
|
||||
conn <- DatabaseConnector::connect(connectionDetails)
|
||||
library(DatabaseConnector)
|
||||
library(SqlRender)
|
||||
library(httr)
|
||||
library(RJSONIO)
|
||||
library(reshape2)
|
||||
library('ReporteRs')
|
||||
#=============================================================#
|
||||
#
|
||||
# ADD THE STUDY SETTINGS HERE:
|
||||
#=============================================================#
|
||||
dir <- "\\wprdusmj12rcz\Epi\Mood_Haliperidol\project390"
|
||||
# settings:
|
||||
prior_start <- '2013-07-01'
|
||||
tab_start <- '2014-01-01'
|
||||
tab_end <- '2015-12-31'
|
||||
studytype <- 'new'
|
||||
mingap <- 182
|
||||
install.packages("ReporteRs")
|
||||
library('ReporteRs')
|
||||
getConcepts <- function(conceptSetIdentifiers) {
|
||||
results <- list()
|
||||
length(results) <- length(conceptSetIdentifiers)
|
||||
ind <- 0
|
||||
for (conceptSetIdentifier in conceptSetIdentifiers){
|
||||
ind <- ind+1
|
||||
# get the concept set expression from the webapi
|
||||
conceptSetExpressionUrl = paste("http://hix.jnj.com:8080/WebAPI/conceptset/", conceptSetIdentifier, "/expression", sep = "")
|
||||
## http://hix.jnj.com:8080/WebAPI/VOCAB/vocabulary/lookup/mapped
|
||||
expression <- httr::content(httr::GET(conceptSetExpressionUrl),"text")
|
||||
result <- RJSONIO::fromJSON(expression)
|
||||
concepts <- t(as.data.frame(lapply(result[[1]], function(x) c(x$concept$CONCEPT_ID,
|
||||
x$concept$CONCEPT_CODE,
|
||||
x$concept$CONCEPT_NAME,
|
||||
x$concept$VOCABULARY_ID,
|
||||
x$isExcluded, x$includeDescendants,
|
||||
x$includeMapped)) ))
|
||||
concepts <- as.data.frame(concepts)
|
||||
rownames(concepts) <- NULL
|
||||
colnames(concepts) <- c('concept_id','concept_code','concept_name','vocabulary_id',
|
||||
'exclude','descendants','mapped')
|
||||
concepts[,'exclude'] <- ifelse(concepts[,'exclude']=='TRUE', 1, 0)
|
||||
concepts[,'descendants'] <- ifelse(concepts[,'descendants']=='TRUE', 1, 0)
|
||||
concepts[,'mapped'] <- ifelse(concepts[,'mapped']=='TRUE', 1, 0)
|
||||
# save to temp table
|
||||
connectionDetails <- createConnectionDetails(dbms="pdw",
|
||||
server="JRDUSAPSCTL01",
|
||||
port=17001,
|
||||
user=NULL,
|
||||
password=NULL)
|
||||
conn <- connect(connectionDetails)
|
||||
DatabaseConnector::insertTable(conn, 'concepts', concepts, tempTable = T)
|
||||
# run cocnept_extract sql using temp table
|
||||
sql <- SqlRender::readSql(file.path(dir,'concept_extract.sql'))
|
||||
sql <- SqlRender::renderSql(sql, cdm='Vocabulary')$sql
|
||||
sql <- SqlRender::translateSql(sql, sourceDialect = 'sql server', targetDialect = 'pdw')$sql
|
||||
results[[ind]] <- DatabaseConnector::querySql(conn,sql)
|
||||
}
|
||||
return(results)
|
||||
}
|
||||
conceptSetIds <- list(name=c(#'Agitation, aggression or psychotic Symptoms in dementia together',
|
||||
'Agitation, aggression or psychotic Symptoms in dementia sep',
|
||||
'Tic disorder',
|
||||
'Schizophrenia',
|
||||
'Aggression in children with autism or developmental disorders'),
|
||||
code=list(#2349,
|
||||
c(2478,2479), 2348, 2347,c(2361, 2362)
|
||||
))
|
||||
# put concept sets into inds
|
||||
inds <- lapply(conceptSetIds[[2]], getConcepts)
|
||||
names(inds) <-conceptSetIds[[1]]
|
||||
conceptSetIds
|
||||
inds <- lapply(conceptSetIds[[2]], getConcepts)
|
||||
dir <- "\\wprdusmj12rcz\Epi\Mood_Haliperidol\project390\"
|
||||
dir <- "S:Epi\Mood_Haliperidol\project390\"
|
||||
dir <- "S:Epi/Mood_Haliperidol/project390/"
|
||||
inds <- lapply(conceptSetIds[[2]], getConcepts)
|
||||
inds
|
||||
names(inds) <-conceptSetIds[[1]]
|
||||
getConcepts <- function(conceptSetIdentifiers) {
|
||||
results <- list()
|
||||
length(results) <- length(conceptSetIdentifiers)
|
||||
ind <- 0
|
||||
for (conceptSetIdentifier in conceptSetIdentifiers){
|
||||
ind <- ind+1
|
||||
# get the concept set expression from the webapi
|
||||
conceptSetExpressionUrl = paste("http://hix.jnj.com:8080/WebAPI/conceptset/", conceptSetIdentifier, "/expression", sep = "")
|
||||
## http://hix.jnj.com:8080/WebAPI/VOCAB/vocabulary/lookup/mapped
|
||||
expression <- httr::content(httr::GET(conceptSetExpressionUrl),"text")
|
||||
result <- RJSONIO::fromJSON(expression)
|
||||
concepts <- t(as.data.frame(lapply(result[[1]], function(x) c(x$concept$CONCEPT_ID,
|
||||
x$concept$CONCEPT_CODE,
|
||||
x$concept$CONCEPT_NAME,
|
||||
x$concept$VOCABULARY_ID,
|
||||
x$isExcluded, x$includeDescendants,
|
||||
x$includeMapped)) ))
|
||||
concepts <- as.data.frame(concepts)
|
||||
rownames(concepts) <- NULL
|
||||
colnames(concepts) <- c('concept_id','concept_code','concept_name','vocabulary_id',
|
||||
'exclude','descendants','mapped')
|
||||
concepts[,'exclude'] <- ifelse(concepts[,'exclude']=='TRUE', 1, 0)
|
||||
concepts[,'descendants'] <- ifelse(concepts[,'descendants']=='TRUE', 1, 0)
|
||||
concepts[,'mapped'] <- ifelse(concepts[,'mapped']=='TRUE', 1, 0)
|
||||
# save to temp table
|
||||
connectionDetails <- createConnectionDetails(dbms="pdw",
|
||||
server="JRDUSAPSCTL01",
|
||||
port=17001,
|
||||
user=NULL,
|
||||
password=NULL)
|
||||
conn <- connect(connectionDetails)
|
||||
DatabaseConnector::insertTable(conn, 'scratch.dbo.390_concepts', concepts)#, tempTable = T)
|
||||
# run cocnept_extract sql using temp table
|
||||
sql <- SqlRender::readSql(file.path(dir,'concept_extract.sql'))
|
||||
sql <- SqlRender::renderSql(sql, cdm='Vocabulary')$sql
|
||||
sql <- SqlRender::translateSql(sql, sourceDialect = 'sql server', targetDialect = 'pdw')$sql
|
||||
results[[ind]] <- DatabaseConnector::querySql(conn,sql)
|
||||
}
|
||||
return(results)
|
||||
}
|
||||
conceptSetIds <- list(name=c(#'Agitation, aggression or psychotic Symptoms in dementia together',
|
||||
'Agitation, aggression or psychotic Symptoms in dementia sep',
|
||||
'Tic disorder',
|
||||
'Schizophrenia',
|
||||
'Aggression in children with autism or developmental disorders'),
|
||||
code=list(#2349,
|
||||
c(2478,2479), 2348, 2347,c(2361, 2362)
|
||||
))
|
||||
# put concept sets into inds
|
||||
inds <- lapply(conceptSetIds[[2]], getConcepts)
|
||||
getConcepts <- function(conceptSetIdentifiers) {
|
||||
results <- list()
|
||||
length(results) <- length(conceptSetIdentifiers)
|
||||
ind <- 0
|
||||
for (conceptSetIdentifier in conceptSetIdentifiers){
|
||||
ind <- ind+1
|
||||
# get the concept set expression from the webapi
|
||||
conceptSetExpressionUrl = paste("http://hix.jnj.com:8080/WebAPI/conceptset/", conceptSetIdentifier, "/expression", sep = "")
|
||||
## http://hix.jnj.com:8080/WebAPI/VOCAB/vocabulary/lookup/mapped
|
||||
expression <- httr::content(httr::GET(conceptSetExpressionUrl),"text")
|
||||
result <- RJSONIO::fromJSON(expression)
|
||||
concepts <- t(as.data.frame(lapply(result[[1]], function(x) c(x$concept$CONCEPT_ID,
|
||||
x$concept$CONCEPT_CODE,
|
||||
x$concept$CONCEPT_NAME,
|
||||
x$concept$VOCABULARY_ID,
|
||||
x$isExcluded, x$includeDescendants,
|
||||
x$includeMapped)) ))
|
||||
concepts <- as.data.frame(concepts)
|
||||
rownames(concepts) <- NULL
|
||||
colnames(concepts) <- c('concept_id','concept_code','concept_name','vocabulary_id',
|
||||
'exclude','descendants','mapped')
|
||||
concepts[,'exclude'] <- ifelse(concepts[,'exclude']=='TRUE', 1, 0)
|
||||
concepts[,'descendants'] <- ifelse(concepts[,'descendants']=='TRUE', 1, 0)
|
||||
concepts[,'mapped'] <- ifelse(concepts[,'mapped']=='TRUE', 1, 0)
|
||||
# save to temp table
|
||||
connectionDetails <- createConnectionDetails(dbms="pdw",
|
||||
server="JRDUSAPSCTL01",
|
||||
port=17001,
|
||||
user=NULL,
|
||||
password=NULL)
|
||||
conn <- connect(connectionDetails)
|
||||
DatabaseConnector::insertTable(conn, 'scratch.dbo.concepts_390', concepts)#, tempTable = T)
|
||||
# run cocnept_extract sql using temp table
|
||||
sql <- SqlRender::readSql(file.path(dir,'concept_extract.sql'))
|
||||
sql <- SqlRender::renderSql(sql, cdm='Vocabulary')$sql
|
||||
sql <- SqlRender::translateSql(sql, sourceDialect = 'sql server', targetDialect = 'pdw')$sql
|
||||
results[[ind]] <- DatabaseConnector::querySql(conn,sql)
|
||||
}
|
||||
return(results)
|
||||
}
|
||||
conceptSetIds <- list(name=c(#'Agitation, aggression or psychotic Symptoms in dementia together',
|
||||
'Agitation, aggression or psychotic Symptoms in dementia sep',
|
||||
'Tic disorder',
|
||||
'Schizophrenia',
|
||||
'Aggression in children with autism or developmental disorders'),
|
||||
code=list(#2349,
|
||||
c(2478,2479), 2348, 2347,c(2361, 2362)
|
||||
))
|
||||
# put concept sets into inds
|
||||
inds <- lapply(conceptSetIds[[2]], getConcepts)
|
||||
names(inds) <-conceptSetIds[[1]]
|
||||
getConcepts <- function(conceptSetIdentifiers) {
|
||||
results <- list()
|
||||
length(results) <- length(conceptSetIdentifiers)
|
||||
ind <- 0
|
||||
for (conceptSetIdentifier in conceptSetIdentifiers){
|
||||
ind <- ind+1
|
||||
# get the concept set expression from the webapi
|
||||
conceptSetExpressionUrl = paste("http://hix.jnj.com:8080/WebAPI/conceptset/", conceptSetIdentifier, "/expression", sep = "")
|
||||
## http://hix.jnj.com:8080/WebAPI/VOCAB/vocabulary/lookup/mapped
|
||||
expression <- httr::content(httr::GET(conceptSetExpressionUrl),"text")
|
||||
result <- RJSONIO::fromJSON(expression)
|
||||
concepts <- t(as.data.frame(lapply(result[[1]], function(x) c(x$concept$CONCEPT_ID,
|
||||
x$concept$CONCEPT_CODE,
|
||||
x$concept$CONCEPT_NAME,
|
||||
x$concept$VOCABULARY_ID,
|
||||
x$isExcluded, x$includeDescendants,
|
||||
x$includeMapped)) ))
|
||||
concepts <- as.data.frame(concepts)
|
||||
rownames(concepts) <- NULL
|
||||
colnames(concepts) <- c('concept_id','concept_code','concept_name','vocabulary_id',
|
||||
'exclude','descendants','mapped')
|
||||
concepts[,'exclude'] <- ifelse(concepts[,'exclude']=='TRUE', 1, 0)
|
||||
concepts[,'descendants'] <- ifelse(concepts[,'descendants']=='TRUE', 1, 0)
|
||||
concepts[,'mapped'] <- ifelse(concepts[,'mapped']=='TRUE', 1, 0)
|
||||
# save to temp table
|
||||
connectionDetails <- createConnectionDetails(dbms="pdw",
|
||||
server="JRDUSAPSCTL01",
|
||||
port=17001,
|
||||
user=NULL,
|
||||
password=NULL)
|
||||
conn <- connect(connectionDetails)
|
||||
DatabaseConnector::insertTable(conn, 'scratch.dbo.concepts_390', concepts)#, tempTable = T)
|
||||
# run cocnept_extract sql using temp table
|
||||
sql <- SqlRender::readSql(file.path(dir,'concept_extract.sql'))
|
||||
sql <- SqlRender::renderSql(sql, cdm='Vocabulary')$sql
|
||||
sql <- SqlRender::translateSql(sql, sourceDialect = 'sql server', targetDialect = 'pdw')$sql
|
||||
results[[ind]] <- DatabaseConnector::querySql(conn,sql)
|
||||
}
|
||||
return(results)
|
||||
}
|
||||
conceptSetIds <- list(name=c(#'Agitation, aggression or psychotic Symptoms in dementia together',
|
||||
'Agitation, aggression or psychotic Symptoms in dementia sep',
|
||||
'Tic disorder',
|
||||
'Schizophrenia',
|
||||
'Aggression in children with autism or developmental disorders'),
|
||||
code=list(#2349,
|
||||
c(2478,2479), 2348, 2347,c(2361, 2362)
|
||||
))
|
||||
# put concept sets into inds
|
||||
inds <- lapply(conceptSetIds[[2]], getConcepts)
|
||||
names(inds) <-conceptSetIds[[1]]
|
||||
getConcepts <- function(conceptSetIdentifiers) {
|
||||
results <- list()
|
||||
length(results) <- length(conceptSetIdentifiers)
|
||||
ind <- 0
|
||||
for (conceptSetIdentifier in conceptSetIdentifiers){
|
||||
ind <- ind+1
|
||||
# get the concept set expression from the webapi
|
||||
conceptSetExpressionUrl = paste("http://hix.jnj.com:8080/WebAPI/conceptset/", conceptSetIdentifier, "/expression", sep = "")
|
||||
## http://hix.jnj.com:8080/WebAPI/VOCAB/vocabulary/lookup/mapped
|
||||
expression <- httr::content(httr::GET(conceptSetExpressionUrl),"text")
|
||||
result <- RJSONIO::fromJSON(expression)
|
||||
concepts <- t(as.data.frame(lapply(result[[1]], function(x) c(x$concept$CONCEPT_ID,
|
||||
x$concept$CONCEPT_CODE,
|
||||
x$concept$CONCEPT_NAME,
|
||||
x$concept$VOCABULARY_ID,
|
||||
x$isExcluded, x$includeDescendants,
|
||||
x$includeMapped)) ))
|
||||
concepts <- as.data.frame(concepts)
|
||||
rownames(concepts) <- NULL
|
||||
colnames(concepts) <- c('concept_id','concept_code','concept_name','vocabulary_id',
|
||||
'exclude','descendants','mapped')
|
||||
concepts[,'exclude'] <- ifelse(concepts[,'exclude']=='TRUE', 1, 0)
|
||||
concepts[,'descendants'] <- ifelse(concepts[,'descendants']=='TRUE', 1, 0)
|
||||
concepts[,'mapped'] <- ifelse(concepts[,'mapped']=='TRUE', 1, 0)
|
||||
# save to temp table
|
||||
connectionDetails <- createConnectionDetails(dbms="pdw",
|
||||
server="JRDUSAPSCTL01",
|
||||
port=17001,
|
||||
user=NULL,
|
||||
password=NULL)
|
||||
conn <- connect(connectionDetails)
|
||||
DatabaseConnector::insertTable(conn, 'concepts', concepts, tempTable = T)
|
||||
# run cocnept_extract sql using temp table
|
||||
sql <- SqlRender::readSql(file.path(dir,'concept_extract.sql'))
|
||||
sql <- SqlRender::renderSql(sql, cdm='Vocabulary')$sql
|
||||
sql <- SqlRender::translateSql(sql, sourceDialect = 'sql server', targetDialect = 'pdw')$sql
|
||||
results[[ind]] <- DatabaseConnector::querySql(conn,sql)
|
||||
}
|
||||
return(results)
|
||||
}
|
||||
conceptSetIds <- list(name=c(#'Agitation, aggression or psychotic Symptoms in dementia together',
|
||||
'Agitation, aggression or psychotic Symptoms in dementia sep',
|
||||
'Tic disorder',
|
||||
'Schizophrenia',
|
||||
'Aggression in children with autism or developmental disorders'),
|
||||
code=list(#2349,
|
||||
c(2478,2479), 2348, 2347,c(2361, 2362)
|
||||
))
|
||||
# put concept sets into inds
|
||||
inds <- lapply(conceptSetIds[[2]], getConcepts)
|
||||
getConcepts <- function(conceptSetIdentifiers) {
|
||||
results <- list()
|
||||
length(results) <- length(conceptSetIdentifiers)
|
||||
ind <- 0
|
||||
for (conceptSetIdentifier in conceptSetIdentifiers){
|
||||
ind <- ind+1
|
||||
# get the concept set expression from the webapi
|
||||
conceptSetExpressionUrl = paste("http://hix.jnj.com:8080/WebAPI/conceptset/", conceptSetIdentifier, "/expression", sep = "")
|
||||
## http://hix.jnj.com:8080/WebAPI/VOCAB/vocabulary/lookup/mapped
|
||||
expression <- httr::content(httr::GET(conceptSetExpressionUrl),"text")
|
||||
result <- RJSONIO::fromJSON(expression)
|
||||
concepts <- t(as.data.frame(lapply(result[[1]], function(x) c(x$concept$CONCEPT_ID,
|
||||
x$concept$CONCEPT_CODE,
|
||||
x$concept$CONCEPT_NAME,
|
||||
x$concept$VOCABULARY_ID,
|
||||
x$isExcluded, x$includeDescendants,
|
||||
x$includeMapped)) ))
|
||||
concepts <- as.data.frame(concepts)
|
||||
rownames(concepts) <- NULL
|
||||
colnames(concepts) <- c('concept_id','concept_code','concept_name','vocabulary_id',
|
||||
'exclude','descendants','mapped')
|
||||
concepts[,'exclude'] <- ifelse(concepts[,'exclude']=='TRUE', 1, 0)
|
||||
concepts[,'descendants'] <- ifelse(concepts[,'descendants']=='TRUE', 1, 0)
|
||||
concepts[,'mapped'] <- ifelse(concepts[,'mapped']=='TRUE', 1, 0)
|
||||
# save to temp table
|
||||
connectionDetails <- createConnectionDetails(dbms="pdw",
|
||||
server="JRDUSAPSCTL01",
|
||||
port=17001,
|
||||
user=NULL,
|
||||
password=NULL)
|
||||
conn <- connect(connectionDetails)
|
||||
DatabaseConnector::insertTable(conn, 'scratch.dbo.concepts_390', concepts)#, tempTable = T)
|
||||
# run cocnept_extract sql using temp table
|
||||
sql <- SqlRender::readSql(file.path(dir,'concept_extract.sql'))
|
||||
sql <- SqlRender::renderSql(sql, cdm='Vocabulary')$sql
|
||||
sql <- SqlRender::translateSql(sql, sourceDialect = 'sql server', targetDialect = 'pdw')$sql
|
||||
results[[ind]] <- DatabaseConnector::querySql(conn,sql)
|
||||
}
|
||||
return(results)
|
||||
}
|
||||
conceptSetIds <- list(name=c(#'Agitation, aggression or psychotic Symptoms in dementia together',
|
||||
'Agitation, aggression or psychotic Symptoms in dementia sep',
|
||||
'Tic disorder',
|
||||
'Schizophrenia',
|
||||
'Aggression in children with autism or developmental disorders'),
|
||||
code=list(#2349,
|
||||
c(2478,2479), 2348, 2347,c(2361, 2362)
|
||||
))
|
||||
# put concept sets into inds
|
||||
inds <- lapply(conceptSetIds[[2]], getConcepts)
|
||||
library(SqlRender)
|
||||
library(DatabaseConnector)
|
||||
library(stringr)
|
||||
library(openxlsx)
|
||||
cohortIds <- c(2520, 2521)
|
||||
buildDatabase <- function(id, name, schema)
|
||||
{
|
||||
dataSource <- {};
|
||||
dataSource$id = id;
|
||||
dataSource$name = name;
|
||||
dataSource$schema = schema;
|
||||
return(dataSource);
|
||||
}
|
||||
dbList <- list(
|
||||
buildDatabase("CPRD_V423", "CDM_CPRD_V423", "dbo"),
|
||||
buildDatabase("JMDC_V429", "CDM_JMDC_V429", "dbo"),
|
||||
buildDatabase("OPTUMEXTSES_V427", "CDM_OPTUM_EXTENDED_SES_V427", "dbo"),
|
||||
buildDatabase("PREMIER_V428", "CDM_PREMIER_V428", "dbo"),
|
||||
buildDatabase("TRUVENCCAE_V418", "CDM_TRUVEN_CCAE_V418", "dbo"),
|
||||
buildDatabase("TRUVENMDCD_V432", "CDM_TRUVEN_MDCD_V432", "dbo"),
|
||||
buildDatabase("TRUVENMDCR_V415", "CDM_TRUVEN_MDCR_V415", "dbo")
|
||||
);
|
||||
connectionDetails <- createConnectionDetails(dbms = "pdw", server = "JRDUSAPSCTL01",
|
||||
port = 17001, user = "hix_reader", password = "reader1!")
|
||||
outputExcel <- "Output/ExcelFiles/PP_Atlas"
|
||||
for (cohortId in cohortIds)
|
||||
{
|
||||
filePath <- paste(paste(outputExcel, cohortId, sep="/", collapse=""), ".xlsx", sep="", collapse="")
|
||||
if (file.exists(filePath))
|
||||
{
|
||||
file.remove(filePath)
|
||||
}
|
||||
wb <- createWorkbook()
|
||||
for (db in dbList)
|
||||
{
|
||||
addWorksheet(wb, db$id)
|
||||
pp_sql <- readSql("sql/PP_Atlas.sql");
|
||||
pp_sql <- renderSql(pp_sql, cdmDatabaseSchema = paste(db$name, db$schema, sep=".", collapse=""), cohort_definition_id = cohortId,
|
||||
urlPrefix = paste("'http://hix.jnj.com/atlas/#/profiles",
|
||||
db$id, cohortId, "'", sep="/", collapse=""))$sql;
|
||||
conn <- connect(connectionDetails)
|
||||
pp_data <- querySql(conn, pp_sql)
|
||||
hs <- createStyle(textDecoration = "Bold")
|
||||
writeData(wb, sheet=db$id, pp_data,
|
||||
startCol = 1, startRow = 1, colNames = TRUE, rowNames = FALSE, headerStyle = hs)
|
||||
setColWidths(wb, sheet = db$id, cols = 1:5, widths = "auto")
|
||||
}
|
||||
saveWorkbook(wb, filePath, overwrite = TRUE)
|
||||
}
|
||||
install_github("ohdsi/Aphrodite")
|
||||
install_github("ohdsi/Aphrodite")
|
||||
library(OhdsiRTools)
|
||||
install_github("ohdsi/Aphrodite")
|
||||
install.packages("ohdsi/Aphrodite")
|
||||
install.packages("devtools")
|
||||
library("devtools")
|
||||
install_github("ohdsi/Aphrodite")
|
||||
install.packages(chron)
|
||||
install.packages("chron")
|
||||
install_github("ohdsi/Aphrodite")
|
||||
install_github("OHDSI/CdmAtlasCutover")
|
||||
library(devtools)
|
||||
install_github("OHDSI/CdmAtlasCutover")
|
||||
repoConnectionDetails <- createConnectionDetails(dbms = "sql server",
|
||||
server = "rndusrdhit01",
|
||||
port = 1433, schema = "ohdsi_repository.dbo")
|
||||
oldCdmSources <- list(
|
||||
buildCdmSource(sourceKey = "DEATHSUBSET_CCAE")
|
||||
)
|
||||
newCdmSources <- list(
|
||||
buildCdmSource(sourceKey = "DEATHSUBSET_CCAE", sourceName = "Death Subset - Truven CCAE",
|
||||
dbms = "pdw",
|
||||
connectionString = "jdbc:sqlserver://JRDUSAPSCTL01:17001;databaseName=CDM_DEATH_SUBSET;user=hix_writer;password=writer1!",
|
||||
cdmDatabaseSchema = "CDM_DEATH_SUBSET.truven_ccae", resultsDatabaseSchema = "CDM_DEATH_SUBSET.truven_ccae",
|
||||
vocabDatabaseSchema = "CDM_DEATH_SUBSET.truven_ccae"),
|
||||
buildCdmSource(sourceKey = "DEATHSUBSET_MDCR", sourceName = "Death Subset - Truven MDCR",
|
||||
dbms = "pdw",
|
||||
connectionString = "jdbc:sqlserver://JRDUSAPSCTL01:17001;databaseName=CDM_DEATH_SUBSET;user=hix_writer;password=writer1!",
|
||||
cdmDatabaseSchema = "CDM_DEATH_SUBSET.truven_mdcr",
|
||||
resultsDatabaseSchema = "CDM_DEATH_SUBSET.truven_mdcr",
|
||||
vocabDatabaseSchema = "VOCABULARY_20161218.dbo"),
|
||||
buildCdmSource(sourceKey = "DEATHSUBSET_OPTUM", sourceName = "Death Subset - Optum Extended DOD",
|
||||
dbms = "pdw",
|
||||
connectionString = "jdbc:sqlserver://JRDUSAPSCTL01:17001;databaseName=CDM_DEATH_SUBSET;user=hix_writer;password=writer1!",
|
||||
cdmDatabaseSchema = "CDM_DEATH_SUBSET.optum_extended_dod",
|
||||
resultsDatabaseSchema = "CDM_DEATH_SUBSET.optum_extended_dod",
|
||||
vocabDatabaseSchema = "VOCABULARY_20161218.dbo")
|
||||
)
|
||||
library(CdmAtlasCutover)
|
||||
oldCdmSources <- list(
|
||||
buildCdmSource(sourceKey = "DEATHSUBSET_CCAE")
|
||||
)
|
||||
newCdmSources <- list(
|
||||
buildCdmSource(sourceKey = "DEATHSUBSET_CCAE", sourceName = "Death Subset - Truven CCAE",
|
||||
dbms = "pdw",
|
||||
connectionString = "jdbc:sqlserver://JRDUSAPSCTL01:17001;databaseName=CDM_DEATH_SUBSET;user=hix_writer;password=writer1!",
|
||||
cdmDatabaseSchema = "CDM_DEATH_SUBSET.truven_ccae", resultsDatabaseSchema = "CDM_DEATH_SUBSET.truven_ccae",
|
||||
vocabDatabaseSchema = "CDM_DEATH_SUBSET.truven_ccae"),
|
||||
buildCdmSource(sourceKey = "DEATHSUBSET_MDCR", sourceName = "Death Subset - Truven MDCR",
|
||||
dbms = "pdw",
|
||||
connectionString = "jdbc:sqlserver://JRDUSAPSCTL01:17001;databaseName=CDM_DEATH_SUBSET;user=hix_writer;password=writer1!",
|
||||
cdmDatabaseSchema = "CDM_DEATH_SUBSET.truven_mdcr",
|
||||
resultsDatabaseSchema = "CDM_DEATH_SUBSET.truven_mdcr",
|
||||
vocabDatabaseSchema = "VOCABULARY_20161218.dbo"),
|
||||
buildCdmSource(sourceKey = "DEATHSUBSET_OPTUM", sourceName = "Death Subset - Optum Extended DOD",
|
||||
dbms = "pdw",
|
||||
connectionString = "jdbc:sqlserver://JRDUSAPSCTL01:17001;databaseName=CDM_DEATH_SUBSET;user=hix_writer;password=writer1!",
|
||||
cdmDatabaseSchema = "CDM_DEATH_SUBSET.optum_extended_dod",
|
||||
resultsDatabaseSchema = "CDM_DEATH_SUBSET.optum_extended_dod",
|
||||
vocabDatabaseSchema = "VOCABULARY_20161218.dbo")
|
||||
)
|
||||
removeCdmSources(repoConnectionDetails = repoConnectionDetails, cdmSources = oldCdmSources, sqlOnly = TRUE)
|
||||
createOhdsiResultsTables(cdmSources = newCdmSources, sqlOnly = TRUE)
|
||||
insertCdmSources(repoConnectionDetails = repoConnectionDetails, cdmSources = newCdmSources, sourceIdx = TRUE,
|
||||
daimonIdx = TRUE, sqlOnly = TRUE)
|
||||
repoConnectionDetails <- createConnectionDetails(dbms = "sql server",
|
||||
server = "rndusrdhit01",
|
||||
port = 1433, schema = "ohdsi_repository.dbo")
|
||||
removeCdmSources(repoConnectionDetails = repoConnectionDetails, cdmSources = oldCdmSources, sqlOnly = TRUE)
|
||||
removeCdmSources(repoConnectionDetails = repoConnectionDetails, cdmSources = oldCdmSources, sqlOnly = TRUE)
|
||||
insertCdmSources(repoConnectionDetails = repoConnectionDetails, cdmSources = newCdmSources, sourceIdx = TRUE,
|
||||
daimonIdx = TRUE, sqlOnly = TRUE)
|
||||
install_github("OHDSI/CdmAtlasCutover", force=TRUE)
|
||||
library(CdmAtlasCutover)
|
||||
# Initialize CDM database list, with all the CDMs to be cut over
|
||||
repoConnectionDetails <- createConnectionDetails(dbms = "sql server",
|
||||
server = "rndusrdhit01",
|
||||
port = 1433, schema = "ohdsi_repository.dbo")
|
||||
oldCdmSources <- list(
|
||||
buildCdmSource(sourceKey = "DEATHSUBSET_CCAE")
|
||||
)
|
||||
removeCdmSources(repoConnectionDetails = repoConnectionDetails, cdmSources = oldCdmSources, sqlOnly = TRUE)
|
||||
createOhdsiResultsTables(cdmSources = newCdmSources, sqlOnly = TRUE)
|
||||
insertCdmSources(repoConnectionDetails = repoConnectionDetails, cdmSources = newCdmSources, sourceIdx = TRUE,
|
||||
daimonIdx = TRUE, sqlOnly = TRUE)
|
||||
getwd()
|
||||
setwd("C:/Git/CommonDataModel/Documentation")
|
||||
library(rmarkdown)
|
||||
render("GlossaryofTerms.md","pdf_document")
|
||||
render("GlossaryofTerms.md","pdf_document", template = "default")
|
||||
render("GlossaryofTerms.md",pdf_document(template = "default"))
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: "OMOP Common Data Model Specifications"
|
||||
title: "OMOP Common Data Model v5.1 Specifications"
|
||||
author: "Christian Reich, Patrick Ryan, Rimma Belenkaya, Karthik Natarajan and Clair Blacketer"
|
||||
date: "`r Sys.Date()`"
|
||||
output:
|
||||
|
@ -9,10 +9,11 @@ output:
|
|||
linkcolor: blue
|
||||
---
|
||||
|
||||
```{r child = 'License.md'}
|
||||
# License
|
||||
|
||||
```{r child = 'C:/Git/CommonDataModel.wiki/License.md'}
|
||||
```
|
||||
|
||||
```{r child = 'Background/TheRoleoftheCommonDataModel.md'}
|
||||
# The Role of the Common Data Model
|
||||
```{r child = 'C:/Git/CommonDataModel.wiki/Background/The-Role-of-the-Common-Data-Model.md'}
|
||||
```
|
||||
|
||||
Will it add the footer?
|
Binary file not shown.
Loading…
Reference in New Issue