Repository navigation
Expand file tree
/
Copy pathcode_to_run.R
More file actions
92 lines (77 loc) · 2.95 KB
/
Copy pathcode_to_run.R
File metadata and controls
92 lines (77 loc) · 2.95 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
### Clean environment, memory, and consoles ------------------------------------
# clean all environment variables
rm(list = ls(all.names = TRUE))
# free memory
gc()
#clean the consoles
cat("\014")
###Libraries required-----------------------------------------------------------
#install.packages('DatabaseConnector')
#install.packages('SqlRender')
#install.packages('dplyr')
#install.packages('ggplot2')
#install.packages('viridis')
library(DatabaseConnector)
library(SqlRender)
library(dplyr)
library(ggplot2)
library(viridis)
### Create the connection & output directory------------------------------------
#Set working directory to the H2O folder
setwd("~/H2O-visualizations")
#Create results directory
resultsDirectory <- "results"
dir.create(resultsDirectory)
plotsDirectory <- "plots"
dir.create(plotsDirectory)
#Variables
dbms <- ""
server <- ""
user <- ""
password <- ""
port <-
pathToDriver <- ""
databaseSchema <- "h2o_dm_ittm"
sqlDialect <- ""
#supported dialects:
#sqlserver, oracle, postgresql, pdw, impala, netezza, bigquery, spark, sqlite,
#redshift, hive, sqliteextended, duckdb, snowflake, synapse, iris
#Connect to the db
#https:://ohdsi.github.io/DatabaseConnector/articles/Connecting.html
connectionDetails <- DatabaseConnector::createConnectionDetails(
dbms = dbms,
server = server,
user = user,
password = password,
port = port,
pathToDriver = pathToDriver
)
connection <- DatabaseConnector::connect(connectionDetails)
###Collect the relevant data insights centre------------------------------------
# source("insights_centre/number_of_persons.R")
# source("insights_centre/sql_queries.R")
# source("insights_centre/disease_counts.R")
# source("insights_centre/therapy_counts.R")
# source("insights_centre/diagnostics_counts.R")
# ###Collect the relevant data promis global 10-----------------------------------
# source("promis_global10/conversion_tables.R")
# source("promis_global10/statistics_promis10.R")
##Collect the relevant data PAID5
source(file.path(getwd(), "PAID5/01_conversion_tables.R"))
source(file.path(getwd(), "PAID5/01_collect_PRO_and_clinical.R"))
disconnect(connection)
#If results from multiple sites available---------------------------------------
# source("R/extra/combine_results_insights_centre.R")
# source("R/extra/combine_results_promis10.R")
## Aggregate Results for Exchange
source(file.path(getwd(), "PAID5/02_aggregate_PRO.R"))
source(file.path(getwd(), "PAID5/03_aggregate_clinical.R"))
###Create plots insights centre-------------------------------------------------
# source("insights_centre/visualizations_insights_centre.R")
# # source("R/insights_centre/visualizations_insights_centre_additional.R")
#
# ###Create plots promis global 10------------------------------------------------
# source("promis_global10/visualizations_promis10.R")
# # source("R/promis_global10/visualizations_promis10_additional.R")
source(file.path(getwd(), "PAID5/02_visualize_agg_PRO.R"))
source(file.path(getwd(), "PAID5/03_visualize_clinical.R"))