Skip to content

Commit

Permalink
merge with master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Admin_FBu2 authored and Admin_FBu2 committed Nov 14, 2023
2 parents 0e1e39e + 3eca1eb commit a6a5108
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 58 deletions.
83 changes: 42 additions & 41 deletions extra/CodeToRunRedShift.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ outputFolder <- "E:/LegendT2dmOutput_optum_ehr_drug2"
# databaseName <- "IBM Health MarketScan Medicare Supplemental and Coordination of Benefits Database"
# databaseDescription <- "IBM Health MarketScan® Medicare Supplemental and Coordination of Benefits Database (MDCR) represents health services of retirees in the United States with primary or Medicare supplemental coverage through privately insured fee-for-service, point-of-service, or capitated health plans. These data include adjudicated health insurance claims (e.g. inpatient, outpatient, and outpatient pharmacy). Additionally, it captures laboratory tests for a subset of the covered lives."
# tablePrefix <- "legend_t2dm_mdcr"
# outputFolder <- "E:/LegendT2dmOutput_mdcr_continuousAge_test"
# outputFolder <- "E:/LegendT2dmOutput_mdcr_drug2"

# # Feb 2023: fast forward data version to the latest accessible
# TBD: run drug-level study on MDCD
Expand All @@ -49,14 +49,14 @@ outputFolder <- "E:/LegendT2dmOutput_optum_ehr_drug2"
# outputFolder <- "E:/LegendT2dmOutput_mdcd_drug2"

# # Feb 2023: fast forward data version to the latest accessible
# cdmDatabaseSchema <- "cdm_optum_extended_dod_v2323" #v2228 #v2134
# serverSuffix <- "optum_extended_dod"
# cohortDatabaseSchema <- "scratch_fbu2"
# databaseId <- "OptumDod"
# databaseName <- "Optum Clinformatics Extended Data Mart - Date of Death (DOD)"
# databaseDescription <- "Optum Clinformatics Extended DataMart is an adjudicated US administrative health claims database for members of private health insurance, who are fully insured in commercial plans or in administrative services only (ASOs), Legacy Medicare Choice Lives (prior to January 2006), and Medicare Advantage (Medicare Advantage Prescription Drug coverage starting January 2006). The population is primarily representative of commercial claims patients (0-65 years old) with some Medicare (65+ years old) however ages are capped at 90 years. It includes data captured from administrative claims processed from inpatient and outpatient medical services and prescriptions as dispensed, as well as results for outpatient lab tests processed by large national lab vendors who participate in data exchange with Optum. This dataset also provides date of death (month and year only) for members with both medical and pharmacy coverage from the Social Security Death Master File (however after 2011 reporting frequency changed due to changes in reporting requirements) and location information for patients is at the US state level."
# tablePrefix <- "legend_t2dm_optum_dod"
# outputFolder <- "E:/LegendT2dmOutput_optum_dod_drug2"
cdmDatabaseSchema <- "cdm_optum_extended_dod_v2323" #v2228 #v2134
serverSuffix <- "optum_extended_dod"
cohortDatabaseSchema <- "scratch_fbu2"
databaseId <- "OptumDod"
databaseName <- "Optum Clinformatics Extended Data Mart - Date of Death (DOD)"
databaseDescription <- "Optum Clinformatics Extended DataMart is an adjudicated US administrative health claims database for members of private health insurance, who are fully insured in commercial plans or in administrative services only (ASOs), Legacy Medicare Choice Lives (prior to January 2006), and Medicare Advantage (Medicare Advantage Prescription Drug coverage starting January 2006). The population is primarily representative of commercial claims patients (0-65 years old) with some Medicare (65+ years old) however ages are capped at 90 years. It includes data captured from administrative claims processed from inpatient and outpatient medical services and prescriptions as dispensed, as well as results for outpatient lab tests processed by large national lab vendors who participate in data exchange with Optum. This dataset also provides date of death (month and year only) for members with both medical and pharmacy coverage from the Social Security Death Master File (however after 2011 reporting frequency changed due to changes in reporting requirements) and location information for patients is at the US state level."
tablePrefix <- "legend_t2dm_optum_dod"
outputFolder <- "E:/LegendT2dmOutput_optum_dod_drug2"


