Skip to content

Commit

Permalink
Rerunning vignette data fetches on DataBricks
Browse files Browse the repository at this point in the history
  • Loading branch information
Admin_mschuemi authored and Admin_mschuemi committed Aug 29, 2024
1 parent f344c5c commit b11a54c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 23 deletions.
21 changes: 11 additions & 10 deletions extras/MultiAnalysesVignetteDataFetch.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@
# This code should be used to fetch the data that is used in the vignettes.
library(CohortMethod)
library(dplyr)
options(andromedaTempFolder = "d:/andromedaTemp")
options(andromedaTempFolder = "e:/andromedaTemp")

folder <- "d:/temp/cohortMethodVignette2"
folder <- "e:/temp/cohortMethodVignette2"
# unlink(folder, recursive = TRUE)
# dir.create(folder)

# Set connection details -------------------------------------------------------
# MDCR on RedShift
connectionDetails <- DatabaseConnector::createConnectionDetails(
dbms = "redshift",
connectionString = keyring::key_get("redShiftConnectionStringOhdaMdcr"),
user = keyring::key_get("redShiftUserName"),
password = keyring::key_get("redShiftPassword")
# MDCR on DataBricks
connectionDetails <- createConnectionDetails(
dbms = "spark",
connectionString = keyring::key_get("databricksConnectionString"),
user = "token",
password = keyring::key_get("databricksToken")
)
cdmDatabaseSchema <- "cdm_truven_mdcr_v2540"
cohortDatabaseSchema <- "scratch_mschuemi"
cdmDatabaseSchema <- "merative_mdcr.cdm_merative_mdcr_v3045"
cohortDatabaseSchema <- "scratch.scratch_mschuemi"
cohortTable <- "cm_vignette"
options(sqlRenderTempEmulationSchema = "scratch.scratch_mschuemi")

# Define exposure cohorts ------------------------------------------------------
library(Capr)
Expand Down
21 changes: 11 additions & 10 deletions extras/SingleStudyVignetteDataFetch.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@
# This code should be used to fetch the data that is used in the vignettes.
library(CohortMethod)
library(dplyr)
options(andromedaTempFolder = "d:/andromedaTemp")
options(andromedaTempFolder = "e:/andromedaTemp")

folder <- "d:/temp/cohortMethodVignette"
folder <- "e:/temp/cohortMethodVignette"
# unlink(folder, recursive = TRUE)
# dir.create(folder)

# Set connection details -------------------------------------------------------
# MDCR on RedShift
connectionDetails <- DatabaseConnector::createConnectionDetails(
dbms = "redshift",
connectionString = keyring::key_get("redShiftConnectionStringOhdaMdcr"),
user = keyring::key_get("redShiftUserName"),
password = keyring::key_get("redShiftPassword")
# MDCR on DataBricks
connectionDetails <- createConnectionDetails(
dbms = "spark",
connectionString = keyring::key_get("databricksConnectionString"),
user = "token",
password = keyring::key_get("databricksToken")
)
cdmDatabaseSchema <- "cdm_truven_mdcr_v2540"
cohortDatabaseSchema <- "scratch_mschuemi"
cdmDatabaseSchema <- "merative_mdcr.cdm_merative_mdcr_v3045"
cohortDatabaseSchema <- "scratch.scratch_mschuemi"
cohortTable <- "cm_vignette"
options(sqlRenderTempEmulationSchema = "scratch.scratch_mschuemi")


# Define exposure cohorts ------------------------------------------------------
Expand Down
Binary file modified inst/doc/MultipleAnalyses.pdf
Binary file not shown.
Binary file modified inst/doc/SingleStudies.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion vignettes/MultipleAnalyses.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ vignette: >

```{r, echo = FALSE, message = FALSE, warning = FALSE}
library(CohortMethod)
folder <- "d:/temp/cohortMethodVignette2"
folder <- "e:/temp/cohortMethodVignette2"
folderExists <- dir.exists(folder)
```
# Introduction
Expand Down
4 changes: 2 additions & 2 deletions vignettes/SingleStudies.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ editor_options:
```{r, echo = FALSE, message = FALSE, warning = FALSE}
options(width = 200)
library(CohortMethod)
outputFolder <- "d:/temp/cohortMethodVignette"
outputFolder <- "e:/temp/cohortMethodVignette"
folderExists <- dir.exists(outputFolder)
```
# Introduction
Expand Down Expand Up @@ -446,7 +446,7 @@ if (folderExists) {
```{r eval=FALSE}
plotCovariateBalanceScatterPlot(balance, showCovariateCountLabel = TRUE, showMaxLabel = TRUE)
```
```{r echo=FALSE,message=FALSE,eval=TRUE,fig.width=7,fig.height=4.5}
```{r echo=FALSE,message=FALSE,warnings=FALSE,eval=TRUE,fig.width=7,fig.height=4.5}
if (folderExists) {
plotCovariateBalanceScatterPlot(balance,
showCovariateCountLabel = TRUE,
Expand Down

0 comments on commit b11a54c

Please sign in to comment.