OHDSI SOS Challenge 2023
Jamie Gilbert
2023-04-18
This tutorial has the following objectives:
CohortDiagnostics
packageStrategus
CohortDiagnostics
packageFind this guide:
https://rpubs.com/azimov/ohdsi_sos_2023_cd
For this tutorial you will need:
This method ensures that you have the same package environment as a study author
First, go to Atlas and find your cohorts of interest.
We need the identifiers:
Demo atlas - view of cohort definitions
Use the ROhdsiWebApi
package to download our cohorts by ID
If you need to save your cohorts for offline use, use CohortGenerator
cohortId | cohortName |
---|---|
1782164 | [SOS] End-stage renal disease |
1782483 | [SOS Phenotype Devt] aflibercept exposures after new use with 3 exposures in 21-70d windows |
1782482 | [SOS Phenotype Devt] bevacizumab exposures after new use with 3 exposures in 21-70d windows |
…
connectionDetails <- DatabaseConnector::createConnectionDetails(
dbms = "postgresql",
server = "path_to_server/database",
port = 5432,
# We reccomend using the keyring package for secure credentials
user = "my_user",
password = "blah"
)
databaseId <- "my_cdm_id"
cdmDatabaseSchema <- "mv_cdm_version_5_4"
cohortDatabaseSchema <- "where_results_live"
dataFolder <- "results"
incrementalFolder <- paste("incremental_", databaseId)
We strongly recommend using the keyring
package
install.packages("keyring")
keyring::key_set("cdm-username") # Will prompt with secure input
keyring::key_set("cdm-password")
keyring::key_set("cdm-server")
# with DatabaseConnector we never want to save these passwords
#in plain text form
connectionDetails <- DatabaseConnector::createConnectionDetails(
dbms = "postgresql",
port = 5432,
server = keyring::key_set("cdm-server"),
# We reccomend using the keyring package for secure credentials
user = keyring::key_set("cdm-username"),
password = keyring::key_set("cdm-password")
)
Call the cohort generator package
This can take a long time to run…
library(CohortDiagnostics)
executeDiagnostics(
cohortDefinitionSet = cohortDefinitionSet,
connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
cohortDatabaseSchema = cohortDatabaseSchema,
cohortTableNames = cohortTableNames,
exportFolder = file.path(dataFolder,databaseId),
databaseId = databaseId,
incremental = TRUE,
incrementalFolder = incrementalFolder,
minCellCount = 5,
runInclusionStatistics = TRUE,
runIncludedSourceConcepts = TRUE,
runOrphanConcepts = TRUE,
runTimeSeries = TRUE,
runVisitContext = TRUE,
runBreakdownIndexEvents = TRUE,
runIncidenceRate = TRUE,
runCohortRelationship = TRUE,
runTemporalCohortCharacterization = TRUE
)
Create an sqlite database:
Launch the shiny app:
The files that should be of interest are:
<workspace_path>results/my_cdm_id/Results_my_cdm_id.zip
This requires pushing the shiny app to a new folder on
Press the “publish” button in the top right and share to shinyapps.io