conn <- DatabaseConnector::createConnectionDetails(
Expand Down Expand Up @@ -88,15 +88,15 @@ assessPhenotypes(connectionDetails = conn,
createOutcomeCohorts = TRUE,
runOutcomeCohortDiagnostics = FALSE) #TRUE)

# assessPropensityModels(connectionDetails = conn,
# cdmDatabaseSchema = cdmDatabaseSchema,
# tablePrefix = tablePrefix,
# indicationId = 'drug',
# oracleTempSchema = oracleTempSchema,
# cohortDatabaseSchema = cohortDatabaseSchema,
# outputFolder = outputFolder,
# databaseId = databaseId,
# maxCores = 16)
assessPropensityModels(connectionDetails = conn,
cdmDatabaseSchema = cdmDatabaseSchema,
tablePrefix = tablePrefix,
indicationId = 'drug',
oracleTempSchema = oracleTempSchema,
cohortDatabaseSchema = cohortDatabaseSchema,
outputFolder = outputFolder,
databaseId = databaseId,
maxCores = 16)


# Cohort Explorer
Expand Down Expand Up @@ -157,30 +157,31 @@ execute(connectionDetails = conn,
runSections = c(1:6),
computeCovariateBalance = TRUE,
exportToCsv = TRUE,
maxCores = 16)
maxCores = 10)

# # try re-packaging OptumEHR result files
# execute(
# connectionDetails = conn,
# cdmDatabaseSchema = cdmDatabaseSchema,
# oracleTempSchema = oracleTempSchema,
# cohortDatabaseSchema = cohortDatabaseSchema,
# outputFolder = outputFolder,
# indicationId = "drug",
# databaseId = databaseId,
# databaseName = databaseName,
# databaseDescription = databaseDescription,
# tablePrefix = tablePrefix,
# createExposureCohorts = FALSE,
# createOutcomeCohorts = FALSE,
# fetchAllDataFromServer = FALSE,
# generateAllCohortMethodDataObjects = FALSE,
# runCohortMethod = FALSE,
# runSections = c(1:6),
# computeCovariateBalance = FALSE,
# exportToCsv = TRUE,
# maxCores = 4
# )

# quick bug-fix to re-package results (likelihood profile re-extraction)
# re-run SGLT2i with OT2 only
# execute(connectionDetails = conn,
# cdmDatabaseSchema = cdmDatabaseSchema,
# oracleTempSchema = oracleTempSchema,
# cohortDatabaseSchema = cohortDatabaseSchema,
# outputFolder = outputFolder,
# indicationId = "sglt2i",
# databaseId = databaseId,
# databaseName = databaseName,
# databaseDescription = databaseDescription,
# tablePrefix = tablePrefix,
# createExposureCohorts = FALSE,
# createOutcomeCohorts = TRUE,
# fetchAllDataFromServer = TRUE,
# generateAllCohortMethodDataObjects = TRUE,
# runCohortMethod = TRUE,
# runSections = c(3,6),
# computeCovariateBalance = TRUE,
# exportToCsv = TRUE,
# maxCores = 16)
#

#### test staged execution code on a big JnJ data source ----
# prepareStagedExecution(originalOutputFolder = outputFolder,
Expand Down
41 changes: 30 additions & 11 deletions extra/ManageDrugDiagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,25 @@ drugSchema <- "legendt2dm_drug_diagnostics"


## grant user read permission
LegendT2dm::grantPermissionOnServer(connectionDetails = connectionDetails,
user = "legend", schema = drugSchema)
# LegendT2dm::grantPermissionOnServer(connectionDetails = connectionDetails,
# user = "legend", schema = drugSchema)
#
# ## grant user read permission
# LegendT2dm::grantPermissionOnServer(connectionDetails = connectionDetails,
# user = "legendt2dm_readonly", schema = drugSchema)

# uploaded, Oct 2023
CohortDiagnostics::uploadResults(
connectionDetails = connectionDetails,
schema = drugSchema,
zipFileName = "E:/LegendT2dmOutput_optum_ehr_drug2/drug/cohortDiagnosticsExport/Results_drug_exposures_OptumEHR.zip")

# uploaded, Oct 2023
CohortDiagnostics::uploadResults(
connectionDetails = connectionDetails,
schema = drugSchema,
zipFileName = "C:/Users/Admin_FBu2/Downloads/b9ps8anh_Results_drug_exposures_CUIMC.zip")

## grant user read permission
LegendT2dm::grantPermissionOnServer(connectionDetails = connectionDetails,
user = "legendt2dm_readonly", schema = drugSchema)

