Follow these instructions for setting up your R environment, including RTools and Java.
Open your study package in RStudio. Use the following code to install all the dependencies:
r
install.packages("renv")
renv::activate()
renv::restore()
In RStudio, select 'Build' then 'Install and Restart' to install the LegendT2dm package.
For class v.s. class studies, follow the instructions in Steps 6-11 below. For your convenience, all code is also provided under extras/CodeToRun.R.
For drug v.s. drug studies across all drug classes, follow the instructions in Steps 6-11. Replace the argument indicationId = "class" with indicationId = "drug" and also replace cohorts = "class" with cohorts = "drug" to view/upload diagnostics and results. It is strongly recommended to run all the code provided under extras/CodeToRunAllDrugs.R for more reliable execution.
Once the LegendT2dm package is installed, you can execute the feasibility assessment portion of the study by modifying and using the code below. You may also refer to the code provided under extras/CodeToRun.R (or indicationId = "drug" for drug-level studies):
```r library(LegendT2dm)
Sys.setenv(DATABASECONNECTOR_JAR_FOLDER="s:/DatabaseDrivers")
DatabaseConnector::downloadJdbcDrivers(dbms = "postgresql")
options(andromedaTempFolder = "s:/AndromedaTemp")
maxCores <- min(4, parallel::detectCores()) # Or more depending on your hardware
minCellCount <- 5
outputFolder <- "s:/LegendT2dmStudy"
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "postgresql", server = "some.server.com/ohdsi", user = "joe", password = "secret")
cdmDatabaseSchema <- "cdm_synpuf"
cohortDatabaseSchema <- "scratch.dbo" tablePrefix <- "legendt2dm_study"
databaseId <- "Synpuf" databaseName <- "Medicare Claims Synthetic Public Use Files (SynPUFs)" databaseDescription <- "Medicare Claims Synthetic Public Use Files (SynPUFs) were created to allow interested parties to gain familiarity using Medicare claims data while protecting beneficiary privacy. These files are intended to promote development of software and applications that utilize files in this format, train researchers on the use and complexities of Centers for Medicare and Medicaid Services (CMS) claims, and support safe data mining innovations. The SynPUFs were created by combining randomized information from multiple unique beneficiaries and changing variable values. This randomization and combining of beneficiary information ensures privacy of health information."
options(sqlRenderTempEmulationSchema = NULL)
assessPhenotypes(connectionDetails = connectionDetails, cdmDatabaseSchema = cdmDatabaseSchema, oracleTempSchema = oracleTempSchema, cohortDatabaseSchema = cohortDatabaseSchema, outputFolder = outputFolder, tablePrefix = tablePrefix, indicationId = 'class', databaseId = databaseId, databaseName = databaseName, databaseDescription = databaseDescription, createExposureCohorts = TRUE, runExposureCohortDiagnostics = TRUE, createOutcomeCohorts = TRUE, runOutcomeCohortDiagnostics = TRUE)
```
Upload the files class/cohortDiagnosticsExport/Results_class_exposures_<DatabaseId>.zip and outcome/cohortDiagnosticsExport/Results_outcomes_<DatabaseId>.zip in the output folder to the study coordinator:
r
uploadPhenotypeResults(cohorts = "class",
outputFolder, privateKeyFileName = "<file>", userName = "<name>"
uploadPhenotypeResults(cohorts = "outcome",
outputFolder, privateKeyFileName = "<file>", userName = "<name>")
where <file> and <name> are the credentials provided to you personally by the study coordinator.
View your cohort diagnostics locally via:
```r CohortDiagnostics::preMergeDiagnosticsFiles(dataFolder = file.path(outputFolder, "class/cohortDiagnosticsExport")) LegendT2dmCohortExplorer::launchCohortExplorer(cohorts = "class", dataFolder = file.path(outputFolder, "class/cohortDiagnosticsExport"))
CohortDiagnostics::preMergeDiagnosticsFiles(dataFolder = file.path(outputFolder, "outcome/cohortDiagnosticsExport")) LegendT2dmCohortExplorer::launchCohortExplorer(cohorts = "outcome", dataFolder = file.path(outputFolder, "outcome/cohortDiagnosticsExport")) ```
Complete the feasibility assessment by constructing sample-restricted propensity models:
r
assessPropensityModels(connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
oracleTempSchema = oracleTempSchema,
cohortDatabaseSchema = cohortDatabaseSchema,
outputFolder = outputFolder,
indicationId = "class",
tablePrefix = tablePrefix,
databaseId = databaseId,
maxCores = maxCores)
and uploading the file class/assessmentOfPropensityScores/Results_class_ps_<DatabaseId>.zip in the output folder to the study coordinator:
r
uploadPsAssessmentResults(cohorts = "class",
outputFolder, privateKeyFileName = "<file>", userName = "<name>")
To prepare to execute the class-vs-class comparative effectiveness and safety (CES) study, first update your LegendT2dm to version >= 2.0.0. You can accomplish this via a git pull in RStudio and then select 'Build' and 'Install and Restart'. To check your package version:
packageVersion("LegendT2dm")
Execute the CES study via:
execute(connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
oracleTempSchema = oracleTempSchema,
cohortDatabaseSchema = cohortDatabaseSchema,
outputFolder = outputFolder,
indicationId = "class",
databaseId = databaseId,
databaseName = databaseName,
databaseDescription = databaseDescription,
tablePrefix = tablePrefix,
createExposureCohorts = TRUE,
createOutcomeCohorts = TRUE,
fetchAllDataFromServer = TRUE,
generateAllCohortMethodDataObjects = TRUE,
runCohortMethod = TRUE,
computeCovariateBalance = TRUE,
exportToCsv = TRUE,
maxCores = maxCores)
and upload the file class/export/Results_class_study_<DatabaseId>.zip in the output folder to the study coordinator:
uploadStudyResults(cohorts = "class",
outputFolder, privateKeyFileName = "<file>", userName = "<name>")
The LegendT2dm package is licensed under Apache License 2.0
LegendT2dm was developed in ATLAS and R Studio.
Collecting cohort diagnostics from data partners.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.