-
Notifications
You must be signed in to change notification settings - Fork 0
/
database_connectionns.R
37 lines (34 loc) · 1.17 KB
/
database_connectionns.R
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
## @knitr num1
#Load required packages
library(knitr)
library(kableExtra)
library(DBI)
library(RPostgres)
library(tidyverse)
library(dbplyr)
library(ruODK)
library(gtsummary)
library(ggplot2)
library(getPass)
# mimic password and username security
mimic <- getPass(msg = 'Please enter your MIMIC database password')
mimicuser <- getPass(msg = 'Please enter your MIMIC database username')
#Create connection to mimic
con = dbConnect(RPostgres::Postgres(),
dbname= "mimic",
host = "healthdatascience.lshtm.ac.uk",
port = 5432,
user = mimicuser,
password = mimic)
#Create connection to ODK
options(repos = c(ropensci = 'https://ropensci.r-universe.dev',
CRAN = 'https://cloud.r-project.org'))
#odk password and username security
odk <- getPass(msg = 'Please enter your ODK server password')
odkuser <- getPass(msg = 'Please enter your ODK server username')
ruODK::ru_setup(
svc = "https://odk-survey.lshtm.ac.uk/v1/projects/80/forms/HDM_Assessment.svc",
un = odkuser,
pw = odk)
fq_svc <- ruODK::odata_service_get()
form_tables <- ruODK::odata_service_get()