OHDSI SOS Challenge 2023 (APAC)
Jamie Gilbert
2023-04-18
This tutorial has the following objectives:
CohortDiagnostics packageStrategusCohortDiagnostics packageFind this guide:
https://rpubs.com/azimov/ohdsi_sos_2023_cd_apac
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
baseUrl <- "https://atlas-demo.ohdsi.org/WebAPI"
atlasCohortIds <- c(1782551, 1782553, 1782556, 1782554, 1782550, 1782544,
1782548, 1782546, 1782545, 1782543, 1782542, 1782540,
1782539, 1782486, 1782537, 1782538, 1782536, 1782535,
1782490, 1782489, 1782488, 1782487, 1782485)
cohortDefinitionSet <- ROhdsiWebApi::exportCohortDefinitionSet(
baseUrl = baseUrl,
cohortIds = atlasCohortIds,
generateStats = TRUE
)If you need to save your cohorts for offline use, use CohortGenerator
| cohortId | cohortName |
|---|---|
| 1782551 | [SOS Phenotype devt] AA rupture events inpatient - possible prior AA, no prior AD or AAr |
| 1782553 | [SOS Phenotype devt] AA rupture events inpatient primary - possible prior AA, no prior AD or AAr |
| 1782556 | [SOS Phenotype devt] AA rupture OR AD events inpatient - possible prior AA |
…
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