# uploaded, Feb 28 2023
CohortDiagnostics::uploadResults(
Expand All @@ -71,12 +84,6 @@ CohortDiagnostics::uploadResults(
zipFileName = "E:/LegendT2dmOutput_mdcd_new/sglt2i/cohortDiagnosticsExport/Results_sglt2i_exposures_MDCD.zip")


# # uploaded for dpp4i too, Feb 6 2023
# CohortDiagnostics::uploadResults(
# connectionDetails = connectionDetails,
# schema = drugSchema,
# zipFileName = "E:/LegendT2dmOutput_mdcr_DPP4I_2/DPP4I/cohortDiagnosticsExport/Results_DPP4I_exposures_MDCR.zip")

# uploaded, Feb 8 2023
CohortDiagnostics::uploadResults(
connectionDetails = connectionDetails,
Expand All @@ -96,6 +103,18 @@ CohortDiagnostics::uploadResults(
zipFileName = "E:/Results_sglt2i_exposures_CUIMC.zip")


# Sept 2023: upload IQVIA data sources' exposure diagnostics
CohortDiagnostics::uploadResults(
connectionDetails = connectionDetails,
schema = drugSchema,
zipFileName = "E:/Results_drug_exposures_DA_GERMANY.zip")

CohortDiagnostics::uploadResults(
connectionDetails = connectionDetails,
schema = drugSchema,
zipFileName = "E:/Results_drug_exposures_LPD_FRANCE.zip")



# CohortDiagnostics::uploadResults(
# connectionDetails = connectionDetails,
Expand Down
25 changes: 19 additions & 6 deletions extra/ManageDrugResults.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,39 @@ LegendT2dm::grantPermissionOnServer(connectionDetails = connectionDetails,


# July 2023 drug-vs-drug CES results upload ----
# Results uploaded for newer data versions!
# March 2023: uploaded DA Germany & US Open Claims
# Results after for newer data version & package de-bug
LegendT2dm::uploadResultsToDatabase(
connectionDetails = connectionDetails,
schema = resultsSchema,
purgeSiteDataBeforeUploading = FALSE,
purgeSiteDataBeforeUploading =TRUE,
zipFileName = c(
#"E:/LegendT2dmOutput_mdcr_drug/drug/export/Results_drug_study_MDCR.zip",
#"E:/LegendT2dmOutput_ccae_drug/drug/export/Results_drug_study_CCAE.zip"
#"E:/LegendT2dmOutput_optum_ehr_new/sglt2i/export/Results_sglt2i_study_OptumEHR.zip",
#"E:/LegendT2dmOutput_optum_dod_new/sglt2i/export/Results_sglt2i_study_OptumDod.zip",
#"E:/LegendT2dmOutput_mdcd_drug2/drug/export/Results_drug_study_MDCD.zip",
"E:/LegendT2dmOutput_mdcr_continuousAge_test/sglt2i/export/Results_sglt2i_study_MDCR.zip",
#"E:/LegendT2dmOutput_ccae_sglt2i_new/sglt2i/export/Results_sglt2i_study_CCAE.zip"
#"E:/LegendT2dmOutput_mdcr_continuousAge_test/sglt2i/export/Results_sglt2i_study_MDCR.zip",
#"E:/LegendT2dmOutput_ccae_sglt2i_new/sglt2i/export/Results_sglt2i_study_CCAE.zip",
#"C:/Users/Admin_FBu2/Downloads/Results_drug_study_DA_GERMANY.zip",
#"C:/Users/Admin_FBu2/Downloads/Results_drug_study_LPD_FRANCE.zip",
# "E:/Results_drug_study_LPD_FRANCE.zip",
# "E:/Results_drug_study_DA_GERMANY.zip",
# "E:/LegendT2dmOutput_mdcr_drug2/drug/export/Results_drug_study_MDCR.zip",
# "E:/LegendT2dmOutput_mdcd_drug2/drug/export/Results_drug_study_MDCD.zip",
"E:/LegendT2dmOutput_optum_ehr_drug2/drug/export/Results_drug_study_OptumEHR.zip",
#"C:/Users/Admin_FBu2/Downloads/rzbxa8v1_Results_drug_study_IMRD.zip",
NULL
),
specifications = tibble::tibble(read.csv("inst/settings/ResultsModelSpecs.csv"))
specifications = tibble::tibble(read.csv("inst/settings/ResultsModelSpecs.csv")),
tempFolder = "E:/uploadTemp/"
)


# locally examine OptumEHR drug-v-drug results
optumEHRZipFile = "E:/LegendT2dmOutput_optum_ehr_drug2/drug/export/Results_drug_study_OptumEHR.zip"
LegendT2dm::prepareForEvidenceExplorer(resultsZipFile = optumEHRZipFile,
dataFolder = "E:/LegendT2dmOutput_optum_ehr_drug2/EvidenceExplorer/")



imrdZipFile <- "/Users/msuchard/Dropbox/Projects/LegendT2dm_Results/class_ces/5w17o2h3_Results_class_study_UK-IMRD.zip"
Expand Down

0 comments on commit a6a5108

Please sign in to comment.