From 741c6edc8fa40879117b00b29378cdc7f98252f8 Mon Sep 17 00:00:00 2001 From: nhall6 Date: Mon, 5 Feb 2024 14:02:18 -0500 Subject: [PATCH 001/143] updating documentation on the html help files for all modules --- inst/about-www/about.html | 3 +-- inst/characterization-www/characterization.html | 12 +++++++++++- .../cohort-diagnostics.html | 7 +++---- inst/cohort-generator-www/cohort-generator.html | 4 +++- inst/cohort-method-www/cohort-method.html | 12 +++++++++++- inst/datasources-www/datasources.html | 16 +--------------- .../evidence-synthesis.html | 6 ++++-- .../patient-level-prediction.html | 3 ++- inst/phevaluator-www/phevaluator.html | 8 ++++++-- inst/sccs-www/sccs.html | 14 +++++++++++++- 10 files changed, 55 insertions(+), 30 deletions(-) diff --git a/inst/about-www/about.html b/inst/about-www/about.html index 4234df10..c82bd54d 100644 --- a/inst/about-www/about.html +++ b/inst/about-www/about.html @@ -1,2 +1 @@ -

Shiny View Homepage

-

Find information about the shiny viewer here

\ No newline at end of file +

On this page, you will find general information about the dashboard tool you are currently viewing, and how to use it.

\ No newline at end of file diff --git a/inst/characterization-www/characterization.html b/inst/characterization-www/characterization.html index 72e455ca..98b0373f 100644 --- a/inst/characterization-www/characterization.html +++ b/inst/characterization-www/characterization.html @@ -1,3 +1,13 @@

Description

-

Information about the study and links to the code used to run the study

+

Characterization is an R package for performing characterization of a target and a comparator cohort. This module:

+ + + +

For more information, please visit this page

\ No newline at end of file diff --git a/inst/cohort-diagnostics-www/cohort-diagnostics.html b/inst/cohort-diagnostics-www/cohort-diagnostics.html index 2f871aeb..5d1d4739 100644 --- a/inst/cohort-diagnostics-www/cohort-diagnostics.html +++ b/inst/cohort-diagnostics-www/cohort-diagnostics.html @@ -1,5 +1,4 @@

Cohort Diagnostics

-

- Cohort Level Diagnostics allow evaluation of phenotype algorithms within a study. - These should give insights into populations used. -

\ No newline at end of file +

Cohort Level Diagnostics allow evaluation of phenotype algorithms within a study. +These should give insights into populations used and their characteristics.

+

For more information, please visit this page

\ No newline at end of file diff --git a/inst/cohort-generator-www/cohort-generator.html b/inst/cohort-generator-www/cohort-generator.html index 0b676239..b5c7ad72 100644 --- a/inst/cohort-generator-www/cohort-generator.html +++ b/inst/cohort-generator-www/cohort-generator.html @@ -6,4 +6,6 @@

Cohort Generator

  • Cohort counts at the subject-level and at the event/record-level are shown in the "Cohort Counts" tab.
  • Cohort generation status and information on run time can be found in the "Cohort Generation" tab.
  • Cohort attrition statistics can be found in the "Inclusion Rules & Attrition" tab in both tabular and plotted form.
  • - \ No newline at end of file + + +

    For more information, please visit this page

    \ No newline at end of file diff --git a/inst/cohort-method-www/cohort-method.html b/inst/cohort-method-www/cohort-method.html index 72e455ca..0c6b3b8f 100644 --- a/inst/cohort-method-www/cohort-method.html +++ b/inst/cohort-method-www/cohort-method.html @@ -1,3 +1,13 @@

    Description

    -

    Information about the study and links to the code used to run the study

    +

    CohortMethod is an R package for performing new-user cohort studies in an observational database in the OMOP Common Data Model. This module: + +

    + +

    For more information, please visit this page

    \ No newline at end of file diff --git a/inst/datasources-www/datasources.html b/inst/datasources-www/datasources.html index 9dcb6d6d..a3e63a73 100644 --- a/inst/datasources-www/datasources.html +++ b/inst/datasources-www/datasources.html @@ -1,15 +1 @@ -

    Below are the descriptions of each column in the Data Sources Module:

    - \ No newline at end of file +

    This module gives an overview of the data sources used in this study.

    diff --git a/inst/evidence-synthesis-www/evidence-synthesis.html b/inst/evidence-synthesis-www/evidence-synthesis.html index db8e9289..3bd5c900 100644 --- a/inst/evidence-synthesis-www/evidence-synthesis.html +++ b/inst/evidence-synthesis-www/evidence-synthesis.html @@ -1,4 +1,6 @@

    Evidence Synthesis

    - Shows all the estimates and meta analysis results -

    \ No newline at end of file + This R package contains routines for combining causal effect estimates and study diagnostics across multiple data sites in a distributed study. This includes functions for performing meta-analysis and forest plots. +

    + +

    For more information, please visit this page

    \ No newline at end of file diff --git a/inst/patient-level-prediction-www/patient-level-prediction.html b/inst/patient-level-prediction-www/patient-level-prediction.html index 04c9f724..55815228 100644 --- a/inst/patient-level-prediction-www/patient-level-prediction.html +++ b/inst/patient-level-prediction-www/patient-level-prediction.html @@ -1,2 +1,3 @@

    Prediction Module

    -

    add info here

    \ No newline at end of file +

    PatientLevelPrediction is an R package for building and validating patient-level predictive models using data in the OMOP Common Data Model format.

    +

    For more information, please visit this page

    \ No newline at end of file diff --git a/inst/phevaluator-www/phevaluator.html b/inst/phevaluator-www/phevaluator.html index e1425a92..ef9edc75 100644 --- a/inst/phevaluator-www/phevaluator.html +++ b/inst/phevaluator-www/phevaluator.html @@ -1,4 +1,6 @@ -

    Below are the descriptions of each tab in the PheValuator Module, which will appear after clicking the "Generate Results" button below:

    +

    The goal of PheValuator is to produce a large cohort of subjects each with a predicted probability for a specified health outcome of interest (HOI). This is achieved by developing a diagnostic predictive model for the HOI using the PatientLevelPrediction (PLP) R package and applying the model to a large, randomly selected population. These subjects can be used to test one or more phenotype algorithms.

    + +

    Below are the descriptions of relevant fields in the PheValuator Module.

    \ No newline at end of file + + +

    For more information, please visit this page

    \ No newline at end of file diff --git a/inst/sccs-www/sccs.html b/inst/sccs-www/sccs.html index 44373c91..272923d3 100644 --- a/inst/sccs-www/sccs.html +++ b/inst/sccs-www/sccs.html @@ -1,2 +1,14 @@

    Self Controlled Case Series

    -

    Information

    +

    SelfControlledCaseSeries is an R package for performing Self-Controlled Case Series (SCCS) analyses in an observational database in the OMOP Common Data Model. This module:

    + + + +

    For more information, please visit this page

    \ No newline at end of file From 3b8054f264b0f5ca5ab9fd65eb2cc97975e1c945 Mon Sep 17 00:00:00 2001 From: nhall6 Date: Mon, 12 Feb 2024 11:36:51 -0500 Subject: [PATCH 002/143] Update cohort-method.html temp fix for CohortMethod module automatically opening help link - disabling link --- inst/cohort-method-www/cohort-method.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/cohort-method-www/cohort-method.html b/inst/cohort-method-www/cohort-method.html index 0c6b3b8f..0fd54ddb 100644 --- a/inst/cohort-method-www/cohort-method.html +++ b/inst/cohort-method-www/cohort-method.html @@ -9,5 +9,5 @@

    Description

  • Supports the following outcome models: (conditional) logistic regression, (conditional) Poisson regression, and (conditional) Cox regression.
  • -

    For more information, please visit this page

    +

    For more information, please visit https://github.com/OHDSI/CohortMethod

    \ No newline at end of file From 048a9b1d3a58a6bf08a2da51ad5ebffee395d01d Mon Sep 17 00:00:00 2001 From: jreps Date: Fri, 16 Feb 2024 08:53:06 -0500 Subject: [PATCH 003/143] protocol generator fix - added message when generating - added trycatch when target cohort json has issues (subset?) - added chunk names for debugging --- R/helper-getPredictionProtocol.R | 8 +++--- R/patient-level-prediction-main.R | 8 +++++- .../main.Rmd | 10 ++++---- .../model-design.Rmd | 25 ++++++++++++------- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/R/helper-getPredictionProtocol.R b/R/helper-getPredictionProtocol.R index 54eed021..ed0d6a24 100644 --- a/R/helper-getPredictionProtocol.R +++ b/R/helper-getPredictionProtocol.R @@ -1,15 +1,15 @@ createPredictionProtocol <- function( connectionHandler, resultDatabaseSettings, - modelDesignId, - output, - intermediatesDir = file.path(tempdir(), 'plp-prot') + modelDesignId, + output, + intermediatesDir = file.path(tempdir(), 'plp-prot') ){ #require('CirceR') # get the data #protocolLoc <- 'modules/prediction/documents/main.Rmd' - protocolLoc <- system.file('prediction-document', "main.Rmd", package = "OhdsiShinyModules") + protocolLoc <- system.file('patient-level-prediction-document', "main.Rmd", package = "OhdsiShinyModules") if(!dir.exists(intermediatesDir)){ dir.create(intermediatesDir) diff --git a/R/patient-level-prediction-main.R b/R/patient-level-prediction-main.R index 943b63e8..3054f2f5 100644 --- a/R/patient-level-prediction-main.R +++ b/R/patient-level-prediction-main.R @@ -264,7 +264,13 @@ patientLevelPredictionServer <- function( file.remove(file.path(protocolOutputLoc, 'main.html')) } tryCatch( - {createPredictionProtocol( + { + shiny::showNotification( + ui = 'Generating protocol - takes some time', + type = 'message' + ) + + createPredictionProtocol( connectionHandler = connectionHandler, resultDatabaseSettings = resultDatabaseSettings, modelDesignId = designSummary$reportId(), diff --git a/inst/patient-level-prediction-document/main.Rmd b/inst/patient-level-prediction-document/main.Rmd index 08a05e63..750a9639 100644 --- a/inst/patient-level-prediction-document/main.Rmd +++ b/inst/patient-level-prediction-document/main.Rmd @@ -30,7 +30,7 @@ Created by: shinyApp # Abbreviations -```{r echo=FALSE} +```{r abbreviations, echo=FALSE} abb <- data.frame(rbind( c("AUROC", "Area Under the Receiver Operating Characteristic Curve"), @@ -55,17 +55,17 @@ In this study the model development follows the framework presented in ``r para # Evaluation Metrics and Plots -```{r, child = "plp-metrics.Rmd"} +```{r metrics, child = "plp-metrics.Rmd"} ``` -```{r, child = "plp-output.Rmd"} +```{r output, child = "plp-output.Rmd"} ``` -```{r, child = "plp-plots.Rmd"} +```{r plots, child = "plp-plots.Rmd"} ``` -```{r results='asis', echo=FALSE} +```{r design diag results, results='asis', echo=FALSE} for (i in 1:length(params$modelDesignIds)) { modelDesignId <- params$modelDesignIds[i] modelDesign <- knitr::knit_child("model-design.Rmd", quiet = TRUE, envir = environment()) diff --git a/inst/patient-level-prediction-document/model-design.Rmd b/inst/patient-level-prediction-document/model-design.Rmd index 9a4f38bd..c8cc8824 100644 --- a/inst/patient-level-prediction-document/model-design.Rmd +++ b/inst/patient-level-prediction-document/model-design.Rmd @@ -2,7 +2,7 @@ output: html_document --- -```{r, echo=FALSE, results='asis'} +```{r get model design, echo=FALSE, results='asis'} getModelDesign <- function( connectionHandler, @@ -67,7 +67,10 @@ getModelDesign <- function( extract_name = ref$extractName[j] ) -res <- ParallelLogger::convertJsonToSettings(res$value) +res <- tryCatch( + {ParallelLogger::convertJsonToSettings(res$value)}, + error = function(e){print(e); return(list())} +) return(res) }) @@ -93,7 +96,11 @@ res <- ParallelLogger::convertJsonToSettings(res$value) cohort_type = c('target_id','outcome_id')[tind] ) -result[[length(result)+1]] <- ParallelLogger::convertJsonToSettings(res$value) +result[[length(result)+1]] <- + tryCatch( + {ParallelLogger::convertJsonToSettings(res$value)}, + error = function(e){print(e); return(list())} +) } @@ -125,21 +132,21 @@ splitSettings <- modelDesign$splitSettings -```{r echo=FALSE, results='asis'} +```{r print model heading, echo=FALSE, results='asis'} cat('\n# Model ', params$modelDesignIds[i], '\n') ``` + ## Model Design -```{r, child = "plp-participants.Rmd"} +```{r participants, child = "plp-participants.Rmd"} ``` -```{r, child = "plp-predictors.Rmd"} +```{r predictors, child = "plp-predictors.Rmd"} ``` -```{r, child = "plp-outcome.Rmd"} +```{r outcome, child = "plp-outcome.Rmd"} ``` -```{r, child = "plp-analysis.Rmd"} +```{r analysis, child = "plp-analysis.Rmd"} ``` - From c532acb4a116703d68fdcfa55593b2fc36fa870f Mon Sep 17 00:00:00 2001 From: Jamie Gilbert Date: Thu, 22 Feb 2024 13:08:52 -0800 Subject: [PATCH 004/143] Fixed for orphan concepts not displaying in cd reports --- DESCRIPTION | 2 +- NEWS.md | 5 +++++ R/cohort-diagnostics-main.R | 2 +- R/cohort-diagnostics-orphanConcepts.R | 12 ++++++------ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8e1d2c50..69d22d5a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: OhdsiShinyModules Type: Package Title: Repository of Shiny Modules for OHDSI Result Viewers -Version: 2.1.2 +Version: 2.1.3 Author: Jenna Reps Maintainer: Jenna Reps Description: Install this package to access useful shiny modules for building shiny apps to explore results using the OHDSI tools . diff --git a/NEWS.md b/NEWS.md index cca40436..bf2efef7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +OhdsiShinyModules v2.1.3 +======================== +Fixed bug of orphan concepts report not displaying +Fixed bug in orphan concepts where negative database ids were causing dynamic sql queries to crash + OhdsiShinyModules v2.1.2 ======================== Fixed bug in cohort diagnostics incidence rate plots not showing for different strata diff --git a/R/cohort-diagnostics-main.R b/R/cohort-diagnostics-main.R index 7c557d0e..fb80e16a 100644 --- a/R/cohort-diagnostics-main.R +++ b/R/cohort-diagnostics-main.R @@ -433,7 +433,7 @@ cohortDiagnosticsServer <- function(id, if ("includedSourceConcept" %in% dataSource$enabledReports) selection["Concepts In Data Source"] <- "conceptsInDataSource" - if ("orphanConcepts" %in% dataSource$enabledReports) + if ("orphanConcept" %in% dataSource$enabledReports) selection["Orphan Concepts"] <- "orphanConcepts" if ("indexEventBreakdown" %in% dataSource$enabledReports) diff --git a/R/cohort-diagnostics-orphanConcepts.R b/R/cohort-diagnostics-orphanConcepts.R index d539812b..02464c34 100644 --- a/R/cohort-diagnostics-orphanConcepts.R +++ b/R/cohort-diagnostics-orphanConcepts.R @@ -122,8 +122,8 @@ orphanConceptsModule <- function(id, }) databaseSubGrp <- ", - MAX(CASE WHEN oc.database_id = '@db_id_i' THEN oc.concept_count END) AS concept_count_@db_id_i, - MAX(CASE WHEN oc.database_id = '@db_id_i' THEN oc.concept_subjects END) AS subject_count_@db_id_i" + MAX(CASE WHEN oc.database_id = '@db_id_i' THEN oc.concept_count END) AS concept_count_@db_id_id, + MAX(CASE WHEN oc.database_id = '@db_id_i' THEN oc.concept_subjects END) AS subject_count_@db_id_id" sql <- " SELECT @@ -170,11 +170,11 @@ orphanConceptsModule <- function(id, "Vocabulary Id" = "c.vocabulary_id", "Concept Code" = "c.concept_code") for (dbid in databaseIds) { - dbCols <- SqlRender::render(databaseSubGrp, db_id_i = dbid) + dbCols <- SqlRender::render(databaseSubGrp, db_id_i = dbid, db_id_id = gsub("-", "", dbid)) dbSelectCols <- paste(dbSelectCols, dbCols) - columnIdCount <- SqlRender::snakeCaseToCamelCase(paste0("concept_count_", dbid)) - columnIdSubject <- SqlRender::snakeCaseToCamelCase(paste0("subject_count_", dbid)) + columnIdCount <- SqlRender::snakeCaseToCamelCase(paste0("concept_count_", gsub("-", "", dbid))) + columnIdSubject <- SqlRender::snakeCaseToCamelCase(paste0("subject_count_", gsub("-", "", dbid))) columnDefinitions[[columnIdCount]] <- reactable::colDef(name = "Records", cell = formatDataCellValueInDisplayTable(), @@ -195,7 +195,7 @@ orphanConceptsModule <- function(id, ) cNames <- names(sortByColumns) - sortByColumns <- c(sortByColumns, paste0("concept_count_", dbid), paste0("subject_count_", dbid)) + sortByColumns <- c(sortByColumns, paste0("concept_count_", gsub("-", "", dbid)), paste0("subject_count_", gsub("-", "", dbid))) names(sortByColumns) <- c(cNames, paste(databaseName, "Records"), paste(databaseName, "Subjects")) } From dda8c0bb7e0860c60e331180b7804bf2a12a50c8 Mon Sep 17 00:00:00 2001 From: nhall6 Date: Fri, 23 Feb 2024 10:17:15 -0500 Subject: [PATCH 005/143] fixing plot color palette to work for a higher number of dbs in standard plots and to be colorblind-friendly --- R/characterization-incidence.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R/characterization-incidence.R b/R/characterization-incidence.R index 8987653a..9975e789 100644 --- a/R/characterization-incidence.R +++ b/R/characterization-incidence.R @@ -1287,7 +1287,7 @@ characterizationIncidenceServer <- function( ) + #geom_jitter() + #scale_size_continuous(range = c(5,15)) + - ggplot2::scale_colour_brewer(palette = "Dark2") + + ggplot2::scale_colour_brewer(palette = "Paired") + ggplot2::facet_wrap( Target~Outcome, labeller = "label_both", @@ -1429,7 +1429,7 @@ renderIrPlotStandardAgeSex <- shiny::reactive( ) + #geom_jitter() + #scale_size_continuous(range = c(5,15)) + - ggplot2::scale_colour_brewer(palette = "Dark2") + + ggplot2::scale_colour_brewer(palette = "Paired") + ggplot2::facet_wrap( Target~Outcome, labeller = "label_both", @@ -1577,10 +1577,10 @@ renderIrPlotStandardYear <- shiny::reactive( ggplot2::aes(size = 2.5) ) + ggplot2::geom_line(ggplot2::aes(linetype = genderName)) + - ggplot2::scale_colour_brewer(palette = "Dark2") + + ggplot2::scale_colour_brewer(palette = "Paired") + #geom_jitter() + #scale_size_continuous(range = c(5,15)) + - # ggplot2::scale_colour_brewer(palette = "Dark2") + + # ggplot2::scale_colour_brewer(palette = "Paired") + # ggplot2::facet_grid( # rows = dplyr::vars(Outcome), # cols = dplyr::vars(Age), @@ -1728,7 +1728,7 @@ renderIrPlotStandardAggregate <- shiny::reactive( ) + #ggplot2::geom_jitter() + #scale_size_continuous(range = c(5,15)) + - ggplot2::scale_colour_brewer(palette = "Dark2") + + ggplot2::scale_colour_brewer(palette = "Paired") + ggplot2::facet_wrap( Target~Outcome, labeller = "label_both", From c96ca406e2dc9eba54a06b9298cebeac8e9ec3cc Mon Sep 17 00:00:00 2001 From: nhall6 Date: Fri, 23 Feb 2024 10:53:22 -0500 Subject: [PATCH 006/143] fixing bugs in some standard plots --- R/characterization-incidence.R | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/R/characterization-incidence.R b/R/characterization-incidence.R index 9975e789..370e091b 100644 --- a/R/characterization-incidence.R +++ b/R/characterization-incidence.R @@ -1244,8 +1244,14 @@ characterizationIncidenceServer <- function( shiny::validate("Too many Target-Outcome pairs selected to plot efficiently. Please choose fewer targets and/or outcomes.") ) + #add check to make sure "> 1 distinct age is selected for by age plot"any" is in selection for year and sex + ifelse("Any" %in% inputSelectedResults()$incidenceRateCalendarFilter & "Any" %in% inputSelectedResults()$incidenceRateGenderFilter, + plotData <- filteredData(), + shiny::validate("This standard plot is designed to show results aggregated over all (`Any`) year and sex categories. Please make sure you have selected `Any` in the `Select your results` section above for these variables.") + ) + plotData <- plotData %>% - dplyr::filter(ageGroupName != "Any" & + dplyr::filter(#ageGroupName != "Any" & genderName == "Any" & startYear == "Any") %>% dplyr::mutate(targetLabel = paste(targetIdShort, " = ", targetName), @@ -1386,6 +1392,12 @@ renderIrPlotStandardAgeSex <- shiny::reactive( shiny::validate("Too many Target-Outcome pairs selected to plot efficiently. Please choose fewer targets and/or outcomes.") ) + #add check to make sure "Any" is in the year filter + ifelse("Any" %in% inputSelectedResults()$incidenceRateCalendarFilter, + plotData <- filteredData(), + shiny::validate("This standard plot is designed to show results aggregated over all (`Any`) year categories. Please make sure you have selected `Any` in the `Select your results` section above for this variable.") + ) + plotData <- plotData %>% dplyr::filter(ageGroupName != "Any" & genderName != "Any" & @@ -1743,7 +1755,7 @@ renderIrPlotStandardAggregate <- shiny::reactive( base_plot <- base_plot + ggplot2::labs( title = paste("Incidence Rate for Time at Risk:", tar_value), - x = paste(names(options$irPlotCategoricalChoices[options$irPlotCategoricalChoices %in% "ageGroupName"]), "\n"), + x = paste(names(options$irPlotCategoricalChoices[options$irPlotCategoricalChoices %in% "startYear"]), "\n"), y = names(options$irPlotNumericChoices[options$irPlotNumericChoices %in% "incidenceRateP100py"]), color = names(options$irPlotCategoricalChoices[options$irPlotCategoricalChoices %in% "cdmSourceAbbreviation"]), #size = names(options$irPlotNumericChoices[options$irPlotNumericChoices %in% "outcomes"]), From c4f7aab23b1864d18445aeca9960ad02faa9687e Mon Sep 17 00:00:00 2001 From: jreps Date: Fri, 23 Feb 2024 13:43:34 -0500 Subject: [PATCH 007/143] home module - adding home module --- DESCRIPTION | 1 + NAMESPACE | 3 ++ R/home-main.R | 101 +++++++++++++++++++++++++++++++++++++ inst/home-www/home.html | 0 man/homeHelperFile.Rd | 17 +++++++ man/homeServer.Rd | 24 +++++++++ man/homeViewer.Rd | 20 ++++++++ tests/testthat/test-home.R | 27 ++++++++++ 8 files changed, 193 insertions(+) create mode 100644 R/home-main.R create mode 100644 inst/home-www/home.html create mode 100644 man/homeHelperFile.Rd create mode 100644 man/homeServer.Rd create mode 100644 man/homeViewer.Rd create mode 100644 tests/testthat/test-home.R diff --git a/DESCRIPTION b/DESCRIPTION index 69d22d5a..cbbfea4a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,6 +36,7 @@ Imports: shiny, shinycssloaders, shinydashboard, + shinyglide, shinyWidgets, SqlRender, stringi, diff --git a/NAMESPACE b/NAMESPACE index 7702d5cd..39f7cdd3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -70,6 +70,9 @@ export(evidenceSynthesisServer) export(evidenceSynthesisViewer) export(getEnabledCdReports) export(getLogoImage) +export(homeHelperFile) +export(homeServer) +export(homeViewer) export(incidenceRatesView) export(inclusionRulesView) export(indexEventBreakdownView) diff --git a/R/home-main.R b/R/home-main.R new file mode 100644 index 00000000..060ff1c1 --- /dev/null +++ b/R/home-main.R @@ -0,0 +1,101 @@ +#' The location of the home module helper file +#' +#' @details +#' Returns the location of the home helper file +#' +#' @return +#' string location of the home helper file +#' +#' @export +homeHelperFile <- function(){ + fileLoc <- system.file('home-www', "home.html", package = "OhdsiShinyModules") + return(fileLoc) +} + +#' The module viewer for exploring home +#' +#' @details +#' The user specifies the id for the module +#' +#' @param id the unique reference id for the module +#' +#' @return +#' The user interface to the home viewer module +#' +#' @export +homeViewer <- function(id=1) { + ns <- shiny::NS(id) + + screens <- list( + shinyglide::screen( + shiny::p("Assure Executive Summary"), + shiny::p("Study Name"), + shiny::p("The study question was..."), + shiny::p(""), + next_label="Estimation Results" + ), + shinyglide::screen( + shiny::p("Estimation Results"), + shiny::p("User Inputs are possible"), + shiny::numericInput( + inputId = ns("n"), + label = "n", + value = 10, + min = 10 + ), + next_label="Prediction Results" + ), + shinyglide::screen( + shiny::p("Cool plot here"), + shiny::plotOutput(ns("cool_plot")) + ) + ) + + shinydashboard::box( + status = 'info', width = 12, + title = shiny::span( shiny::icon("house"), "Executive Summary"), + solidHeader = TRUE, + + shinyglide::glide( + height = "350px", + screens + ) + + ) + +} + + +#' The module server for exploring home +#' +#' @details +#' The user specifies the id for the module +#' +#' @param id the unique reference id for the module +#' @param connectionHandler a connection to the database with the results +#' @param resultDatabaseSettings a list containing the prediction result schema and connection details +#' +#' @return +#' The server for the home module +#' +#' @export +homeServer <- function( + id, + connectionHandler, + resultDatabaseSettings = list(port = 1) +) { + shiny::moduleServer( + id, + function(input, output, session) { + + output$cool_plot <- shiny::renderPlot({ + graphics::hist( + stats::rnorm(input$n), + main = paste("n =", input$n), + xlab = "" + ) + }) + + } + ) +} \ No newline at end of file diff --git a/inst/home-www/home.html b/inst/home-www/home.html new file mode 100644 index 00000000..e69de29b diff --git a/man/homeHelperFile.Rd b/man/homeHelperFile.Rd new file mode 100644 index 00000000..fc86dced --- /dev/null +++ b/man/homeHelperFile.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/home-main.R +\name{homeHelperFile} +\alias{homeHelperFile} +\title{The location of the home module helper file} +\usage{ +homeHelperFile() +} +\value{ +string location of the home helper file +} +\description{ +The location of the home module helper file +} +\details{ +Returns the location of the home helper file +} diff --git a/man/homeServer.Rd b/man/homeServer.Rd new file mode 100644 index 00000000..3f354286 --- /dev/null +++ b/man/homeServer.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/home-main.R +\name{homeServer} +\alias{homeServer} +\title{The module server for exploring home} +\usage{ +homeServer(id, connectionHandler, resultDatabaseSettings = list(port = 1)) +} +\arguments{ +\item{id}{the unique reference id for the module} + +\item{connectionHandler}{a connection to the database with the results} + +\item{resultDatabaseSettings}{a list containing the prediction result schema and connection details} +} +\value{ +The server for the home module +} +\description{ +The module server for exploring home +} +\details{ +The user specifies the id for the module +} diff --git a/man/homeViewer.Rd b/man/homeViewer.Rd new file mode 100644 index 00000000..52e9f299 --- /dev/null +++ b/man/homeViewer.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/home-main.R +\name{homeViewer} +\alias{homeViewer} +\title{The module viewer for exploring home} +\usage{ +homeViewer(id = 1) +} +\arguments{ +\item{id}{the unique reference id for the module} +} +\value{ +The user interface to the home viewer module +} +\description{ +The module viewer for exploring home +} +\details{ +The user specifies the id for the module +} diff --git a/tests/testthat/test-home.R b/tests/testthat/test-home.R new file mode 100644 index 00000000..88a9b03a --- /dev/null +++ b/tests/testthat/test-home.R @@ -0,0 +1,27 @@ +context("home-main") + +test_that("Test home ui", { + # Test ui + ui <- homeViewer() + checkmate::expect_list(ui) +}) + +test_that('home helper file works',{ + help <- homeHelperFile() + testthat::expect_true(help != '') +}) + +# check the home module server +shiny::testServer( + app = homeServer, + args = list( + connectionHandler = connectionHandlerCharacterization , + resultDatabaseSettings = resultDatabaseSettingsCharacterization + ), + expr = { + + # check setting and generating works + session$setInputs(n = 30) + testthat::expect_true(input$n == 30) + }) + From 46a296a41f616b3639137c9904389ff5ab06311b Mon Sep 17 00:00:00 2001 From: Jamie Gilbert Date: Fri, 23 Feb 2024 12:48:14 -0800 Subject: [PATCH 008/143] Dynamic module load --- R/evidence-synth-main.R | 107 +++++++++++++++++++++++++++++----------- 1 file changed, 79 insertions(+), 28 deletions(-) diff --git a/R/evidence-synth-main.R b/R/evidence-synth-main.R index f270ab2c..72de10ed 100644 --- a/R/evidence-synth-main.R +++ b/R/evidence-synth-main.R @@ -39,22 +39,44 @@ evidenceSynthesisViewer <- function(id=1) { # add two buttons - CM or SCCs shiny::tabsetPanel( - id = ns('typeTab'), - type = 'pills', - - shiny::tabPanel( - title = 'Cohort Method', - evidenceSynthesisCmViewer(ns('cohortMethodTab')) - ), - shiny::tabPanel( - title = 'Self Controlled Case Series', - evidenceSynthesisSccsViewer(ns('sccsTab')) - ) - + id = ns('typeTab'), + type = 'pills' ) - + ) - + +} + +checkSccsTablesPresent <- function(connectionHandler, resultDatabaseSettings) { + sql <- " + SELECT 1 as present FROM TABLE @schema.@sccs_table_prefixdiagnostics_summary; + " + present <- TRUE + tryCatch({ + connectionHandler$queryDb(sql = sql, + schema = resultDatabaseSettings$schema, + sccs_table_prefix = resultDatabaseSettings$sccsTablePrefix) + }, error = function(...) { + present <<- FALSE + }) + + return(present) +} + +checkCmTablesPresent <- function(connectionHandler, resultDatabaseSettings) { + sql <- " + SELECT 1 as present FROM TABLE @schema.@cm_table_prefixdiagnostics_summary; + " + present <- TRUE + tryCatch({ + connectionHandler$queryDb(sql = sql, + schema = resultDatabaseSettings$schema, + cm_table_prefix = resultDatabaseSettings$sccsTablePrefix) + }, error = function(...) { + present <<- FALSE + }) + + return(present) } #' The module server for exploring PatientLevelPrediction @@ -65,32 +87,61 @@ evidenceSynthesisViewer <- function(id=1) { #' @param id the unique reference id for the module #' @param connectionHandler a connection to the database with the results #' @param resultDatabaseSettings a list containing the result schema and prefixes -#' +#' #' @return #' The server for the PatientLevelPrediction module #' #' @export evidenceSynthesisServer <- function( - id, - connectionHandler, - resultDatabaseSettings = list(port = 1) + id, + connectionHandler, + resultDatabaseSettings = list(port = 1) ) { shiny::moduleServer( id, function(input, output, session) { - - evidenceSynthesisCmServer( - id = 'cohortMethodTab', - connectionHandler = connectionHandler, - resultDatabaseSettings = resultDatabaseSettings + + showSccsResults <- checkSccsTablesPresent(connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings) + + showCmResults <- checkCmTablesPresent(connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings) + + if (showCmResults) { + shiny::insertTab( + inputId = "typeTab", + tab = + shiny::tabPanel( + title = 'Cohort Method', + evidenceSynthesisCmViewer(id = session$ns('cohortMethodTab')), + select = TRUE + ) ) - - evidenceSynthesisSccsServer( - id = 'sccsTab', - connectionHandler = connectionHandler, - resultDatabaseSettings = resultDatabaseSettings + + evidenceSynthesisCmServer( + id = 'cohortMethodTab', + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings, + ) + + } + + if (showSccsResults) { + shiny::insertTab( + inputId = "typeTab", + tab = shiny::tabPanel( + title = "Self Controlled Case Series", + evidenceSynthesisSccsViewer(id = session$ns('sccsTab')), + select = !showCmResults + ) ) + evidenceSynthesisSccsServer( + id = 'sccsTab', + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings + ) + } } ) } From 48849f9ac16cce4d0b935da90a8492d153e47ee8 Mon Sep 17 00:00:00 2001 From: Jamie Gilbert Date: Fri, 23 Feb 2024 13:14:43 -0800 Subject: [PATCH 009/143] Fixes for query and module load --- R/evidence-synth-main.R | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/R/evidence-synth-main.R b/R/evidence-synth-main.R index 72de10ed..0f1143cf 100644 --- a/R/evidence-synth-main.R +++ b/R/evidence-synth-main.R @@ -49,7 +49,7 @@ evidenceSynthesisViewer <- function(id=1) { checkSccsTablesPresent <- function(connectionHandler, resultDatabaseSettings) { sql <- " - SELECT 1 as present FROM TABLE @schema.@sccs_table_prefixdiagnostics_summary; + SELECT 1 as present FROM @schema.@sccs_table_prefixdiagnostics_summary; " present <- TRUE tryCatch({ @@ -65,13 +65,13 @@ checkSccsTablesPresent <- function(connectionHandler, resultDatabaseSettings) { checkCmTablesPresent <- function(connectionHandler, resultDatabaseSettings) { sql <- " - SELECT 1 as present FROM TABLE @schema.@cm_table_prefixdiagnostics_summary; + SELECT 1 as present FROM @schema.@cm_table_prefixdiagnostics_summary; " present <- TRUE tryCatch({ connectionHandler$queryDb(sql = sql, schema = resultDatabaseSettings$schema, - cm_table_prefix = resultDatabaseSettings$sccsTablePrefix) + cm_table_prefix = resultDatabaseSettings$cmTablePrefix) }, error = function(...) { present <<- FALSE }) @@ -114,14 +114,14 @@ evidenceSynthesisServer <- function( shiny::tabPanel( title = 'Cohort Method', evidenceSynthesisCmViewer(id = session$ns('cohortMethodTab')), - select = TRUE - ) + ), + select = TRUE ) evidenceSynthesisCmServer( id = 'cohortMethodTab', connectionHandler = connectionHandler, - resultDatabaseSettings = resultDatabaseSettings, + resultDatabaseSettings = resultDatabaseSettings ) } @@ -132,8 +132,8 @@ evidenceSynthesisServer <- function( tab = shiny::tabPanel( title = "Self Controlled Case Series", evidenceSynthesisSccsViewer(id = session$ns('sccsTab')), - select = !showCmResults - ) + ), + select = !showCmResults ) evidenceSynthesisSccsServer( From 7c550fd21f9017df82cf76979487aa7fabea6f15 Mon Sep 17 00:00:00 2001 From: jreps Date: Fri, 23 Feb 2024 16:15:52 -0500 Subject: [PATCH 010/143] splitting up column definition for evidence synth cohort method and sccs splitting up column definition for evidence synth cohort method and sccs --- R/evidence-synth-cm.R | 3 ++- R/evidence-synth-main.R | 44 +++++++++++++++++++++++++---------------- R/evidence-synth-sccs.R | 3 ++- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/R/evidence-synth-cm.R b/R/evidence-synth-cm.R index e87e7d97..ee61d549 100644 --- a/R/evidence-synth-cm.R +++ b/R/evidence-synth-cm.R @@ -132,7 +132,8 @@ evidenceSynthesisCmServer <- function( df = diagSumData, colDefsInput = getColDefsESDiag( connectionHandler = connectionHandler, - resultDatabaseSettings = resultDatabaseSettings + resultDatabaseSettings = resultDatabaseSettings, + method = 'cm' ) ) diff --git a/R/evidence-synth-main.R b/R/evidence-synth-main.R index 72de10ed..cea738e8 100644 --- a/R/evidence-synth-main.R +++ b/R/evidence-synth-main.R @@ -218,10 +218,12 @@ computeTraditionalP <- function( # used by both cm and sccs getOACcombinations <- function( connectionHandler, - resultDatabaseSettings + resultDatabaseSettings, + method ){ - sql <- "SELECT DISTINCT + if(method == 'cm'){ + sql <- "SELECT DISTINCT CONCAT(cma.description, '_', cgcd2.cohort_name) as col_names FROM @schema.@cm_table_prefixdiagnostics_summary cmds @@ -229,10 +231,18 @@ getOACcombinations <- function( ON cmds.analysis_id = cma.analysis_id INNER JOIN @schema.@cg_table_prefixcohort_definition cgcd2 ON cmds.comparator_id = cgcd2.cohort_definition_id - - union - - SELECT + ;" + + result <- connectionHandler$queryDb( + sql = sql, + schema = resultDatabaseSettings$schema, + cm_table_prefix = resultDatabaseSettings$cmTablePrefix, + cg_table_prefix = resultDatabaseSettings$cgTablePrefix + ) + } + + if(method == 'sccs'){ + sql <- "SELECT CONCAT(a.description, '_', cov.covariate_name) as col_names FROM @schema.@sccs_table_prefixdiagnostics_summary ds @@ -247,15 +257,13 @@ getOACcombinations <- function( cov.exposures_outcome_set_id = ds.exposures_outcome_set_id and cov.analysis_id = ds.analysis_id ;" - - result <- connectionHandler$queryDb( - sql = sql, - schema = resultDatabaseSettings$schema, - sccs_table_prefix = resultDatabaseSettings$sccsTablePrefix, - cm_table_prefix = resultDatabaseSettings$cmTablePrefix, - cg_table_prefix = resultDatabaseSettings$cgTablePrefix, - database_table = resultDatabaseSettings$databaseTable - ) + + result <- connectionHandler$queryDb( + sql = sql, + schema = resultDatabaseSettings$schema, + sccs_table_prefix = resultDatabaseSettings$sccsTablePrefix + ) + } res <- result$colNames names(res) <- result$colNames @@ -265,7 +273,8 @@ getOACcombinations <- function( getColDefsESDiag <- function( connectionHandler, - resultDatabaseSettings + resultDatabaseSettings, + method = 'cm' # 'cm' or 'sccs' ){ fixedColumns = list( @@ -292,7 +301,8 @@ getColDefsESDiag <- function( analyses <- getOACcombinations( connectionHandler = connectionHandler, - resultDatabaseSettings = resultDatabaseSettings + resultDatabaseSettings = resultDatabaseSettings, + method = method ) colnameFormat <- merge(unique(names(analyses)), unique(names(outcomes))) colnameFormat <- apply(colnameFormat, 1, function(x){paste(x, collapse = '_', sep = '_')}) diff --git a/R/evidence-synth-sccs.R b/R/evidence-synth-sccs.R index 839242dc..86d139d3 100644 --- a/R/evidence-synth-sccs.R +++ b/R/evidence-synth-sccs.R @@ -86,7 +86,8 @@ evidenceSynthesisSccsServer <- function( df = diagSumData, colDefsInput = getColDefsESDiag( connectionHandler = connectionHandler, - resultDatabaseSettings = resultDatabaseSettings + resultDatabaseSettings = resultDatabaseSettings, + method = 'sccs' ) ) From e7e2560aa03882cf141d6ba57d006611827d13e5 Mon Sep 17 00:00:00 2001 From: jreps Date: Fri, 23 Feb 2024 16:19:44 -0500 Subject: [PATCH 011/143] Update evidence-synth-main.R adding distinct to sccs column name pull --- R/evidence-synth-main.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/evidence-synth-main.R b/R/evidence-synth-main.R index cea738e8..ffbfcfba 100644 --- a/R/evidence-synth-main.R +++ b/R/evidence-synth-main.R @@ -242,7 +242,7 @@ getOACcombinations <- function( } if(method == 'sccs'){ - sql <- "SELECT + sql <- "SELECT distinct CONCAT(a.description, '_', cov.covariate_name) as col_names FROM @schema.@sccs_table_prefixdiagnostics_summary ds From 7ee0f6794acb29fa27eb4f872e980e4fe3659158 Mon Sep 17 00:00:00 2001 From: jreps Date: Fri, 1 Mar 2024 11:31:06 -0500 Subject: [PATCH 012/143] Update characterization-main.R fixing wrong position of selectVal = F causing tab to not show in characterization if 'Target Viewer' is not run. --- R/characterization-main.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/characterization-main.R b/R/characterization-main.R index 1cf1b21a..5cfdf43e 100644 --- a/R/characterization-main.R +++ b/R/characterization-main.R @@ -87,7 +87,7 @@ characterizationServer <- function( connectionHandler = connectionHandler, resultDatabaseSettings = resultDatabaseSettings ) - + # add the tabs based on results types <- list( c("Target Viewer","characterizationTableViewer", "descriptiveTableTab"), @@ -107,8 +107,9 @@ characterizationServer <- function( ), select = selectVal ) + selectVal = F } - selectVal = F + } previouslyLoaded <- shiny::reactiveVal(c()) From 7618a11fe97909bf510c2ee14f68650088545b58 Mon Sep 17 00:00:00 2001 From: nhall6 Date: Thu, 14 Mar 2024 10:27:36 -0400 Subject: [PATCH 013/143] updating about module --- R/about-main.R | 373 ++++++++++++++++++++++++++++++++++++-- inst/about-www/about.html | 12 +- man/aboutServer.Rd | 3 +- 3 files changed, 373 insertions(+), 15 deletions(-) diff --git a/R/about-main.R b/R/about-main.R index d3019a49..644ac572 100644 --- a/R/about-main.R +++ b/R/about-main.R @@ -47,24 +47,288 @@ aboutViewer <- function( ) { ns <- shiny::NS(id) - shinydashboard::box( - status = 'info', width = 12, - title = shiny::span( shiny::icon("info"), "About OHDSI Viewer"), - solidHeader = TRUE, + #shinydashboard::dashboardBody( + shiny::div( + fluidRow( + tags$head(tags$style(HTML(".small-box {height: 200px; width: 100%;}"))), + shinydashboard::box( + width = "100%", + shiny::htmlTemplate(system.file("about-www", "about.html", package = utils::packageName())) + ) + # ) + ), + fluidRow( + valueBoxOutput("newOrdersBox", width = 3), + valueBoxOutput("progressBox", width = 3), + valueBoxOutput("approvalBox", width = 3), + valueBoxOutput("valueBox1", width = 3) + ), + fluidRow( + valueBoxOutput("valueBox2", width = 3), + valueBoxOutput("valueBox3", width = 3), + valueBoxOutput("valueBox4", width = 3), + valueBoxOutput("valueBox5", width = 3) + ), + tags$script(' + $(document).ready(function(){ + $("#newOrdersBox").click(function(){ + $("#newOrdersModal").modal("show"); + }); + + $("#progressBox").click(function(){ + $("#progressModal").modal("show"); + }); + + $("#approvalBox").click(function(){ + $("#approvalModal").modal("show"); + }); + + $("#valueBox1").click(function(){ + $("#modal1").modal("show"); + }); + + $("#valueBox2").click(function(){ + $("#modal2").modal("show"); + }); + + $("#valueBox3").click(function(){ + $("#modal3").modal("show"); + }); + + $("#valueBox4").click(function(){ + $("#modal4").modal("show"); + }); - shiny::fluidPage( - shiny::fluidRow( - shiny::includeMarkdown( - path = system.file( - 'about-document', - "introduction.md", - package = "OhdsiShinyModules" + $("#valueBox5").click(function(){ + $("#modal5").modal("show"); + }); + }); + '), + tags$div( + id = "newOrdersModal", + class = "modal fade", + tags$div( + class = "modal-dialog modal-dialog-centered", + tags$div( + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3( + class = "modal-title", + "New Orders Modal" + ), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) + ), + tags$div( + class = "modal-body", + "This is the New Orders modal." + ) + ) + ) + ), + tags$div( + id = "progressModal", + class = "modal fade", + tags$div( + class = "modal-dialog modal-dialog-centered", + tags$div( + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3( + class = "modal-title", + "Progress Modal" + ), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) + ), + tags$div( + class = "modal-body", + "This is the Progress modal." + ) + ) + ) + ), + tags$div( + id = "approvalModal", + class = "modal fade", + tags$div( + class = "modal-dialog modal-dialog-centered", + tags$div( + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3( + class = "modal-title", + "Approval Modal" + ), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) + ), + tags$div( + class = "modal-body", + "This is the Approval modal." + ) + ) + ) + ), + tags$div( + id = "modal1", + class = "modal fade", + tags$div( + class = "modal-dialog modal-dialog-centered", + tags$div( + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3( + class = "modal-title", + "Modal 1" + ), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) + ), + tags$div( + class = "modal-body", + "This is Modal 1." + ) + ) + ) + ), + tags$div( + id = "modal2", + class = "modal fade", + tags$div( + class = "modal-dialog modal-dialog-centered", + tags$div( + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3( + class = "modal-title", + "Modal 2" + ), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) + ), + tags$div( + class = "modal-body", + "This is Modal 2." + ) + ) + ) + ), + tags$div( + id = "modal3", + class = "modal fade", + tags$div( + class = "modal-dialog modal-dialog-centered", + tags$div( + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3( + class = "modal-title", + "Modal 3" + ), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") ) + ), + tags$div( + class = "modal-body", + "This is Modal 3." + ) + ) + ) + ), + tags$div( + id = "modal4", + class = "modal fade", + tags$div( + class = "modal-dialog modal-dialog-centered", + tags$div( + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3( + class = "modal-title", + "Modal 4" + ), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) + ), + tags$div( + class = "modal-body", + "This is Modal 4." + ) + ) + ) + ), + tags$div( + id = "modal5", + class = "modal fade", + tags$div( + class = "modal-dialog modal-dialog-centered", + tags$div( + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3( + class = "modal-title", + "Modal 5" + ), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) + ), + tags$div( + class = "modal-body", + "This is Modal 5." ) ) ) - ) + ) } #' The module server for the shiny app home @@ -75,6 +339,7 @@ aboutViewer <- function( #' @param id the unique reference id for the module #' @param connectionHandler a connection to the database with the results #' @param resultDatabaseSettings a list containing the characterization result schema, dbms, tablePrefix, databaseTable and cgTablePrefix +#' @param config the config from the app.R file that contains a list of which modules to include #' #' @return #' The server for the shiny app home @@ -83,12 +348,94 @@ aboutViewer <- function( aboutServer <- function( id = 'homepage', connectionHandler = NULL, - resultDatabaseSettings = NULL + resultDatabaseSettings = NULL, + config ) { shiny::moduleServer( id, function(input, output, session) { + tab_names <- character() + # Loop through shinyModules and extract tabName values + for (i in seq_along(config[["shinyModules"]])) { + tab_name <- config[["shinyModules"]][[i]][["tabName"]] + tab_names <- c(tab_names, tab_name) + } + # View the extracted tabName values + # print(tab_names) + + output$newOrdersBox <- shinydashboard::renderValueBox({ + if ("DataSources" %in% tab_names) { + shinydashboard::valueBox( + "Data Sources", "Databases used in this analysis", icon = shiny::icon("database"), + color = "purple", + href = "#newOrdersModal" + ) + } else { + shinydashboard::valueBox( + "Data Sources", "This module was not included in this analysis.", icon = shiny::icon("database"), + color = "black", + href = "#newOrdersModal" + ) + } + }) + + output$progressBox <- shinydashboard::renderValueBox({ + shinydashboard::valueBox( + "100%", "Progress", icon = shiny::icon("list"), + color = "black", + href = "#progressModal" + ) + }) + + output$approvalBox <- shinydashboard::renderValueBox({ + shinydashboard::valueBox( + "80%", "Approval", icon = shiny::icon("thumbs-up", lib = "glyphicon"), + color = "yellow", + href = "#approvalModal" + ) + }) + + output$valueBox1 <- shinydashboard::renderValueBox({ + shinydashboard::valueBox( + "Text 1", "Value Box 1", icon = shiny::icon("star"), + color = "blue", + href = "#modal1" + ) + }) + + output$valueBox2 <- shinydashboard::renderValueBox({ + shinydashboard::valueBox( + "Text 2", "Value Box 2", icon = shiny::icon("heart"), + color = "maroon", + href = "#modal2" + ) + }) + + output$valueBox3 <- shinydashboard::renderValueBox({ + shinydashboard::valueBox( + "Text 3", "Value Box 3", icon = shiny::icon("globe"), + color = "green", + href = "#modal3" + ) + }) + + output$valueBox4 <- shinydashboard::renderValueBox({ + shinydashboard::valueBox( + "Text 4", "Value Box 4", icon = shiny::icon("car"), + color = "orange", + href = "#modal4" + ) + }) + + output$valueBox5 <- shinydashboard::renderValueBox({ + shinydashboard::valueBox( + "Text 5", "Value Box 5", icon = shiny::icon("car"), + color = "aqua", + href = "#modal4" + ) + }) + } ) diff --git a/inst/about-www/about.html b/inst/about-www/about.html index c82bd54d..84f456c8 100644 --- a/inst/about-www/about.html +++ b/inst/about-www/about.html @@ -1 +1,11 @@ -

    On this page, you will find general information about the dashboard tool you are currently viewing, and how to use it.

    \ No newline at end of file +

    About this tool

    +
    +

    This tool is an interactive shiny application used for exploring standardized output results for a variety of analyses, including:

    +
      +
    • Characterization (descriptive studies)
    • +
    • Population-level effect estimation(causal inference)
    • +
    • Patient-level prediction (inference)
    • +
    +

    Full details of all the analysis tools can be found on the HADES website. 

    +

    On this page, click on any of the colored boxes below to learn more about the analyses ran in this study.

    +

    On the left-hand side of this web page, you will find a sidebar that allows you to navigate to the full results of each analysis ran by clicking on each tab.

    \ No newline at end of file diff --git a/man/aboutServer.Rd b/man/aboutServer.Rd index 6f767497..1996242b 100644 --- a/man/aboutServer.Rd +++ b/man/aboutServer.Rd @@ -7,7 +7,8 @@ aboutServer( id = "homepage", connectionHandler = NULL, - resultDatabaseSettings = NULL + resultDatabaseSettings = NULL, + config ) } \arguments{ From 2f986c33fdf216b36f07c6bb68426ce92cc625ee Mon Sep 17 00:00:00 2001 From: nhall6 Date: Thu, 14 Mar 2024 10:42:47 -0400 Subject: [PATCH 014/143] Update about-main.R --- R/about-main.R | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/R/about-main.R b/R/about-main.R index 644ac572..91b09e31 100644 --- a/R/about-main.R +++ b/R/about-main.R @@ -49,7 +49,7 @@ aboutViewer <- function( #shinydashboard::dashboardBody( shiny::div( - fluidRow( + shiny::fluidRow( tags$head(tags$style(HTML(".small-box {height: 200px; width: 100%;}"))), shinydashboard::box( width = "100%", @@ -57,17 +57,17 @@ aboutViewer <- function( ) # ) ), - fluidRow( - valueBoxOutput("newOrdersBox", width = 3), - valueBoxOutput("progressBox", width = 3), - valueBoxOutput("approvalBox", width = 3), - valueBoxOutput("valueBox1", width = 3) + shiny::fluidRow( + shinydashboard::valueBoxOutput("newOrdersBox", width = 3), + shinydashboard::valueBoxOutput("progressBox", width = 3), + shinydashboard::valueBoxOutput("approvalBox", width = 3), + shinydashboard::valueBoxOutput("valueBox1", width = 3) ), - fluidRow( - valueBoxOutput("valueBox2", width = 3), - valueBoxOutput("valueBox3", width = 3), - valueBoxOutput("valueBox4", width = 3), - valueBoxOutput("valueBox5", width = 3) + shiny::fluidRow( + shinydashboard::valueBoxOutput("valueBox2", width = 3), + shinydashboard::valueBoxOutput("valueBox3", width = 3), + shinydashboard::valueBoxOutput("valueBox4", width = 3), + shinydashboard::valueBoxOutput("valueBox5", width = 3) ), tags$script(' $(document).ready(function(){ From 32a76e460f9fe8ad98a04a5277d5d211b231a788 Mon Sep 17 00:00:00 2001 From: nhall6 Date: Fri, 15 Mar 2024 10:33:47 -0400 Subject: [PATCH 015/143] Updating new about module --- R/about-main.R | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/R/about-main.R b/R/about-main.R index 91b09e31..a0dd1741 100644 --- a/R/about-main.R +++ b/R/about-main.R @@ -58,16 +58,16 @@ aboutViewer <- function( # ) ), shiny::fluidRow( - shinydashboard::valueBoxOutput("newOrdersBox", width = 3), - shinydashboard::valueBoxOutput("progressBox", width = 3), - shinydashboard::valueBoxOutput("approvalBox", width = 3), - shinydashboard::valueBoxOutput("valueBox1", width = 3) + shinydashboard::valueBoxOutput(ns("newOrdersBox"), width = 3), + shinydashboard::valueBoxOutput(ns("progressBox"), width = 3), + shinydashboard::valueBoxOutput(ns("approvalBox"), width = 3), + shinydashboard::valueBoxOutput(ns("valueBox1"), width = 3) ), shiny::fluidRow( - shinydashboard::valueBoxOutput("valueBox2", width = 3), - shinydashboard::valueBoxOutput("valueBox3", width = 3), - shinydashboard::valueBoxOutput("valueBox4", width = 3), - shinydashboard::valueBoxOutput("valueBox5", width = 3) + shinydashboard::valueBoxOutput(ns("valueBox2"), width = 3), + shinydashboard::valueBoxOutput(ns("valueBox3"), width = 3), + shinydashboard::valueBoxOutput(ns("valueBox4"), width = 3), + shinydashboard::valueBoxOutput(ns("valueBox5"), width = 3) ), tags$script(' $(document).ready(function(){ @@ -368,7 +368,7 @@ aboutServer <- function( if ("DataSources" %in% tab_names) { shinydashboard::valueBox( "Data Sources", "Databases used in this analysis", icon = shiny::icon("database"), - color = "purple", + color = "aqua", href = "#newOrdersModal" ) } else { @@ -383,7 +383,7 @@ aboutServer <- function( output$progressBox <- shinydashboard::renderValueBox({ shinydashboard::valueBox( "100%", "Progress", icon = shiny::icon("list"), - color = "black", + color = "purple", href = "#progressModal" ) }) @@ -391,7 +391,7 @@ aboutServer <- function( output$approvalBox <- shinydashboard::renderValueBox({ shinydashboard::valueBox( "80%", "Approval", icon = shiny::icon("thumbs-up", lib = "glyphicon"), - color = "yellow", + color = "teal", href = "#approvalModal" ) }) @@ -399,7 +399,7 @@ aboutServer <- function( output$valueBox1 <- shinydashboard::renderValueBox({ shinydashboard::valueBox( "Text 1", "Value Box 1", icon = shiny::icon("star"), - color = "blue", + color = "yellow", href = "#modal1" ) }) @@ -415,7 +415,7 @@ aboutServer <- function( output$valueBox3 <- shinydashboard::renderValueBox({ shinydashboard::valueBox( "Text 3", "Value Box 3", icon = shiny::icon("globe"), - color = "green", + color = "blue", href = "#modal3" ) }) @@ -423,7 +423,7 @@ aboutServer <- function( output$valueBox4 <- shinydashboard::renderValueBox({ shinydashboard::valueBox( "Text 4", "Value Box 4", icon = shiny::icon("car"), - color = "orange", + color = "red", href = "#modal4" ) }) @@ -431,7 +431,7 @@ aboutServer <- function( output$valueBox5 <- shinydashboard::renderValueBox({ shinydashboard::valueBox( "Text 5", "Value Box 5", icon = shiny::icon("car"), - color = "aqua", + color = "olive", href = "#modal4" ) }) From 5cfaab76d3a3fdcfcc64986b14deae0a7837a631 Mon Sep 17 00:00:00 2001 From: nhall6 Date: Fri, 15 Mar 2024 12:02:04 -0400 Subject: [PATCH 016/143] Update about.html --- inst/about-www/about.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/about-www/about.html b/inst/about-www/about.html index 84f456c8..0974616b 100644 --- a/inst/about-www/about.html +++ b/inst/about-www/about.html @@ -6,6 +6,6 @@
  • Population-level effect estimation(causal inference)
  • Patient-level prediction (inference)
  • -

    Full details of all the analysis tools can be found on the HADES website. 

    +

    Full details of all the analysis tools can be found on the HADES website.

    On this page, click on any of the colored boxes below to learn more about the analyses ran in this study.

    On the left-hand side of this web page, you will find a sidebar that allows you to navigate to the full results of each analysis ran by clicking on each tab.

    \ No newline at end of file From 004d2fd7f023b1898441439b2c5d6fa2a651804d Mon Sep 17 00:00:00 2001 From: nhall6 Date: Fri, 15 Mar 2024 16:12:03 -0400 Subject: [PATCH 017/143] further updating the about module --- NAMESPACE | 1 - R/about-main.R | 49 +++++++++++++++--------------------------- man/aboutHelperFile.Rd | 17 --------------- man/aboutServer.Rd | 2 ++ man/aboutViewer.Rd | 3 --- 5 files changed, 19 insertions(+), 53 deletions(-) delete mode 100644 man/aboutHelperFile.Rd diff --git a/NAMESPACE b/NAMESPACE index 39f7cdd3..901ba535 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,6 @@ # Generated by roxygen2: do not edit by hand export(LargeDataTable) -export(aboutHelperFile) export(aboutServer) export(aboutViewer) export(characterizationAggregateFeaturesServer) diff --git a/R/about-main.R b/R/about-main.R index a0dd1741..644e59f7 100644 --- a/R/about-main.R +++ b/R/about-main.R @@ -69,41 +69,26 @@ aboutViewer <- function( shinydashboard::valueBoxOutput(ns("valueBox4"), width = 3), shinydashboard::valueBoxOutput(ns("valueBox5"), width = 3) ), - tags$script(' - $(document).ready(function(){ - $("#newOrdersBox").click(function(){ - $("#newOrdersModal").modal("show"); - }); + tags$script(HTML(' + $(document).ready(function(){ + $("#newOrdersBox").click(function(){ + $("#newOrdersModal").modal("show"); + }); - $("#progressBox").click(function(){ - $("#progressModal").modal("show"); - }); + $("#progressBox").click(function(){ + $("#progressModal").modal("show"); + }); - $("#approvalBox").click(function(){ - $("#approvalModal").modal("show"); - }); + $("#approvalBox").click(function(){ + $("#approvalModal").modal("show"); + }); - $("#valueBox1").click(function(){ - $("#modal1").modal("show"); - }); - - $("#valueBox2").click(function(){ - $("#modal2").modal("show"); - }); - - $("#valueBox3").click(function(){ - $("#modal3").modal("show"); - }); - - $("#valueBox4").click(function(){ - $("#modal4").modal("show"); - }); - - $("#valueBox5").click(function(){ - $("#modal5").modal("show"); - }); - }); - '), + $(".value-box").click(function() { + var modalId = $(this).attr("data-modal-id"); + $("#" + modalId).modal("show"); + }); + }); +')), tags$div( id = "newOrdersModal", class = "modal fade", diff --git a/man/aboutHelperFile.Rd b/man/aboutHelperFile.Rd deleted file mode 100644 index 38ef9865..00000000 --- a/man/aboutHelperFile.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/about-main.R -\name{aboutHelperFile} -\alias{aboutHelperFile} -\title{The location of the about module helper file} -\usage{ -aboutHelperFile() -} -\value{ -string location of the about helper file -} -\description{ -The location of the about module helper file -} -\details{ -Returns the location of the about helper file -} diff --git a/man/aboutServer.Rd b/man/aboutServer.Rd index 1996242b..e167cdc6 100644 --- a/man/aboutServer.Rd +++ b/man/aboutServer.Rd @@ -17,6 +17,8 @@ aboutServer( \item{connectionHandler}{a connection to the database with the results} \item{resultDatabaseSettings}{a list containing the characterization result schema, dbms, tablePrefix, databaseTable and cgTablePrefix} + +\item{config}{the config from the app.R file that contains a list of which modules to include} } \value{ The server for the shiny app home diff --git a/man/aboutViewer.Rd b/man/aboutViewer.Rd index 7fd25085..2155baf7 100644 --- a/man/aboutViewer.Rd +++ b/man/aboutViewer.Rd @@ -6,9 +6,6 @@ \usage{ aboutViewer(id = "homepage") } -\arguments{ -\item{id}{the unique reference id for the module} -} \value{ The user interface to the home page module } From 4c01175d2f4ec4eefea37a9f43842be7ca7de42e Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Fri, 22 Mar 2024 13:31:10 -0400 Subject: [PATCH 018/143] updating about module further, fixing link issues --- R/about-main.R | 671 ++++++++++-------- inst/about-www/about.html | 2 +- .../characterization.html | 2 +- .../cohort-diagnostics.html | 2 +- .../cohort-generator.html | 2 +- .../evidence-synthesis.html | 2 +- .../patient-level-prediction.html | 2 +- inst/phevaluator-www/phevaluator.html | 2 +- inst/sccs-www/sccs.html | 2 +- 9 files changed, 373 insertions(+), 314 deletions(-) diff --git a/R/about-main.R b/R/about-main.R index 644e59f7..cfc176a6 100644 --- a/R/about-main.R +++ b/R/about-main.R @@ -21,13 +21,14 @@ #' #' @details #' Returns the location of the about helper file -#' +#' #' @return #' string location of the about helper file #' #' @export -aboutHelperFile <- function(){ - fileLoc <- system.file('about-www', "about.html", package = "OhdsiShinyModules") +aboutHelperFile <- function() { + fileLoc <- + system.file('about-www', "about.html", package = "OhdsiShinyModules") return(fileLoc) } @@ -37,50 +38,52 @@ aboutHelperFile <- function(){ #' The user specifies the id for the module #' #' @param id the unique reference id for the module -#' +#' #' @return #' The user interface to the home page module #' #' @export -aboutViewer <- function( - id = 'homepage' - ) { +aboutViewer <- function(id = 'homepage') { ns <- shiny::NS(id) #shinydashboard::dashboardBody( - shiny::div( - shiny::fluidRow( - tags$head(tags$style(HTML(".small-box {height: 200px; width: 100%;}"))), - shinydashboard::box( - width = "100%", - shiny::htmlTemplate(system.file("about-www", "about.html", package = utils::packageName())) - ) - # ) - ), - shiny::fluidRow( - shinydashboard::valueBoxOutput(ns("newOrdersBox"), width = 3), - shinydashboard::valueBoxOutput(ns("progressBox"), width = 3), - shinydashboard::valueBoxOutput(ns("approvalBox"), width = 3), - shinydashboard::valueBoxOutput(ns("valueBox1"), width = 3) - ), - shiny::fluidRow( - shinydashboard::valueBoxOutput(ns("valueBox2"), width = 3), - shinydashboard::valueBoxOutput(ns("valueBox3"), width = 3), - shinydashboard::valueBoxOutput(ns("valueBox4"), width = 3), - shinydashboard::valueBoxOutput(ns("valueBox5"), width = 3) - ), - tags$script(HTML(' + shiny::div( + shiny::fluidRow( + tags$head(tags$style( + HTML(".small-box {height: 200px; width: 100%;}") + )), + shinydashboard::box(width = "100%", + shiny::htmlTemplate( + system.file("about-www", "about.html", package = utils::packageName()) + )) + # ) + ), + shiny::fluidRow( + shinydashboard::valueBoxOutput(ns("datasourcesBox"), width = 3), + shinydashboard::valueBoxOutput(ns("cohortsBox"), width = 3), + shinydashboard::valueBoxOutput(ns("characterizationBox"), width = 3), + shinydashboard::valueBoxOutput(ns("cohortDiagnosticsBox"), width = 3) + ), + shiny::fluidRow( + shinydashboard::valueBoxOutput(ns("cohortMethodBox"), width = 3), + shinydashboard::valueBoxOutput(ns("predictionBox"), width = 3), + shinydashboard::valueBoxOutput(ns("sccsBox"), width = 3), + shinydashboard::valueBoxOutput(ns("evidenceSynthesisBox"), width = 3) + ), + tags$script( + HTML( + ' $(document).ready(function(){ - $("#newOrdersBox").click(function(){ - $("#newOrdersModal").modal("show"); + $("#datasourcesBox").click(function(){ + $("#datasourcesModal").modal("show"); }); - $("#progressBox").click(function(){ - $("#progressModal").modal("show"); + $("#cohortsBox").click(function(){ + $("#cohortsModal").modal("show"); }); - $("#approvalBox").click(function(){ - $("#approvalModal").modal("show"); + $("#characterizationBox").click(function(){ + $("#characterizationModal").modal("show"); }); $(".value-box").click(function() { @@ -88,232 +91,202 @@ aboutViewer <- function( $("#" + modalId).modal("show"); }); }); -')), - tags$div( - id = "newOrdersModal", - class = "modal fade", +' + ) + ), tags$div( - class = "modal-dialog modal-dialog-centered", + id = "datasourcesModal", + class = "modal fade", tags$div( - class = "modal-content", + class = "modal-dialog modal-dialog-centered", tags$div( - class = "modal-header", - tags$h3( - class = "modal-title", - "New Orders Modal" + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3(class = "modal-title", + "Data Sources Modal"), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) ), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div( - class = "modal-body", - "This is the New Orders modal." + tags$div(class = "modal-body", + "This is the Data Sources modal.") ) ) - ) - ), - tags$div( - id = "progressModal", - class = "modal fade", + ), tags$div( - class = "modal-dialog modal-dialog-centered", + id = "cohortsModal", + class = "modal fade", tags$div( - class = "modal-content", + class = "modal-dialog modal-dialog-centered", tags$div( - class = "modal-header", - tags$h3( - class = "modal-title", - "Progress Modal" + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3(class = "modal-title", + "Cohorts Modal"), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) ), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div( - class = "modal-body", - "This is the Progress modal." + tags$div(class = "modal-body", + "This is the Cohorts modal.") ) ) - ) - ), - tags$div( - id = "approvalModal", - class = "modal fade", + ), tags$div( - class = "modal-dialog modal-dialog-centered", + id = "characterizationModal", + class = "modal fade", tags$div( - class = "modal-content", + class = "modal-dialog modal-dialog-centered", tags$div( - class = "modal-header", - tags$h3( - class = "modal-title", - "Approval Modal" + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3(class = "modal-title", + "Characterization Modal"), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) ), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div( - class = "modal-body", - "This is the Approval modal." + tags$div(class = "modal-body", + "This is the Characterization modal.") ) ) - ) - ), - tags$div( - id = "modal1", - class = "modal fade", + ), tags$div( - class = "modal-dialog modal-dialog-centered", + id = "cohortDiagnosticsModal", + class = "modal fade", tags$div( - class = "modal-content", + class = "modal-dialog modal-dialog-centered", tags$div( - class = "modal-header", - tags$h3( - class = "modal-title", - "Modal 1" + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3(class = "modal-title", + "Cohort Diagnostics"), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) ), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div( - class = "modal-body", - "This is Modal 1." + tags$div(class = "modal-body", + "This is Cohort Diagnostics.") ) ) - ) - ), - tags$div( - id = "modal2", - class = "modal fade", + ), tags$div( - class = "modal-dialog modal-dialog-centered", + id = "cohortMethodModal", + class = "modal fade", tags$div( - class = "modal-content", + class = "modal-dialog modal-dialog-centered", tags$div( - class = "modal-header", - tags$h3( - class = "modal-title", - "Modal 2" + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3(class = "modal-title", + "Cohort Method"), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) ), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div( - class = "modal-body", - "This is Modal 2." + tags$div(class = "modal-body", + "This is Cohort Method.") ) ) - ) - ), - tags$div( - id = "modal3", - class = "modal fade", + ), tags$div( - class = "modal-dialog modal-dialog-centered", + id = "predictionModal", + class = "modal fade", tags$div( - class = "modal-content", + class = "modal-dialog modal-dialog-centered", tags$div( - class = "modal-header", - tags$h3( - class = "modal-title", - "Modal 3" + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3(class = "modal-title", + "Prediction"), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) ), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div( - class = "modal-body", - "This is Modal 3." + tags$div(class = "modal-body", + "This is Prediction.") ) ) - ) - ), - tags$div( - id = "modal4", - class = "modal fade", + ), tags$div( - class = "modal-dialog modal-dialog-centered", + id = "sccsModal", + class = "modal fade", tags$div( - class = "modal-content", + class = "modal-dialog modal-dialog-centered", tags$div( - class = "modal-header", - tags$h3( - class = "modal-title", - "Modal 4" + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3(class = "modal-title", + "Self-Controlled Case Series"), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) ), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div( - class = "modal-body", - "This is Modal 4." + tags$div(class = "modal-body", + "This is Self-Controlled Case Series.") ) ) - ) - ), - tags$div( - id = "modal5", - class = "modal fade", + ), tags$div( - class = "modal-dialog modal-dialog-centered", + id = "evidenceSynthesisModal", + class = "modal fade", tags$div( - class = "modal-content", + class = "modal-dialog modal-dialog-centered", tags$div( - class = "modal-header", - tags$h3( - class = "modal-title", - "Modal 5" + class = "modal-content", + tags$div( + class = "modal-header", + tags$h3(class = "modal-title", + "Evidence Synthesis"), + tags$button( + type = "button", + class = "close", + `data-dismiss` = "modal", + `aria-label` = "Close", + tags$span(`aria-hidden` = "true", "×") + ) ), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div( - class = "modal-body", - "This is Modal 5." + tags$div(class = "modal-body", + "This is Evidence Synthesis.") ) ) ) ) - ) } #' The module server for the shiny app home @@ -325,103 +298,189 @@ aboutViewer <- function( #' @param connectionHandler a connection to the database with the results #' @param resultDatabaseSettings a list containing the characterization result schema, dbms, tablePrefix, databaseTable and cgTablePrefix #' @param config the config from the app.R file that contains a list of which modules to include -#' +#' #' @return #' The server for the shiny app home #' #' @export -aboutServer <- function( - id = 'homepage', - connectionHandler = NULL, - resultDatabaseSettings = NULL, - config - ) { - shiny::moduleServer( - id, - function(input, output, session) { - - tab_names <- character() - # Loop through shinyModules and extract tabName values - for (i in seq_along(config[["shinyModules"]])) { - tab_name <- config[["shinyModules"]][[i]][["tabName"]] - tab_names <- c(tab_names, tab_name) - } - # View the extracted tabName values - # print(tab_names) - - output$newOrdersBox <- shinydashboard::renderValueBox({ - if ("DataSources" %in% tab_names) { - shinydashboard::valueBox( - "Data Sources", "Databases used in this analysis", icon = shiny::icon("database"), - color = "aqua", - href = "#newOrdersModal" - ) - } else { - shinydashboard::valueBox( - "Data Sources", "This module was not included in this analysis.", icon = shiny::icon("database"), - color = "black", - href = "#newOrdersModal" - ) - } - }) - - output$progressBox <- shinydashboard::renderValueBox({ - shinydashboard::valueBox( - "100%", "Progress", icon = shiny::icon("list"), - color = "purple", - href = "#progressModal" - ) - }) - - output$approvalBox <- shinydashboard::renderValueBox({ - shinydashboard::valueBox( - "80%", "Approval", icon = shiny::icon("thumbs-up", lib = "glyphicon"), - color = "teal", - href = "#approvalModal" - ) - }) - - output$valueBox1 <- shinydashboard::renderValueBox({ - shinydashboard::valueBox( - "Text 1", "Value Box 1", icon = shiny::icon("star"), - color = "yellow", - href = "#modal1" - ) - }) - - output$valueBox2 <- shinydashboard::renderValueBox({ - shinydashboard::valueBox( - "Text 2", "Value Box 2", icon = shiny::icon("heart"), - color = "maroon", - href = "#modal2" - ) - }) - - output$valueBox3 <- shinydashboard::renderValueBox({ - shinydashboard::valueBox( - "Text 3", "Value Box 3", icon = shiny::icon("globe"), - color = "blue", - href = "#modal3" - ) - }) - - output$valueBox4 <- shinydashboard::renderValueBox({ - shinydashboard::valueBox( - "Text 4", "Value Box 4", icon = shiny::icon("car"), - color = "red", - href = "#modal4" - ) - }) - - output$valueBox5 <- shinydashboard::renderValueBox({ - shinydashboard::valueBox( - "Text 5", "Value Box 5", icon = shiny::icon("car"), - color = "olive", - href = "#modal4" - ) - }) - - - } - ) +aboutServer <- function(id = 'homepage', + connectionHandler = NULL, + resultDatabaseSettings = NULL, + config) { + shiny::moduleServer(id, + function(input, output, session) { + tab_names <- character() + # Loop through shinyModules and extract tabName values + for (i in seq_along(config[["shinyModules"]])) { + tab_name <- config[["shinyModules"]][[i]][["tabName"]] + tab_names <- c(tab_names, tab_name) + } + # View the extracted tabName values + # print(tab_names) + + output$datasourcesBox <- shinydashboard::renderValueBox({ + if ("DataSources" %in% tab_names) { + shinydashboard::valueBox( + value = "Data Sources", + subtitle = "Databases used in this analysis", + icon = shiny::icon("database"), + color = "aqua", + href = "#datasourcesModal" + ) + } else { + shinydashboard::valueBox( + value = "Data Sources", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("database"), + color = "black", + href = "#datasourcesModal" + ) + } + }) + + output$cohortsBox <- shinydashboard::renderValueBox({ + if ("Cohorts" %in% tab_names) { + shinydashboard::valueBox( + value = "Cohorts", + subtitle = "Cohorts included in this analysis", + icon = shiny::icon("user-gear"), + color = "purple", + href = "#cohortsModal" + ) + } else { + shinydashboard::valueBox( + value = "Cohorts", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("user-gear"), + color = "black", + href = "#cohortsModal" + ) + } + }) + + output$characterizationBox <- shinydashboard::renderValueBox({ + if ("Characterization" %in% tab_names) { + shinydashboard::valueBox( + value = "Characterization", + subtitle = "Characterization results for this analysis", + icon = shiny::icon("table"), + color = "teal", + href = "#characterizationModal" + ) + } else { + shinydashboard::valueBox( + value = "Characterization", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("table"), + color = "black", + href = "#characterizationModal" + ) + } + }) + + output$cohortDiagnosticsBox <- + shinydashboard::renderValueBox({ + if ("CohortDiagnostics" %in% tab_names) { + shinydashboard::valueBox( + value = "Cohort Diagnostics", + subtitle = "Cohort Diagnostics results for the cohorts included in this analysis", + icon = shiny::icon("users"), + color = "yellow", + href = "#cohortDiagnosticsModal" + ) + } else { + shinydashboard::valueBox( + value = "Cohort Diagnostics", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("users"), + color = "black", + href = "#cohortDiagnosticsModal" + ) + } + }) + + + output$cohortMethodBox <- shinydashboard::renderValueBox({ + if ("CohortMethod" %in% tab_names) { + shinydashboard::valueBox( + value = "Cohort Method", + subtitle = "Cohort Method results for this analysis", + icon = shiny::icon("chart-column"), + color = "maroon", + href = "#cohortMethodModal" + ) + } else { + shinydashboard::valueBox( + value = "Cohort Method", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("chart-column"), + color = "black", + href = "#cohortMethodModal" + ) + } + }) + + output$predictionBox <- shinydashboard::renderValueBox({ + if ("Prediction" %in% tab_names) { + shinydashboard::valueBox( + value = "Prediction", + subtitle = "Patient-level Prediction results for this analysis", + icon = shiny::icon("chart-line"), + color = "blue", + href = "#predictionModal" + ) + } else { + shinydashboard::valueBox( + value = "Prediction", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("chart-line"), + color = "black", + href = "#predictionModal" + ) + } + }) + + output$sccsBox <- shinydashboard::renderValueBox({ + if ("SCCS" %in% tab_names) { + shinydashboard::valueBox( + value = "SCCS", + subtitle = "Self-Controlled Case Series results for this analysis", + icon = shiny::icon("people-arrows"), + color = "red", + href = "#sccsModal" + ) + } else { + shinydashboard::valueBox( + value = "SCCS", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("people-arrows"), + color = "black", + href = "#sccsModal" + ) + } + }) + + output$evidenceSynthesisBox <- + shinydashboard::renderValueBox({ + if ("Meta" %in% tab_names) { + shinydashboard::valueBox( + value = "Meta", + subtitle = "Meta Analysis results for this analysis", + icon = shiny::icon("sliders"), + color = "olive", + href = "#evidenceSynthesisModal" + ) + } else { + shinydashboard::valueBox( + value = "Meta", + subtitle = + "This module was not included in this analysis", + icon = shiny::icon("sliders"), + color = "black", + href = "#evidenceSynthesisModal" + ) + } + }) + + }) } diff --git a/inst/about-www/about.html b/inst/about-www/about.html index 0974616b..63c761bd 100644 --- a/inst/about-www/about.html +++ b/inst/about-www/about.html @@ -6,6 +6,6 @@
  • Population-level effect estimation(causal inference)
  • Patient-level prediction (inference)
  • -

    Full details of all the analysis tools can be found on the HADES website.

    +

    Full details of all the analysis tools can be found on the HADES website: https://ohdsi.github.io/Hades/

    On this page, click on any of the colored boxes below to learn more about the analyses ran in this study.

    On the left-hand side of this web page, you will find a sidebar that allows you to navigate to the full results of each analysis ran by clicking on each tab.

    \ No newline at end of file diff --git a/inst/characterization-www/characterization.html b/inst/characterization-www/characterization.html index 98b0373f..5e10c27f 100644 --- a/inst/characterization-www/characterization.html +++ b/inst/characterization-www/characterization.html @@ -9,5 +9,5 @@

    Description

  • Computes plot(s) for the databases of the number of events (y axis) during a given time period (1, 30 or 365 days) (x axis) for the target and outcome cohorts selected.
  • -

    For more information, please visit this page

    +

    For more information, please visit https://github.com/OHDSI/Characterization

    \ No newline at end of file diff --git a/inst/cohort-diagnostics-www/cohort-diagnostics.html b/inst/cohort-diagnostics-www/cohort-diagnostics.html index 5d1d4739..23dbdcc6 100644 --- a/inst/cohort-diagnostics-www/cohort-diagnostics.html +++ b/inst/cohort-diagnostics-www/cohort-diagnostics.html @@ -1,4 +1,4 @@

    Cohort Diagnostics

    Cohort Level Diagnostics allow evaluation of phenotype algorithms within a study. These should give insights into populations used and their characteristics.

    -

    For more information, please visit this page

    \ No newline at end of file +

    For more information, please visit https://github.com/OHDSI/CohortDiagnostics

    \ No newline at end of file diff --git a/inst/cohort-generator-www/cohort-generator.html b/inst/cohort-generator-www/cohort-generator.html index b5c7ad72..e79b9000 100644 --- a/inst/cohort-generator-www/cohort-generator.html +++ b/inst/cohort-generator-www/cohort-generator.html @@ -8,4 +8,4 @@

    Cohort Generator

  • Cohort attrition statistics can be found in the "Inclusion Rules & Attrition" tab in both tabular and plotted form.
  • -

    For more information, please visit this page

    \ No newline at end of file +

    For more information, please visit https://github.com/OHDSI/CohortGenerator

    \ No newline at end of file diff --git a/inst/evidence-synthesis-www/evidence-synthesis.html b/inst/evidence-synthesis-www/evidence-synthesis.html index 3bd5c900..15a91285 100644 --- a/inst/evidence-synthesis-www/evidence-synthesis.html +++ b/inst/evidence-synthesis-www/evidence-synthesis.html @@ -3,4 +3,4 @@

    Evidence Synthesis

    This R package contains routines for combining causal effect estimates and study diagnostics across multiple data sites in a distributed study. This includes functions for performing meta-analysis and forest plots.

    -

    For more information, please visit this page

    \ No newline at end of file +

    For more information, please visit https://github.com/OHDSI/EvidenceSynthesis

    \ No newline at end of file diff --git a/inst/patient-level-prediction-www/patient-level-prediction.html b/inst/patient-level-prediction-www/patient-level-prediction.html index 55815228..42841440 100644 --- a/inst/patient-level-prediction-www/patient-level-prediction.html +++ b/inst/patient-level-prediction-www/patient-level-prediction.html @@ -1,3 +1,3 @@

    Prediction Module

    PatientLevelPrediction is an R package for building and validating patient-level predictive models using data in the OMOP Common Data Model format.

    -

    For more information, please visit this page

    \ No newline at end of file +

    For more information, please visit https://github.com/OHDSI/PatientLevelPrediction

    \ No newline at end of file diff --git a/inst/phevaluator-www/phevaluator.html b/inst/phevaluator-www/phevaluator.html index ef9edc75..42b07a4f 100644 --- a/inst/phevaluator-www/phevaluator.html +++ b/inst/phevaluator-www/phevaluator.html @@ -14,4 +14,4 @@
  • Test Subjects Covariates – examples of the associated covariates included in the diagnostic predictive model for test subjects evaluated to be false positive or negative and true positive or negative.
  • -

    For more information, please visit this page

    \ No newline at end of file +

    For more information, please visit https://github.com/OHDSI/PheValuator

    \ No newline at end of file diff --git a/inst/sccs-www/sccs.html b/inst/sccs-www/sccs.html index 272923d3..64e0fa03 100644 --- a/inst/sccs-www/sccs.html +++ b/inst/sccs-www/sccs.html @@ -11,4 +11,4 @@

    Self Controlled Case Series

  • Provides the self-controlled risk interval design as a special case of the SCCS.
  • -

    For more information, please visit this page

    \ No newline at end of file +

    For more information, please visit https://github.com/OHDSI/SelfControlledCaseSeries

    \ No newline at end of file From 4e38ecafffe45df5c1ee4f9c5bf11047e8a5b87d Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Tue, 26 Mar 2024 18:10:14 -0400 Subject: [PATCH 019/143] updating about-main further and oxygenising --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/about-main.R | 458 +++++++------------------- inst/about-www/about-dataSources.html | 1 + man/OhdsiShinyModules.Rd | 1 + man/aboutHelperFile.Rd | 17 + man/aboutViewer.Rd | 3 + 7 files changed, 148 insertions(+), 335 deletions(-) create mode 100644 inst/about-www/about-dataSources.html create mode 100644 man/aboutHelperFile.Rd diff --git a/DESCRIPTION b/DESCRIPTION index cbbfea4a..16af1b1f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -57,4 +57,4 @@ Suggests: Remotes: ohdsi/CirceR, ohdsi/ResultModelManager -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 diff --git a/NAMESPACE b/NAMESPACE index 901ba535..39f7cdd3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,7 @@ # Generated by roxygen2: do not edit by hand export(LargeDataTable) +export(aboutHelperFile) export(aboutServer) export(aboutViewer) export(characterizationAggregateFeaturesServer) diff --git a/R/about-main.R b/R/about-main.R index cfc176a6..277ec148 100644 --- a/R/about-main.R +++ b/R/about-main.R @@ -69,222 +69,6 @@ aboutViewer <- function(id = 'homepage') { shinydashboard::valueBoxOutput(ns("predictionBox"), width = 3), shinydashboard::valueBoxOutput(ns("sccsBox"), width = 3), shinydashboard::valueBoxOutput(ns("evidenceSynthesisBox"), width = 3) - ), - tags$script( - HTML( - ' - $(document).ready(function(){ - $("#datasourcesBox").click(function(){ - $("#datasourcesModal").modal("show"); - }); - - $("#cohortsBox").click(function(){ - $("#cohortsModal").modal("show"); - }); - - $("#characterizationBox").click(function(){ - $("#characterizationModal").modal("show"); - }); - - $(".value-box").click(function() { - var modalId = $(this).attr("data-modal-id"); - $("#" + modalId).modal("show"); - }); - }); -' - ) - ), - tags$div( - id = "datasourcesModal", - class = "modal fade", - tags$div( - class = "modal-dialog modal-dialog-centered", - tags$div( - class = "modal-content", - tags$div( - class = "modal-header", - tags$h3(class = "modal-title", - "Data Sources Modal"), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div(class = "modal-body", - "This is the Data Sources modal.") - ) - ) - ), - tags$div( - id = "cohortsModal", - class = "modal fade", - tags$div( - class = "modal-dialog modal-dialog-centered", - tags$div( - class = "modal-content", - tags$div( - class = "modal-header", - tags$h3(class = "modal-title", - "Cohorts Modal"), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div(class = "modal-body", - "This is the Cohorts modal.") - ) - ) - ), - tags$div( - id = "characterizationModal", - class = "modal fade", - tags$div( - class = "modal-dialog modal-dialog-centered", - tags$div( - class = "modal-content", - tags$div( - class = "modal-header", - tags$h3(class = "modal-title", - "Characterization Modal"), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div(class = "modal-body", - "This is the Characterization modal.") - ) - ) - ), - tags$div( - id = "cohortDiagnosticsModal", - class = "modal fade", - tags$div( - class = "modal-dialog modal-dialog-centered", - tags$div( - class = "modal-content", - tags$div( - class = "modal-header", - tags$h3(class = "modal-title", - "Cohort Diagnostics"), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div(class = "modal-body", - "This is Cohort Diagnostics.") - ) - ) - ), - tags$div( - id = "cohortMethodModal", - class = "modal fade", - tags$div( - class = "modal-dialog modal-dialog-centered", - tags$div( - class = "modal-content", - tags$div( - class = "modal-header", - tags$h3(class = "modal-title", - "Cohort Method"), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div(class = "modal-body", - "This is Cohort Method.") - ) - ) - ), - tags$div( - id = "predictionModal", - class = "modal fade", - tags$div( - class = "modal-dialog modal-dialog-centered", - tags$div( - class = "modal-content", - tags$div( - class = "modal-header", - tags$h3(class = "modal-title", - "Prediction"), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div(class = "modal-body", - "This is Prediction.") - ) - ) - ), - tags$div( - id = "sccsModal", - class = "modal fade", - tags$div( - class = "modal-dialog modal-dialog-centered", - tags$div( - class = "modal-content", - tags$div( - class = "modal-header", - tags$h3(class = "modal-title", - "Self-Controlled Case Series"), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div(class = "modal-body", - "This is Self-Controlled Case Series.") - ) - ) - ), - tags$div( - id = "evidenceSynthesisModal", - class = "modal fade", - tags$div( - class = "modal-dialog modal-dialog-centered", - tags$div( - class = "modal-content", - tags$div( - class = "modal-header", - tags$h3(class = "modal-title", - "Evidence Synthesis"), - tags$button( - type = "button", - class = "close", - `data-dismiss` = "modal", - `aria-label` = "Close", - tags$span(`aria-hidden` = "true", "×") - ) - ), - tags$div(class = "modal-body", - "This is Evidence Synthesis.") - ) - ) ) ) } @@ -318,65 +102,68 @@ aboutServer <- function(id = 'homepage', # View the extracted tabName values # print(tab_names) - output$datasourcesBox <- shinydashboard::renderValueBox({ - if ("DataSources" %in% tab_names) { - shinydashboard::valueBox( - value = "Data Sources", - subtitle = "Databases used in this analysis", - icon = shiny::icon("database"), - color = "aqua", - href = "#datasourcesModal" - ) - } else { - shinydashboard::valueBox( - value = "Data Sources", - subtitle = "This module was not included in this analysis", - icon = shiny::icon("database"), - color = "black", - href = "#datasourcesModal" - ) - } - }) + output$datasourcesBox <- + shinydashboard::renderValueBox({ + if ("DataSources" %in% tab_names) { + shinydashboard::valueBox( + value = "Data Sources", + subtitle = "Data sources used in this analysis", + icon = shiny::icon("database"), + color = "aqua", + href = NULL + ) + } else { + shinydashboard::valueBox( + value = "Data Sources", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("database"), + color = "black", + href = NULL + ) + } + }) - output$cohortsBox <- shinydashboard::renderValueBox({ - if ("Cohorts" %in% tab_names) { - shinydashboard::valueBox( - value = "Cohorts", - subtitle = "Cohorts included in this analysis", - icon = shiny::icon("user-gear"), - color = "purple", - href = "#cohortsModal" - ) - } else { - shinydashboard::valueBox( - value = "Cohorts", - subtitle = "This module was not included in this analysis", - icon = shiny::icon("user-gear"), - color = "black", - href = "#cohortsModal" - ) - } - }) + output$cohortsBox <- + shinydashboard::renderValueBox({ + if ("Cohorts" %in% tab_names) { + shinydashboard::valueBox( + value = "Cohorts", + subtitle = "Cohorts included in this analysis", + icon = shiny::icon("user-gear"), + color = "purple", + href = NULL + ) + } else { + shinydashboard::valueBox( + value = "Cohorts", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("user-gear"), + color = "black", + href = NULL + ) + } + }) - output$characterizationBox <- shinydashboard::renderValueBox({ - if ("Characterization" %in% tab_names) { - shinydashboard::valueBox( - value = "Characterization", - subtitle = "Characterization results for this analysis", - icon = shiny::icon("table"), - color = "teal", - href = "#characterizationModal" - ) - } else { - shinydashboard::valueBox( - value = "Characterization", - subtitle = "This module was not included in this analysis", - icon = shiny::icon("table"), - color = "black", - href = "#characterizationModal" - ) - } - }) + output$characterizationBox <- + shinydashboard::renderValueBox({ + if ("Characterization" %in% tab_names) { + shinydashboard::valueBox( + value = "Characterization", + subtitle = "Characterization results for this analysis", + icon = shiny::icon("table"), + color = "teal", + href = NULL + ) + } else { + shinydashboard::valueBox( + value = "Characterization", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("table"), + color = "black", + href = NULL + ) + } + }) output$cohortDiagnosticsBox <- shinydashboard::renderValueBox({ @@ -386,7 +173,7 @@ aboutServer <- function(id = 'homepage', subtitle = "Cohort Diagnostics results for the cohorts included in this analysis", icon = shiny::icon("users"), color = "yellow", - href = "#cohortDiagnosticsModal" + href = NULL ) } else { shinydashboard::valueBox( @@ -394,71 +181,74 @@ aboutServer <- function(id = 'homepage', subtitle = "This module was not included in this analysis", icon = shiny::icon("users"), color = "black", - href = "#cohortDiagnosticsModal" + href = NULL ) } }) - output$cohortMethodBox <- shinydashboard::renderValueBox({ - if ("CohortMethod" %in% tab_names) { - shinydashboard::valueBox( - value = "Cohort Method", - subtitle = "Cohort Method results for this analysis", - icon = shiny::icon("chart-column"), - color = "maroon", - href = "#cohortMethodModal" - ) - } else { - shinydashboard::valueBox( - value = "Cohort Method", - subtitle = "This module was not included in this analysis", - icon = shiny::icon("chart-column"), - color = "black", - href = "#cohortMethodModal" - ) - } - }) + output$cohortMethodBox <- + shinydashboard::renderValueBox({ + if ("CohortMethod" %in% tab_names) { + shinydashboard::valueBox( + value = "Cohort Method", + subtitle = "Cohort Method results for this analysis", + icon = shiny::icon("chart-column"), + color = "maroon", + href = NULL + ) + } else { + shinydashboard::valueBox( + value = "Cohort Method", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("chart-column"), + color = "black", + href = NULL + ) + } + }) - output$predictionBox <- shinydashboard::renderValueBox({ - if ("Prediction" %in% tab_names) { - shinydashboard::valueBox( - value = "Prediction", - subtitle = "Patient-level Prediction results for this analysis", - icon = shiny::icon("chart-line"), - color = "blue", - href = "#predictionModal" - ) - } else { - shinydashboard::valueBox( - value = "Prediction", - subtitle = "This module was not included in this analysis", - icon = shiny::icon("chart-line"), - color = "black", - href = "#predictionModal" - ) - } - }) + output$predictionBox <- + shinydashboard::renderValueBox({ + if ("Prediction" %in% tab_names) { + shinydashboard::valueBox( + value = "Prediction", + subtitle = "Patient-level Prediction results for this analysis", + icon = shiny::icon("chart-line"), + color = "blue", + href = NULL + ) + } else { + shinydashboard::valueBox( + value = "Prediction", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("chart-line"), + color = "black", + href = NULL + ) + } + }) - output$sccsBox <- shinydashboard::renderValueBox({ - if ("SCCS" %in% tab_names) { - shinydashboard::valueBox( - value = "SCCS", - subtitle = "Self-Controlled Case Series results for this analysis", - icon = shiny::icon("people-arrows"), - color = "red", - href = "#sccsModal" - ) - } else { - shinydashboard::valueBox( - value = "SCCS", - subtitle = "This module was not included in this analysis", - icon = shiny::icon("people-arrows"), - color = "black", - href = "#sccsModal" - ) - } - }) + output$sccsBox <- + shinydashboard::renderValueBox({ + if ("SCCS" %in% tab_names) { + shinydashboard::valueBox( + value = "SCCS", + subtitle = "Self-Controlled Case Series results for this analysis", + icon = shiny::icon("people-arrows"), + color = "red", + href = NULL + ) + } else { + shinydashboard::valueBox( + value = "SCCS", + subtitle = "This module was not included in this analysis", + icon = shiny::icon("people-arrows"), + color = "black", + href = NULL + ) + } + }) output$evidenceSynthesisBox <- shinydashboard::renderValueBox({ @@ -468,7 +258,7 @@ aboutServer <- function(id = 'homepage', subtitle = "Meta Analysis results for this analysis", icon = shiny::icon("sliders"), color = "olive", - href = "#evidenceSynthesisModal" + href = NULL ) } else { shinydashboard::valueBox( @@ -477,7 +267,7 @@ aboutServer <- function(id = 'homepage', "This module was not included in this analysis", icon = shiny::icon("sliders"), color = "black", - href = "#evidenceSynthesisModal" + href = NULL ) } }) diff --git a/inst/about-www/about-dataSources.html b/inst/about-www/about-dataSources.html new file mode 100644 index 00000000..a59d228e --- /dev/null +++ b/inst/about-www/about-dataSources.html @@ -0,0 +1 @@ +

    This is a test

    \ No newline at end of file diff --git a/man/OhdsiShinyModules.Rd b/man/OhdsiShinyModules.Rd index 10f09f13..fe505b2c 100644 --- a/man/OhdsiShinyModules.Rd +++ b/man/OhdsiShinyModules.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/OhdsiShinyModules.R \docType{package} \name{OhdsiShinyModules} +\alias{OhdsiShinyModules-package} \alias{OhdsiShinyModules} \title{OhdsiShinyModules} \description{ diff --git a/man/aboutHelperFile.Rd b/man/aboutHelperFile.Rd new file mode 100644 index 00000000..38ef9865 --- /dev/null +++ b/man/aboutHelperFile.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/about-main.R +\name{aboutHelperFile} +\alias{aboutHelperFile} +\title{The location of the about module helper file} +\usage{ +aboutHelperFile() +} +\value{ +string location of the about helper file +} +\description{ +The location of the about module helper file +} +\details{ +Returns the location of the about helper file +} diff --git a/man/aboutViewer.Rd b/man/aboutViewer.Rd index 2155baf7..7fd25085 100644 --- a/man/aboutViewer.Rd +++ b/man/aboutViewer.Rd @@ -6,6 +6,9 @@ \usage{ aboutViewer(id = "homepage") } +\arguments{ +\item{id}{the unique reference id for the module} +} \value{ The user interface to the home page module } From 379378bda16ba137bb5a809d06653244cd07e4e7 Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Thu, 28 Mar 2024 10:20:50 -0400 Subject: [PATCH 020/143] adding some of the new Rmd files for the modules --- vignettes/Characterization.Rmd | 69 +++++++++++++++++++++++++++++++++ vignettes/CohortDiagnostics.Rmd | 69 +++++++++++++++++++++++++++++++++ vignettes/Cohorts.Rmd | 62 +++++++++++++++++++++++++++++ vignettes/DataSources.Rmd | 61 +++++++++++++++++++++++++++++ 4 files changed, 261 insertions(+) create mode 100644 vignettes/Characterization.Rmd create mode 100644 vignettes/CohortDiagnostics.Rmd create mode 100644 vignettes/Cohorts.Rmd create mode 100644 vignettes/DataSources.Rmd diff --git a/vignettes/Characterization.Rmd b/vignettes/Characterization.Rmd new file mode 100644 index 00000000..93ab0fe6 --- /dev/null +++ b/vignettes/Characterization.Rmd @@ -0,0 +1,69 @@ +--- +title: "Characterization" +author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +date: '`r Sys.Date()`' +header-includes: + - \usepackage{fancyhdr} + - \pagestyle{fancy} + - \fancyhead{} + - \fancyfoot[LE,RO]{\thepage} + - \renewcommand{\headrulewidth}{0.4pt} + - \renewcommand{\footrulewidth}{0.4pt} + - \fancyfoot[CO,CE]{OhdsiShinyModules Package Version `r utils::packageVersion("OhdsiShinyModules")`} +output: + html_document: + number_sections: yes + toc: yes + word_document: + toc: yes + pdf_document: + includes: + in_header: preamble.tex + number_sections: yes + toc: yes +--- + +```{=html} + +``` +```{r include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Introduction + +In the realm of observational research, where data heterogeneity and complexity are common, assessing and diagnosing the characteristics of cohorts is fundamental to ensuring the reliability and credibility of research findings. This is also an essential step in phenotype development. The OHDSI community has developed an R package, CohortDiagnostics, which provides researchers with a systematic approach to examine various facets of cohorts, enabling them to identify potential biases, assess data completeness, and validate the suitability of cohorts for analysis. This tool is crucial for researchers working within the Observational Health Data Sciences and Informatics (OHDSI) ecosystem, enabling them to ensure the accuracy and reliability of cohort definitions through a detailed examination of incidence rates, cohort characteristics, and the specific codes triggering cohort inclusion criteria. CohortDiagnostics streamlines the process of cohort evaluation by: + +1. Generating a broad spectrum of diagnostics against a CDM database - see more details here: [Features and Functionalities] +2. Providing an interactive R Shiny application within the package for an intuitive exploration and visualization of these diagnostics. For more information on R Shiny, see [here](https://www.rstudio.com/products/shiny/ "R Shiny"). + +# Features and Functionalities + +CohortDiagnostics offers a suite of features designed to deepen the understanding of cohort dynamics and the intricacies of cohort definitions, including: + +1. **Cohort Definition**: Facilitates the examination and validation of the logic behind cohort definitions, ensuring they accurately capture the intended population. +2. **Concepts in Data Source**: Identifies the specific concepts present within the data source that are relevant to the cohort definitions, enabling a deeper understanding of data coverage and content. +3. **Orphan Concepts**: Highlights concepts that, despite their relevance, are not captured within a cohort's definition. This helps in refining concept sets and cohort criteria to ensure comprehensiveness and relevance. +4. **Cohort Counts**: Provides counts of individuals and records within cohorts, offering a basic measure of cohort size and scope. +5. **Incidence Rate**: Calculates the incidence rate of cohorts, stratified by various demographic and temporal factors such as age, sex, and calendar year, to assess the frequency of patients/records in the cohort and potential patterns over these strata. +6. **Time Distributions**: Examines the distribution of time-related variables within cohorts, such as observation time before and after cohort index date as well as cohort duration, offering insights into cohort dynamics over time and available observation time. +7. **Index Event Breakdown**: Breaks down the specific events that qualify individuals for cohort inclusion, providing clarity on how inclusion criteria are met. +8. **Visit Context**: Analyzes the healthcare context (e.g., inpatient, outpatient) of the index events, offering insights into where and how cohort members are identified within the healthcare system. +9. **Cohort Overlap**: Assesses the degree of overlap between cohorts, which can inform on potential biases, errors, or redundancies in cohort construction, as well as shared characteristics between cohorts of patients. +10. **Cohort Characterization**: Characterizes cohorts by detailing prevalent conditions, medication use, procedures, and more, to understand the clinical profile of cohort members over various time periods relative to index. +11. **Compare Cohort Characterization**: Enables the direct comparison of characteristics between cohorts, facilitating the identification of unique or shared features across different cohorts and across time points. +12. **Meta Data**: Provides meta-information about the data and analyses conducted, ensuring transparency and reproducibility of the cohort diagnostics process. + +Together, these features equip researchers with the tools necessary for a thorough examination of cohort definitions, enhancing the quality and reliability of observational health research. + +# Utility and Application + +CohortDiagnostics significantly contributes to the field of observational health research by providing a robust framework for the evaluation and validation of cohort definitions. Its utility spans several critical areas: + +1. **Enhancing Cohort Definition Confidence**: By offering detailed diagnostics, CohortDiagnostics helps researchers refine their cohort definitions, ensuring they accurately capture the intended population. This is a critical step in phenotype development, which is a cornerstone of modern observational health data research. +2. **Identifying Data Quality Issues**: Through the identification of orphan concepts and the detailed breakdown of index events, researchers can pinpoint data quality issues or gaps in cohort definitions. Iterating over multiple potential cohort definitions after analyzing these diagnostics is an encouraged and common practice. +3. **Facilitating the Ideas Behind Comparative Analyses**: The package's capabilities to characterize and compare cohorts, as well as to analyze cohort overlaps, are invaluable for researchers looking to understand the nuances and dynamics of their study populations. These diagnostics can help inform comparative studies in the future, after the cohorts and phenotypes are refined and finalized. +4. **Supporting Transparent Research**: By enabling the listing of source codes, data source information, and providing a platform for detailed diagnostics exploration, CohortDiagnostics fosters a culture of transparency and reproducibility in observational research. diff --git a/vignettes/CohortDiagnostics.Rmd b/vignettes/CohortDiagnostics.Rmd new file mode 100644 index 00000000..803906d6 --- /dev/null +++ b/vignettes/CohortDiagnostics.Rmd @@ -0,0 +1,69 @@ +--- +title: "Cohort Diagnostics" +author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +date: '`r Sys.Date()`' +header-includes: + - \usepackage{fancyhdr} + - \pagestyle{fancy} + - \fancyhead{} + - \fancyfoot[LE,RO]{\thepage} + - \renewcommand{\headrulewidth}{0.4pt} + - \renewcommand{\footrulewidth}{0.4pt} + - \fancyfoot[CO,CE]{OhdsiShinyModules Package Version `r utils::packageVersion("OhdsiShinyModules")`} +output: + html_document: + number_sections: yes + toc: yes + word_document: + toc: yes + pdf_document: + includes: + in_header: preamble.tex + number_sections: yes + toc: yes +--- + +```{=html} + +``` +```{r include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Introduction + +In the realm of observational research, where data heterogeneity and complexity are common, assessing and diagnosing the characteristics of cohorts is fundamental to ensuring the reliability and credibility of research findings. This is also an essential step in phenotype development. The OHDSI community has developed an R package, CohortDiagnostics, which provides researchers with a systematic approach to examine various facets of cohorts, enabling them to identify potential biases, assess data completeness, and validate the suitability of cohorts for analysis. This tool is crucial for researchers working within the Observational Health Data Sciences and Informatics (OHDSI) ecosystem, enabling them to ensure the accuracy and reliability of cohort definitions through a detailed examination of incidence rates, cohort characteristics, and the specific codes triggering cohort inclusion criteria. CohortDiagnostics streamlines the process of cohort evaluation by: + +1. Generating a broad spectrum of diagnostics against a CDM database - see more details here: [Features and Functionalities] +2. Providing an interactive R Shiny application within the package for an intuitive exploration and visualization of these diagnostics. For more information on R Shiny, see [here](https://www.rstudio.com/products/shiny/ "R Shiny"). + +# Features and Functionalities + +CohortDiagnostics offers a suite of features designed to deepen the understanding of cohort dynamics and the intricacies of cohort definitions, including: + +1. **Cohort Definition**: Facilitates the examination and validation of the logic behind cohort definitions, ensuring they accurately capture the intended population. +2. **Concepts in Data Source**: Identifies the specific concepts present within the data source that are relevant to the cohort definitions, enabling a deeper understanding of data coverage and content. +3. **Orphan Concepts**: Highlights concepts that, despite their relevance, are not captured within a cohort's definition. This helps in refining concept sets and cohort criteria to ensure comprehensiveness and relevance. +4. **Cohort Counts**: Provides counts of individuals and records within cohorts, offering a basic measure of cohort size and scope. +5. **Incidence Rate**: Calculates the incidence rate of cohorts, stratified by various demographic and temporal factors such as age, sex, and calendar year, to assess the frequency of patients/records in the cohort and potential patterns over these strata. +6. **Time Distributions**: Examines the distribution of time-related variables within cohorts, such as observation time before and after cohort index date as well as cohort duration, offering insights into cohort dynamics over time and available observation time. +7. **Index Event Breakdown**: Breaks down the specific events that qualify individuals for cohort inclusion, providing clarity on how inclusion criteria are met. +8. **Visit Context**: Analyzes the healthcare context (e.g., inpatient, outpatient) of the index events, offering insights into where and how cohort members are identified within the healthcare system. +9. **Cohort Overlap**: Assesses the degree of overlap between cohorts, which can inform on potential biases, errors, or redundancies in cohort construction, as well as shared characteristics between cohorts of patients. +10. **Cohort Characterization**: Characterizes cohorts by detailing prevalent conditions, medication use, procedures, and more, to understand the clinical profile of cohort members over various time periods relative to index. +11. **Compare Cohort Characterization**: Enables the direct comparison of characteristics between cohorts, facilitating the identification of unique or shared features across different cohorts and across time points. +12. **Meta Data**: Provides meta-information about the data and analyses conducted, ensuring transparency and reproducibility of the cohort diagnostics process. + +Together, these features equip researchers with the tools necessary for a thorough examination of cohort definitions, enhancing the quality and reliability of observational health research. + +# Utility and Application + +CohortDiagnostics significantly contributes to the field of observational health research by providing a robust framework for the evaluation and validation of cohort definitions. Its utility spans several critical areas: + +1. **Enhancing Cohort Definition Confidence**: By offering detailed diagnostics, CohortDiagnostics helps researchers refine their cohort definitions, ensuring they accurately capture the intended population. This is a critical step in phenotype development, which is a cornerstone of modern observational health data research. +2. **Identifying Data Quality Issues**: Through the identification of orphan concepts and the detailed breakdown of index events, researchers can pinpoint data quality issues or gaps in cohort definitions. Iterating over multiple potential cohort definitions after analyzing these diagnostics is an encouraged and common practice. +3. **Facilitating the Ideas Behind Comparative Analyses**: The package's capabilities to characterize and compare cohorts, as well as to analyze cohort overlaps, are invaluable for researchers looking to understand the nuances and dynamics of their study populations. These diagnostics can help inform comparative studies in the future, after the cohorts and phenotypes are refined and finalized. +4. **Supporting Transparent Research**: By enabling the listing of source codes, data source information, and providing a platform for detailed diagnostics exploration, CohortDiagnostics fosters a culture of transparency and reproducibility in observational research. diff --git a/vignettes/Cohorts.Rmd b/vignettes/Cohorts.Rmd new file mode 100644 index 00000000..94cbd5af --- /dev/null +++ b/vignettes/Cohorts.Rmd @@ -0,0 +1,62 @@ +--- +title: "Cohorts" +author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +date: '`r Sys.Date()`' +header-includes: + - \usepackage{fancyhdr} + - \pagestyle{fancy} + - \fancyhead{} + - \fancyfoot[LE,RO]{\thepage} + - \renewcommand{\headrulewidth}{0.4pt} + - \renewcommand{\footrulewidth}{0.4pt} + - \fancyfoot[CO,CE]{OhdsiShinyModules Package Version `r utils::packageVersion("OhdsiShinyModules")`} +output: + html_document: + number_sections: yes + toc: yes + word_document: + toc: yes + pdf_document: + includes: + in_header: preamble.tex + number_sections: yes + toc: yes +--- + +```{=html} + +``` +```{r include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Introduction + +Cohort identification within real-world evidence (RWE) analyses of data adhering to the Observational Medical Outcomes Partnership Common Data Model (OMOP CDM) is a foundational step in understanding healthcare outcomes and treatment effects. Observational health data, sourced from diverse sources including Electronic Health Records (EHRs), health insurance claims, registries, and patient-generated data, offer valuable insights into patient health status and healthcare delivery. However, these data were not originally collected for research purposes, leading to the need for sophisticated methods to infer relevant clinical information for research objectives. This summary explores the importance of cohort identification, the methods endorsed by the Observational Health Data Sciences and Informatics (OHDSI) community, and the tools available for creating cohorts within OMOP CDM datasets. + +# Importance of Cohort Identification + +Cohort identification is crucial for conducting meaningful analyses in healthcare research. A cohort, defined as a set of individuals meeting one or more inclusion criteria over a duration of time, serves as the basis for studying healthcare outcomes, treatment effects, and disease epidemiology. In the context of OHDSI research, cohorts are fundamental building blocks used for executing research questions, developing phenotypes, and conducting comparative effectiveness studies. OHDSI's approach emphasizes the independence and reusability of cohort definitions, allowing researchers to define cohorts tailored to specific research questions while ensuring consistency and reproducibility across studies. + +# Methods for Cohort Identification + +OHDSI endorses standardized methods for cohort definition, ensuring transparency, and reproducibility in research. Two main approaches are employed for constructing cohorts: + +## Rule-based Cohort Definitions + +Rule-based cohort definitions rely on explicitly stated inclusion criteria to define cohort membership. These criteria are typically based on domain expertise and clinical knowledge, allowing researchers to specify cohort attributes such as clinical conditions, procedures, medications, and temporal relationships. OHDSI provides standardized components for assembling these criteria, including domains, concept sets, domain-specific attributes, and temporal logic. + +## Probabilistic Cohort Definitions + +Probabilistic cohort definitions leverage machine learning techniques to compute the probability of cohort inclusion based on patient characteristics and clinical events. These models are trained on example data to automatically identify relevant patient characteristics predictive of cohort membership. The resulting probabilities can be used to classify patients into cohorts or as inputs for certain study designs. + +# Tools for Cohort Creation & Identification + +OHDSI offers a suite of open-source tools to support cohort identification within OMOP CDM datasets, such as: + +1. [ATLAS](http://atlas-demo.ohdsi.org/ "ATLAS"): A web-based tool that enables researchers to define, execute, and share cohort definitions using standardized terminologies and criteria. ATLAS streamlines the cohort creation process by providing an intuitive interface for specifying cohort criteria and visualizing cohort characteristics. +2. [SQL](https://www.geeksforgeeks.org/what-is-sql/ "What is SQL?"): Structured Query Language (SQL) provides a powerful means for defining cohorts through custom queries. OHDSI encourages the use of SQL for advanced cohort definition tasks and complex analyses. +3. [CohortGenerator](https://github.com/OHDSI/CohortGenerator?tab=readme-ov-file "Cohort Generator"): The CohortGenerator R package is a tool within the Observational Health Data Sciences and Informatics (OHDSI) ecosystem designed to facilitate the creation of cohorts from observational healthcare data stored in databases adhering to the OMOP Common Data Model (CDM). It is an R Package that streamlines the cohort creation process, allowing for efficient and reproducible cohort identification across different datasets. diff --git a/vignettes/DataSources.Rmd b/vignettes/DataSources.Rmd new file mode 100644 index 00000000..409dfc65 --- /dev/null +++ b/vignettes/DataSources.Rmd @@ -0,0 +1,61 @@ +--- +title: "Data Sources" +author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +date: '`r Sys.Date()`' +header-includes: + - \usepackage{fancyhdr} + - \pagestyle{fancy} + - \fancyhead{} + - \fancyfoot[LE,RO]{\thepage} + - \renewcommand{\headrulewidth}{0.4pt} + - \renewcommand{\footrulewidth}{0.4pt} + - \fancyfoot[CO,CE]{OhdsiShinyModules Package Version `r utils::packageVersion("OhdsiShinyModules")`} +output: + html_document: + number_sections: yes + toc: yes + word_document: + toc: yes + pdf_document: + includes: + in_header: preamble.tex + number_sections: yes + toc: yes +--- + +```{=html} + +``` +```{r include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Introduction + +Real-world data (RWD) encompasses a vast array of information collected from a variety of sources outside traditional clinical research settings. This data, when analyzed, generates real-world evidence (RWE) that can inform healthcare decisions, policy-making, and patient care. + +The Observational Medical Outcomes Partnership (OMOP) was a collaborative initiative chaired by the U.S. Food and Drug Administration (FDA) aimed at improving the understanding of how observational studies can contribute to evaluating the safety and effectiveness of medications. It focused on developing methods, tools, and standards to enhance the quality and reliability of real-world evidence generated from healthcare data. The OMOP's legacy continues to influence current research methodologies, particularly through the adoption and evolution of its Common Data Model (CDM) in projects like those undertaken by the Observational Health Data Sciences and Informatics (OHDSI) community. + +The OMOP CDM standardizes observational healthcare data, enabling the harmonization of disparate data sources into a consistent format. This standardization encompasses structured data schemas, controlled vocabularies for medical terminologies, and unique identifiers for clinical concepts, ensuring that data from varied healthcare systems and studies can be compared and analyzed collectively. By transforming diverse datasets into a unified model, the OMOP CDM facilitates robust, scalable, and reproducible research across the global healthcare research community, enhancing the reliability and validity of findings derived from real-world data. + +The Extract-Transform-Load (ETL) process is a critical data management procedure that prepares raw data for analysis by extracting it from various sources, transforming it into a consistent format that aligns with analysis requirements, and loading it into a destination system for use. In the context of generating real-world evidence (RWE) and ensuring adherence to a Common Data Model (CDM) like OMOP, the ETL process is indispensable. It enables the standardization of observational healthcare data—often fragmented across different systems and formats—into a unified structure. This standardization is essential not only for the interoperability of data across different healthcare databases but also for ensuring that analyses conducted on these data are reliable, scalable, and reproducible. For more information on the ETL process and how OHDSI tools can be utilizied to perform it for a particular data source, please visit [this page](https://ohdsi.github.io/TheBookOfOhdsi/ExtractTransformLoad "ETL"). + +# Key Data Sources for RWE Analyses + +Real-world data sources that adhere to the OMOP CDM are varied and rich, including, but not limited to: + +1. Electronic Health Records (EHRs): These are one of the primary sources of RWD, containing detailed patient health information from clinical encounters. +2. Claims and Billing Data: These data sources provide information on healthcare utilization, including diagnoses, procedures, and medication prescriptions, primarily for billing purposes. +3. Patient Registries: Disease or condition-specific registries offer valuable insights into patient outcomes, treatment patterns, and disease epidemiology. +4. Wearable Devices and Mobile Health Applications: An emerging source of RWD, these technologies capture real-time data on patient health and activity levels. + +# Example OMOP-mapped Datasets + +The sensitivity of observational health data underscores the need for robust privacy protection measures due to the potential identification of individuals and the disclosure of sensitive health information. This sensitivity arises from the richness of health data, including diagnoses, treatments, and demographic details, which can reveal personal health conditions and behaviors. Ensuring privacy in observational health data is paramount to maintain trust and compliance with regulations such as the Health Insurance Portability and Accountability Act (HIPAA). Despite these challenges, several publicly available data sources mapped to the OMOP CDM offer valuable insights for research while safeguarding patient privacy. Some examples include: + +1. [HowOften](http://howoften.org/ "HowOften") +2. [Public Datasets from OHDSI](http://data.ohdsi.org/ "OHDSI Datasets") +3. [SynPUFs](https://www.cms.gov/data-research/statistics-trends-and-reports/medicare-claims-synthetic-public-use-files "Medicare Claims Synthetic Public Use Files (SynPUFs)") From 7be193c421a469c53d51bbf44475b15ec525149b Mon Sep 17 00:00:00 2001 From: Frank DeFalco Date: Thu, 28 Mar 2024 13:25:53 -0400 Subject: [PATCH 021/143] style tweaks --- inst/about-www/about.html | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/inst/about-www/about.html b/inst/about-www/about.html index 63c761bd..284d7806 100644 --- a/inst/about-www/about.html +++ b/inst/about-www/about.html @@ -1,11 +1,24 @@ -

    About this tool

    -
    -

    This tool is an interactive shiny application used for exploring standardized output results for a variety of analyses, including:

    -
      -
    • Characterization (descriptive studies)
    • -
    • Population-level effect estimation(causal inference)
    • -
    • Patient-level prediction (inference)
    • -
    -

    Full details of all the analysis tools can be found on the HADES website: https://ohdsi.github.io/Hades/

    -

    On this page, click on any of the colored boxes below to learn more about the analyses ran in this study.

    -

    On the left-hand side of this web page, you will find a sidebar that allows you to navigate to the full results of each analysis ran by clicking on each tab.

    \ No newline at end of file +

    About this tool

    + +

    + This tool is an interactive shiny application used for exploring standardized output results for a variety of + analyses, including: + +

      +
    • Characterization (descriptive studies)
    • +
    • Population-level effect estimation(causal inference)
    • +
    • Patient-level prediction (inference)
    • +
    +

    + +

    + Full details of all the analysis tools can be found on the HADES website. +

    + +

    + On this page, click on any of the colored boxes below to learn more about the analyses ran in this study. +

    + +

    + On the left-hand side of this web page, you will find a sidebar that allows you to navigate to the full results of each analysis ran by clicking on each tab. +

    From 02c9f813596e7e10f2984f7ca104f5801b1304ac Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Thu, 28 Mar 2024 15:00:14 -0400 Subject: [PATCH 022/143] Delete about-dataSources.html --- inst/about-www/about-dataSources.html | 1 - 1 file changed, 1 deletion(-) delete mode 100644 inst/about-www/about-dataSources.html diff --git a/inst/about-www/about-dataSources.html b/inst/about-www/about-dataSources.html deleted file mode 100644 index a59d228e..00000000 --- a/inst/about-www/about-dataSources.html +++ /dev/null @@ -1 +0,0 @@ -

    This is a test

    \ No newline at end of file From 39ea6a58e4b9e7c252140584795f2d22bac63321 Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Mon, 1 Apr 2024 14:17:26 -0400 Subject: [PATCH 023/143] Adding sample app.R file into extras folder --- extras/examples/app.R | 95 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 extras/examples/app.R diff --git a/extras/examples/app.R b/extras/examples/app.R new file mode 100644 index 00000000..0d1c952d --- /dev/null +++ b/extras/examples/app.R @@ -0,0 +1,95 @@ +# create a config settings for the shiny that includes +# the tabs that are necessary for the analysis + +#remotes::install_github('ohdsi/OhdsiShinyModules') + +options(java.parameters = '-Xss100m') + +schema <- 'ase_026' + +library(dplyr) +library(ShinyAppBuilder) +library(OhdsiShinyModules) + +#Sys.setenv("DATABASECONNECTOR_JAR_FOLDER"= "./") + +# if (!any(grepl("postgresql", list.files("./", pattern = ".jar")))) { +# DatabaseConnector::downloadJdbcDrivers("postgresql") +# } + +config <- initializeModuleConfig() %>% + addModuleConfig( + createDefaultAboutConfig() + ) %>% + addModuleConfig( + createDefaultDatasourcesConfig() + ) %>% + addModuleConfig( + createDefaultCohortGeneratorConfig() + ) %>% + addModuleConfig( + createDefaultCohortDiagnosticsConfig() + ) %>% + addModuleConfig( + createDefaultCharacterizationConfig() + ) %>% + addModuleConfig( + createDefaultPredictionConfig() + ) %>% + addModuleConfig( + createDefaultCohortMethodConfig() + ) %>% + addModuleConfig( + createDefaultSccsConfig() + ) %>% + addModuleConfig( + createDefaultEvidenceSynthesisConfig() + ) + +keyringName = 'ohda' +#password for ohda = "***REMOVED***" +Sys.setenv(resultsAdmin = "ohda_project_sa") +Sys.setenv(resultsAdminPassword = "***REMOVED***") +Sys.setenv(resultsDbConnectionString = "***REMOVED***") +# Store the results database connection info ----- +# keyring::key_set_with_value("resultsAdmin", password = "ohda_project_sa", keyring = keyringName) +# keyring::key_set_with_value("resultsAdminPassword", password = "***REMOVED***", keyring = keyringName) +# keyring::key_set_with_value("resultsReadOnlyUser", password = "ohda_project_ro", keyring = keyringName) +# keyring::key_set_with_value("resultsReadOnlyPassword", password = "***REMOVED***", keyring = keyringName) +# resultsDbConnectionString <- "***REMOVED***" +# keyring::key_set_with_value("resultsServer", password = resultsDbConnectionString, keyring = keyringName) +# connectionDetails = DatabaseConnector::createConnectionDetails( +# dbms = "postgresql", +# connectionString = resultsDbConnectionString, +# user = keyring::key_get("resultsAdmin", keyring = keyringName), +# password = keyring::key_get("resultsAdminPassword", keyring = keyringName) +# ) + +# specify the connection to the results database +connectionDetails <- DatabaseConnector::createConnectionDetails( + dbms = 'postgresql', + user = Sys.getenv("resultsAdmin"), + password = Sys.getenv("resultsAdminPassword"), + connectionString = Sys.getenv("resultsDbConnectionString") +) + +# create a connection handler using the ResultModelManager package +connection <- ResultModelManager::ConnectionHandler$new(connectionDetails) + + + +# create result schema settings +resultDatabaseSettings <- createDefaultResultDatabaseSettings( + schema = schema +) + +# now create the shiny app based on the config file and view the results +# based on the connection +##ShinyAppBuilder::createShinyApp(config = config, connection = connection) +ShinyAppBuilder::createShinyApp( + config = config, + connection = connection, + resultDatabaseSettings = resultDatabaseSettings, + title = "My Study", + studyDescription = "This is a sample description about my study. Woohoo!" +) From 216b7ec567f237226b830f1e5cbd392458cbd9cc Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Mon, 1 Apr 2024 16:07:15 -0400 Subject: [PATCH 024/143] updating some Rmds for vignettes --- vignettes/Characterization.Rmd | 33 ++++------------ vignettes/CohortMethod.Rmd | 69 ++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 25 deletions(-) create mode 100644 vignettes/CohortMethod.Rmd diff --git a/vignettes/Characterization.Rmd b/vignettes/Characterization.Rmd index 93ab0fe6..25d7a9d5 100644 --- a/vignettes/Characterization.Rmd +++ b/vignettes/Characterization.Rmd @@ -35,35 +35,18 @@ knitr::opts_chunk$set(echo = TRUE) # Introduction -In the realm of observational research, where data heterogeneity and complexity are common, assessing and diagnosing the characteristics of cohorts is fundamental to ensuring the reliability and credibility of research findings. This is also an essential step in phenotype development. The OHDSI community has developed an R package, CohortDiagnostics, which provides researchers with a systematic approach to examine various facets of cohorts, enabling them to identify potential biases, assess data completeness, and validate the suitability of cohorts for analysis. This tool is crucial for researchers working within the Observational Health Data Sciences and Informatics (OHDSI) ecosystem, enabling them to ensure the accuracy and reliability of cohort definitions through a detailed examination of incidence rates, cohort characteristics, and the specific codes triggering cohort inclusion criteria. CohortDiagnostics streamlines the process of cohort evaluation by: - -1. Generating a broad spectrum of diagnostics against a CDM database - see more details here: [Features and Functionalities] -2. Providing an interactive R Shiny application within the package for an intuitive exploration and visualization of these diagnostics. For more information on R Shiny, see [here](https://www.rstudio.com/products/shiny/ "R Shiny"). +Characterization, a fundamental aspect of observational health data research, serves as a cornerstone for understanding and analyzing populations based on a myriad of characteristics. The methodologies of characterization play a pivotal role in generating hypotheses about the determinants of health and disease by providing descriptive insights into population demographics, medical history, treatment patterns, and incidence rates of outcomes. There are various methods for characterization, including database-level characterization, cohort characterization, treatment pathways analysis, and incidence measurement. Each of these methods aims to describe populations relative to an event known as the index date, which anchors the analysis of baseline, pre-index, and post-index time periods. Through the lens of use-cases such as disease natural history, treatment utilization, and quality improvement, characterizing cohorts of patients empowers researchers to glean actionable insights from observational healthcare databases. # Features and Functionalities -CohortDiagnostics offers a suite of features designed to deepen the understanding of cohort dynamics and the intricacies of cohort definitions, including: - -1. **Cohort Definition**: Facilitates the examination and validation of the logic behind cohort definitions, ensuring they accurately capture the intended population. -2. **Concepts in Data Source**: Identifies the specific concepts present within the data source that are relevant to the cohort definitions, enabling a deeper understanding of data coverage and content. -3. **Orphan Concepts**: Highlights concepts that, despite their relevance, are not captured within a cohort's definition. This helps in refining concept sets and cohort criteria to ensure comprehensiveness and relevance. -4. **Cohort Counts**: Provides counts of individuals and records within cohorts, offering a basic measure of cohort size and scope. -5. **Incidence Rate**: Calculates the incidence rate of cohorts, stratified by various demographic and temporal factors such as age, sex, and calendar year, to assess the frequency of patients/records in the cohort and potential patterns over these strata. -6. **Time Distributions**: Examines the distribution of time-related variables within cohorts, such as observation time before and after cohort index date as well as cohort duration, offering insights into cohort dynamics over time and available observation time. -7. **Index Event Breakdown**: Breaks down the specific events that qualify individuals for cohort inclusion, providing clarity on how inclusion criteria are met. -8. **Visit Context**: Analyzes the healthcare context (e.g., inpatient, outpatient) of the index events, offering insights into where and how cohort members are identified within the healthcare system. -9. **Cohort Overlap**: Assesses the degree of overlap between cohorts, which can inform on potential biases, errors, or redundancies in cohort construction, as well as shared characteristics between cohorts of patients. -10. **Cohort Characterization**: Characterizes cohorts by detailing prevalent conditions, medication use, procedures, and more, to understand the clinical profile of cohort members over various time periods relative to index. -11. **Compare Cohort Characterization**: Enables the direct comparison of characteristics between cohorts, facilitating the identification of unique or shared features across different cohorts and across time points. -12. **Meta Data**: Provides meta-information about the data and analyses conducted, ensuring transparency and reproducibility of the cohort diagnostics process. +The Characterization module is dedicated to investigating these factors within and between cohorts, and it contains several useful features that allow for this exploration, including: -Together, these features equip researchers with the tools necessary for a thorough examination of cohort definitions, enhancing the quality and reliability of observational health research. +1. **Target Viewer**: Computes detailed results for target cohorts, offering a granular view of the cohort's demographics, conditions, drug exposures, and more. This enables a deeper understanding of the cohort's characteristics at various time points at or relative to the index date. +2. **Outcome Stratified**: For both target and outcome cohorts, the package calculates binary features during the designated time at risk. This analysis helps in identifying specific attributes or exposures that are present or absent in the cohort members, aiding in the differentiation/comparability between cohorts. +3. **Incidence Rate**: Utilizing the [CohortIncidence](https://github.com/OHDSI/CohortIncidence "CohortIncidence") R package, this set of analyses computes incidence rates for both target and outcome cohorts during the time at risk selected. This feature is essential for assessing the frequency of outcomes or conditions within the specified timeframe, providing a quantitative measure of risk or occurrence. Incidence measures are provided in both tabular and graphical form, and can be stratified across calendar year, age, and sex. +4. **Time to Event**: Generates plots for the number of events across different time periods (1, 30, or 365 days) for the selected target and outcome cohorts. These plots visualize the temporal distribution of events, allowing researchers to observe patterns over time and make temporal comparisons between cohorts. +5. **Dechallenge Rechallenge**: Offers the ability to compute dechallenge (withdrawal of a drug or treatment) and rechallenge (reintroduction) results. This analysis is critical for understanding the causality between exposures and outcomes, especially in pharmacovigilance studies and when adverse events following exposure to a drug may occur. # Utility and Application -CohortDiagnostics significantly contributes to the field of observational health research by providing a robust framework for the evaluation and validation of cohort definitions. Its utility spans several critical areas: - -1. **Enhancing Cohort Definition Confidence**: By offering detailed diagnostics, CohortDiagnostics helps researchers refine their cohort definitions, ensuring they accurately capture the intended population. This is a critical step in phenotype development, which is a cornerstone of modern observational health data research. -2. **Identifying Data Quality Issues**: Through the identification of orphan concepts and the detailed breakdown of index events, researchers can pinpoint data quality issues or gaps in cohort definitions. Iterating over multiple potential cohort definitions after analyzing these diagnostics is an encouraged and common practice. -3. **Facilitating the Ideas Behind Comparative Analyses**: The package's capabilities to characterize and compare cohorts, as well as to analyze cohort overlaps, are invaluable for researchers looking to understand the nuances and dynamics of their study populations. These diagnostics can help inform comparative studies in the future, after the cohorts and phenotypes are refined and finalized. -4. **Supporting Transparent Research**: By enabling the listing of source codes, data source information, and providing a platform for detailed diagnostics exploration, CohortDiagnostics fosters a culture of transparency and reproducibility in observational research. +Characterization serves as a powerful tool for researchers aiming to dissect and understand the nuances of patient cohorts in observational health data. Its capabilities allow for the detailed examination of cohort attributes, the incidence of health outcomes, and the effects of treatment exposures over time. By facilitating a comprehensive analysis of target and comparator cohorts, Characterization enables researchers to draw meaningful conclusions about patient care, treatment efficacy, and health outcomes, thereby contributing to the advancement of evidence-based medicine. For more information on the Characterization R package, please see [here](https://github.com/OHDSI/Characterization "Characterization"). diff --git a/vignettes/CohortMethod.Rmd b/vignettes/CohortMethod.Rmd new file mode 100644 index 00000000..ef489bc1 --- /dev/null +++ b/vignettes/CohortMethod.Rmd @@ -0,0 +1,69 @@ +--- +title: "Cohort Method (Estimation)" +author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +date: '`r Sys.Date()`' +header-includes: + - \usepackage{fancyhdr} + - \pagestyle{fancy} + - \fancyhead{} + - \fancyfoot[LE,RO]{\thepage} + - \renewcommand{\headrulewidth}{0.4pt} + - \renewcommand{\footrulewidth}{0.4pt} + - \fancyfoot[CO,CE]{OhdsiShinyModules Package Version `r utils::packageVersion("OhdsiShinyModules")`} +output: + html_document: + number_sections: yes + toc: yes + word_document: + toc: yes + pdf_document: + includes: + in_header: preamble.tex + number_sections: yes + toc: yes +--- + +```{=html} + +``` +```{r include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Introduction + +In the realm of observational research, where data heterogeneity and complexity are common, assessing and diagnosing the characteristics of cohorts is fundamental to ensuring the reliability and credibility of research findings. This is also an essential step in phenotype development. The OHDSI community has developed an R package, CohortDiagnostics, which provides researchers with a systematic approach to examine various facets of cohorts, enabling them to identify potential biases, assess data completeness, and validate the suitability of cohorts for analysis. This tool is crucial for researchers working within the Observational Health Data Sciences and Informatics (OHDSI) ecosystem, enabling them to ensure the accuracy and reliability of cohort definitions through a detailed examination of incidence rates, cohort characteristics, and the specific codes triggering cohort inclusion criteria. CohortDiagnostics streamlines the process of cohort evaluation by: + +1. Generating a broad spectrum of diagnostics against a CDM database - see more details here: [Features and Functionalities] +2. Providing an interactive R Shiny application within the package for an intuitive exploration and visualization of these diagnostics. For more information on R Shiny, see [here](https://www.rstudio.com/products/shiny/ "R Shiny"). + +# Features and Functionalities + +CohortDiagnostics offers a suite of features designed to deepen the understanding of cohort dynamics and the intricacies of cohort definitions, including: + +1. **Cohort Definition**: Facilitates the examination and validation of the logic behind cohort definitions, ensuring they accurately capture the intended population. +2. **Concepts in Data Source**: Identifies the specific concepts present within the data source that are relevant to the cohort definitions, enabling a deeper understanding of data coverage and content. +3. **Orphan Concepts**: Highlights concepts that, despite their relevance, are not captured within a cohort's definition. This helps in refining concept sets and cohort criteria to ensure comprehensiveness and relevance. +4. **Cohort Counts**: Provides counts of individuals and records within cohorts, offering a basic measure of cohort size and scope. +5. **Incidence Rate**: Calculates the incidence rate of cohorts, stratified by various demographic and temporal factors such as age, sex, and calendar year, to assess the frequency of patients/records in the cohort and potential patterns over these strata. +6. **Time Distributions**: Examines the distribution of time-related variables within cohorts, such as observation time before and after cohort index date as well as cohort duration, offering insights into cohort dynamics over time and available observation time. +7. **Index Event Breakdown**: Breaks down the specific events that qualify individuals for cohort inclusion, providing clarity on how inclusion criteria are met. +8. **Visit Context**: Analyzes the healthcare context (e.g., inpatient, outpatient) of the index events, offering insights into where and how cohort members are identified within the healthcare system. +9. **Cohort Overlap**: Assesses the degree of overlap between cohorts, which can inform on potential biases, errors, or redundancies in cohort construction, as well as shared characteristics between cohorts of patients. +10. **Cohort Characterization**: Characterizes cohorts by detailing prevalent conditions, medication use, procedures, and more, to understand the clinical profile of cohort members over various time periods relative to index. +11. **Compare Cohort Characterization**: Enables the direct comparison of characteristics between cohorts, facilitating the identification of unique or shared features across different cohorts and across time points. +12. **Meta Data**: Provides meta-information about the data and analyses conducted, ensuring transparency and reproducibility of the cohort diagnostics process. + +Together, these features equip researchers with the tools necessary for a thorough examination of cohort definitions, enhancing the quality and reliability of observational health research. + +# Utility and Application + +CohortDiagnostics significantly contributes to the field of observational health research by providing a robust framework for the evaluation and validation of cohort definitions. Its utility spans several critical areas: + +1. **Enhancing Cohort Definition Confidence**: By offering detailed diagnostics, CohortDiagnostics helps researchers refine their cohort definitions, ensuring they accurately capture the intended population. This is a critical step in phenotype development, which is a cornerstone of modern observational health data research. +2. **Identifying Data Quality Issues**: Through the identification of orphan concepts and the detailed breakdown of index events, researchers can pinpoint data quality issues or gaps in cohort definitions. Iterating over multiple potential cohort definitions after analyzing these diagnostics is an encouraged and common practice. +3. **Facilitating the Ideas Behind Comparative Analyses**: The package's capabilities to characterize and compare cohorts, as well as to analyze cohort overlaps, are invaluable for researchers looking to understand the nuances and dynamics of their study populations. These diagnostics can help inform comparative studies in the future, after the cohorts and phenotypes are refined and finalized. +4. **Supporting Transparent Research**: By enabling the listing of source codes, data source information, and providing a platform for detailed diagnostics exploration, CohortDiagnostics fosters a culture of transparency and reproducibility in observational research. From 515cfc20b451bdd153f6c93fb306435584b3ba9d Mon Sep 17 00:00:00 2001 From: jreps Date: Mon, 1 Apr 2024 16:09:27 -0400 Subject: [PATCH 025/143] Delete app.R --- extras/examples/app.R | 95 ------------------------------------------- 1 file changed, 95 deletions(-) delete mode 100644 extras/examples/app.R diff --git a/extras/examples/app.R b/extras/examples/app.R deleted file mode 100644 index 0d1c952d..00000000 --- a/extras/examples/app.R +++ /dev/null @@ -1,95 +0,0 @@ -# create a config settings for the shiny that includes -# the tabs that are necessary for the analysis - -#remotes::install_github('ohdsi/OhdsiShinyModules') - -options(java.parameters = '-Xss100m') - -schema <- 'ase_026' - -library(dplyr) -library(ShinyAppBuilder) -library(OhdsiShinyModules) - -#Sys.setenv("DATABASECONNECTOR_JAR_FOLDER"= "./") - -# if (!any(grepl("postgresql", list.files("./", pattern = ".jar")))) { -# DatabaseConnector::downloadJdbcDrivers("postgresql") -# } - -config <- initializeModuleConfig() %>% - addModuleConfig( - createDefaultAboutConfig() - ) %>% - addModuleConfig( - createDefaultDatasourcesConfig() - ) %>% - addModuleConfig( - createDefaultCohortGeneratorConfig() - ) %>% - addModuleConfig( - createDefaultCohortDiagnosticsConfig() - ) %>% - addModuleConfig( - createDefaultCharacterizationConfig() - ) %>% - addModuleConfig( - createDefaultPredictionConfig() - ) %>% - addModuleConfig( - createDefaultCohortMethodConfig() - ) %>% - addModuleConfig( - createDefaultSccsConfig() - ) %>% - addModuleConfig( - createDefaultEvidenceSynthesisConfig() - ) - -keyringName = 'ohda' -#password for ohda = "***REMOVED***" -Sys.setenv(resultsAdmin = "ohda_project_sa") -Sys.setenv(resultsAdminPassword = "***REMOVED***") -Sys.setenv(resultsDbConnectionString = "***REMOVED***") -# Store the results database connection info ----- -# keyring::key_set_with_value("resultsAdmin", password = "ohda_project_sa", keyring = keyringName) -# keyring::key_set_with_value("resultsAdminPassword", password = "***REMOVED***", keyring = keyringName) -# keyring::key_set_with_value("resultsReadOnlyUser", password = "ohda_project_ro", keyring = keyringName) -# keyring::key_set_with_value("resultsReadOnlyPassword", password = "***REMOVED***", keyring = keyringName) -# resultsDbConnectionString <- "***REMOVED***" -# keyring::key_set_with_value("resultsServer", password = resultsDbConnectionString, keyring = keyringName) -# connectionDetails = DatabaseConnector::createConnectionDetails( -# dbms = "postgresql", -# connectionString = resultsDbConnectionString, -# user = keyring::key_get("resultsAdmin", keyring = keyringName), -# password = keyring::key_get("resultsAdminPassword", keyring = keyringName) -# ) - -# specify the connection to the results database -connectionDetails <- DatabaseConnector::createConnectionDetails( - dbms = 'postgresql', - user = Sys.getenv("resultsAdmin"), - password = Sys.getenv("resultsAdminPassword"), - connectionString = Sys.getenv("resultsDbConnectionString") -) - -# create a connection handler using the ResultModelManager package -connection <- ResultModelManager::ConnectionHandler$new(connectionDetails) - - - -# create result schema settings -resultDatabaseSettings <- createDefaultResultDatabaseSettings( - schema = schema -) - -# now create the shiny app based on the config file and view the results -# based on the connection -##ShinyAppBuilder::createShinyApp(config = config, connection = connection) -ShinyAppBuilder::createShinyApp( - config = config, - connection = connection, - resultDatabaseSettings = resultDatabaseSettings, - title = "My Study", - studyDescription = "This is a sample description about my study. Woohoo!" -) From b117c60b34d7a24eb37434d8202ba4a7c570ed14 Mon Sep 17 00:00:00 2001 From: jreps Date: Tue, 2 Apr 2024 09:04:00 -0400 Subject: [PATCH 026/143] report module adding initial code to generate reports --- DESCRIPTION | 2 + NAMESPACE | 3 + R/report-main.R | 915 ++++++++++++++++++++++++++++++++++++ inst/report-www/report.html | 1 + man/reportHelperFile.Rd | 17 + man/reportServer.Rd | 40 ++ man/reportViewer.Rd | 20 + 7 files changed, 998 insertions(+) create mode 100644 R/report-main.R create mode 100644 inst/report-www/report.html create mode 100644 man/reportHelperFile.Rd create mode 100644 man/reportServer.Rd create mode 100644 man/reportViewer.Rd diff --git a/DESCRIPTION b/DESCRIPTION index cbbfea4a..9d3dcfa9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -29,6 +29,7 @@ Imports: purrr, reactable, readr, + ReportGenerator, RJSONIO, rlang, rmarkdown, @@ -56,5 +57,6 @@ Suggests: withr Remotes: ohdsi/CirceR, + ohdsi/ReportGenerator, ohdsi/ResultModelManager RoxygenNote: 7.2.3 diff --git a/NAMESPACE b/NAMESPACE index 39f7cdd3..78905834 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -106,6 +106,9 @@ export(patientLevelPredictionViewer) export(phevaluatorHelperFile) export(phevaluatorServer) export(phevaluatorViewer) +export(reportHelperFile) +export(reportServer) +export(reportViewer) export(sccsHelperFile) export(sccsServer) export(sccsView) diff --git a/R/report-main.R b/R/report-main.R new file mode 100644 index 00000000..cb7f65c2 --- /dev/null +++ b/R/report-main.R @@ -0,0 +1,915 @@ +# @file report-main.R +# +# Copyright 2024 Observational Health Data Sciences and Informatics +# +# This file is part of PatientLevelPrediction +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +#' The location of the report module helper file +#' +#' @details +#' Returns the location of the report helper file +#' +#' @return +#' string location of the report helper file +#' +#' @export +reportHelperFile <- function(){ + fileLoc <- system.file('report-www', "report.html", package = "OhdsiShinyModules") + return(fileLoc) +} + +#' The module viewer for the shiny app report module +#' +#' @details +#' The user specifies the id for the module +#' +#' @param id the unique reference id for the module +#' +#' @return +#' The user interface to the home page module +#' +#' @export +reportViewer <- function( + id = 'reportModule' + ) { + ns <- shiny::NS(id) + + shinydashboard::box( + status = 'info', + width = 12, + title = shiny::span( shiny::icon('book'), "Report Generator"), + solidHeader = TRUE, + + + shiny::tabsetPanel( + type = 'hidden',#'pills', + id = ns('mainTab'), + + shiny::tabPanel( + title = 'Select Target', + shiny::uiOutput(ns("targetSelection")) + ), + + shiny::tabPanel( + title = 'Select Cohort Method Target', + shiny::uiOutput(ns("cmTargetSelection")) + ), + + shiny::tabPanel( + title = 'Select Comparator', + shiny::uiOutput(ns("comparatorSelection")) + ), + + shiny::tabPanel( + title = 'Select Outcome', + shiny::uiOutput(ns("outcomeSelection")) + ), + + shiny::tabPanel( + title = 'Generate', + shiny::uiOutput(ns("generateSelection")) + ) + + + ) + + + + + ) +} + +#' The module server for the shiny app report module +#' +#' @details +#' The user specifies the id for the module +#' +#' @param id the unique reference id for the module +#' @param connectionHandler a connection to the database with the results +#' @param resultDatabaseSettings a list containing the characterization result schema, dbms, tablePrefix, databaseTable and cgTablePrefix +#' @param server server for the connection to the results for quarto +#' @param username username for the connection to the results for quarto +#' @param password password for the connection to the results for quarto +#' @param dbms dbms for the connection to the results for quarto +#' +#' @return +#' The server for the shiny app home +#' +#' @export +reportServer <- function( + id = 'reportModule', + connectionHandler = NULL, + resultDatabaseSettings = NULL, + server = Sys.getenv("RESULTS_SERVER"), + username = Sys.getenv("RESULTS_USER"), + password = Sys.getenv("RESULTS_PASSWORD"), + dbms = "postgresql" + ) { + shiny::moduleServer( + id, + function(input, output, session) { + + # get input options + tnos <- getTandOs( + connectionHandler = connectionHandler, + resultDatabaseSettings = resultDatabaseSettings + ) + + ## update input selectors + #============================ + + # Targets + targets <- lapply(tnos$groupedTs, function(x) x$cohortId) + targets <- unlist(targets) + + + # show download button + showDownload <- shiny::reactiveVal(F) + # outcome and comparator data.frames + emptyRow <- data.frame( + id = 0, + name = 'Add', + friendlyName = 'Add' + ) + outcomeDf <- shiny::reactiveVal(emptyRow) + comparatorDf <- shiny::reactiveVal(emptyRow) + + + + output$targetSelection <- shiny::renderUI({ + + shiny::div( + + shiny::fluidRow( + + shiny::column( + width = 12, + shiny::p('First pick a target cohort') + ) + ), + + shiny::fluidRow( + + shiny::column( + width = 6, + shiny::selectInput( + inputId = session$ns('targetId'), + label = 'Target: ', + choices = targets, + selected = 1, + multiple = FALSE, + selectize = TRUE, + width = NULL, + size = NULL + ) + + ), + + shiny::column( + width = 6, + shiny::textInput( + inputId = session$ns('targetName'), + label = 'Friendly target name:', + value = 'Target' + ) + ) + ), + + + shiny::fluidRow( + shiny::column( + width = 10, + shiny::p('') + ), + shiny::column( + width = 2, + shiny::actionButton( + inputId = session$ns('targetNext'), + label = 'Next', + shiny::icon("arrow-right"), + style="color: #fff; background-color: #337ab7; border-color: #2e6da4" + ) + ) + ) + ) + }) + + + cmTargets <- shiny::reactiveVal() + shiny::observeEvent( + input$targetNext, + { + + # change tab to 'Select cmTarget' + shiny::updateTabsetPanel( + session = session, + inputId = 'mainTab', + selected = 'Select Cohort Method Target' + ) + + # get indications for target + if(is.null(input$targetId)){ + return(NULL) + } + subsetTargets <- tnos$groupedTs[[which(unlist(lapply(tnos$groupedTs, function(x) ifelse(is.null(x$cohortId), F, x$cohortId == input$targetId))))]]$subsets + ind <- !is.na(subsetTargets$subsetId) + cts <- subsetTargets$subsetId[ind] + names(cts) <- subsetTargets$targetName[ind] + cmTargets(cts) + } + ) + + + output$cmTargetSelection <- shiny::renderUI({ + + shiny::div( + + shiny::fluidRow( + shiny::column( + width = 12, + shiny::p('Now pick the subset used by cohort method (indication and extra inclusions)') + ) + ), + + shiny::fluidRow( + shiny::column( + width = 6, + shiny::selectInput( + inputId = session$ns('cmSubsetId'), + label = 'Pick cohort method target: ', + choices = cmTargets(), + selected = 1, + multiple = FALSE, + selectize = TRUE, + width = NULL, + size = NULL + ) + ), + + shiny::column( + width = 6, + shiny::textInput( + inputId = session$ns('cmTargetName'), + label = 'Friendly indication name: ', + value = 'indication' + ) + ) + ), + + + shiny::fluidRow( + shiny::column( + width = 2, + shiny::actionButton( + inputId = session$ns('cmTargetPrevious'), + label = 'Previous', + shiny::icon("arrow-left"), + style="color: #fff; background-color: #337ab7; border-color: #2e6da4" + ) + ), + shiny::column( + width = 8, + shiny::p('') + ), + shiny::column( + width = 2, + shiny::actionButton( + inputId = session$ns('cmTargetNext'), + label = 'Next', + shiny::icon("arrow-right"), + style="color: #fff; background-color: #337ab7; border-color: #2e6da4" + ) + ) + ) + ) + }) + + comparators <- shiny::reactiveVal() + shiny::observeEvent( + input$cmTargetNext, + { + + # change tab + shiny::updateTabsetPanel( + session = session, + inputId = 'mainTab', + selected = 'Select Comparator' + ) + + if(!is.null(input$cmSubsetId) & !is.null(input$targetId)){ + if(input$cmSubsetId != ''){ + temp <- tnos$cs[[which(names(tnos$cs) == as.double(input$targetId)*1000 + as.double(input$cmSubsetId))]] + comps <- temp$comparatorId + names(comps) <- temp$comparatorName + comparators(comps) + } + } + + } + ) + + + shiny::observeEvent( + input$cmTargetPrevious, + { + # change tab + shiny::updateTabsetPanel( + session = session, + inputId = 'mainTab', + selected = 'Select Target' + ) + } + ) + + + output$comparatorSelection <- shiny::renderUI({ + + shiny::div( + + shiny::fluidRow( + shiny::column( + width = 12, + shiny::p('Now pick one or more comparators') + ) + ), + + shiny::fluidRow( + shiny::column( + width = 6, + shiny::selectInput( + inputId = session$ns('comparatorId'), + label = 'Pick comparator: ', + choices = comparators(), + selected = 1, + multiple = FALSE, + selectize = TRUE, + width = NULL, + size = NULL + ) + ), + + shiny::column( + width = 6, + shiny::textInput( + inputId = session$ns('comparatorName'), + label = 'Friendly comparator name: ', + value = 'comparator' + ) + ) + ), + + + shiny::fluidRow( + shiny::column( + width = 2, + shiny::actionButton( + inputId = session$ns('comparatorPrevious'), + label = 'Previous', + shiny::icon("arrow-left"), + style="color: #fff; background-color: #337ab7; border-color: #2e6da4" + ) + ), + shiny::column( + width = 8, + shiny::p('') + ), + shiny::column( + width = 2, + shiny::actionButton( + inputId = session$ns('comparatorNext'), + label = 'Next', + shiny::icon("arrow-right"), + style="color: #fff; background-color: #337ab7; border-color: #2e6da4" + ) + ) + ) + ) + }) + + outcomes <- shiny::reactiveVal() + shiny::observeEvent( + input$comparatorNext, + { + + # change tab to 'Select Outcome' + shiny::updateTabsetPanel( + session = session, + inputId = 'mainTab', + selected = 'Select Outcome' + ) + + if(is.null(input$targetId)){ + return(NULL) + } + temp <- tnos$tos[[which(names(tnos$tos) == input$targetId)]] + os <- temp$outcomeId + names(os) <- temp$outcomeName + outcomes(os) + } + ) + + shiny::observeEvent( + input$comparatorPrevious, + { + # change tab + shiny::updateTabsetPanel( + session = session, + inputId = 'mainTab', + selected = 'Select Cohort Method Target' + ) + } + ) + + + + output$outcomeSelection <- shiny::renderUI({ + + shiny::div( + + shiny::fluidRow( + shiny::column( + width = 12, + shiny::p('Now pick one or more outcomes') + ) + ), + + shiny::fluidRow( + shiny::column( + width = 6, + shiny::selectInput( + inputId = session$ns('outcomeId'), + label = 'Pick outcome: ', + choices = outcomes(), + selected = 1, + multiple = FALSE, + selectize = TRUE, + width = NULL, + size = NULL + ) + ), + + shiny::column( + width = 6, + shiny::textInput( + inputId = session$ns('outcomeName'), + label = 'Friendly outcome name: ', + value = 'outcome' + ) + ) + ), + + #shiny::fluidRow( + #shiny::column( + # width = 2, + # shiny::actionButton( + # inputId = session$ns('addOutcome'), + # label = 'Add Outcome', + # icon = shiny::icon('plus') + # ) + #), + #shiny::column( + # width = 10, + # reactable::reactable(outcomeDf()) + #) + #), + + shiny::fluidRow( + shiny::column( + width = 2, + shiny::actionButton( + inputId = session$ns('outcomePrevious'), + label = 'Previous', + shiny::icon("arrow-left"), + style="color: #fff; background-color: #337ab7; border-color: #2e6da4" + ) + ), + shiny::column( + width = 8, + shiny::p('') + ), + shiny::column( + width = 2, + shiny::actionButton( + inputId = session$ns('outcomeNext'), + label = 'Next', + shiny::icon("arrow-right"), + style="color: #fff; background-color: #337ab7; border-color: #2e6da4" + ) + ) + ) + + ) + }) + + shiny::observeEvent( + input$outcomeNext, + { + + # change tab to 'Select Outcome' + shiny::updateTabsetPanel( + session = session, + inputId = 'mainTab', + selected = 'Generate' + ) + + output$inputTable <- shiny::renderTable( + + + data.frame( + Input = c('Target','Comparator','Outcome','Indication'), + Id = c(input$targetId, input$comparatorId, input$outcomeId, input$cmSubsetId), + Name = c(input$targetName, input$comparatorName, input$outcomeName, input$cmTargetName), + FullName = c(unlist(lapply( + c(input$targetId, input$comparatorId, input$outcomeId), + function(id){tnos$cg$cohortName[tnos$cg$cohortDefinitionId == id]} + )), 'NA') + ) + ) + + } + ) + + shiny::observeEvent( + input$outcomePrevious, + { + # change tab + shiny::updateTabsetPanel( + session = session, + inputId = 'mainTab', + selected = 'Select Comparator' + ) + } + ) + + + # GENERATE + output$generateSelection <- shiny::renderUI({ + + shiny::div( + + shiny::fluidRow( + shiny::column( + width = 12, + shiny::p('First generate the protocol and then download') + ) + ), + + shiny::fluidRow( + shiny::column( + width = 12, + shiny::p('Selected input review: '), + shiny::tableOutput(outputId = session$ns('inputTable')) + ) + ), + + shiny::fluidRow( + shiny::column( + width = 12, + shiny::p('Add study restriction details: ') + ), + shiny::column( + width = 6, + shiny::dateRangeInput( + inputId = session$ns('dateRestriction'), + label = 'Study date restriction' + ) + ), + shiny::column( + width = 6, + shiny::sliderInput( + inputId = session$ns('ageRange'), + label = 'Study age range:', + min = 0, + max = 120, + step = 1, + value = c(18,120), + round = T + ) + ) + ), + + shiny::fluidRow( + shiny::column( + width = 2, + shiny::actionButton( + inputId = session$ns('generatePrevious'), + label = 'Previous', + shiny::icon("arrow-left"), + style="color: #fff; background-color: #337ab7; border-color: #2e6da4" + ) + ), + shiny::column( + width = 5, + shiny::actionButton( + inputId = session$ns("generate"), + label = "Generate", + shiny::icon('circle-plus') + ) + ), + shiny::column( + width = 5, + shiny::uiOutput(session$ns('downloadButton')) + ) + ) + + ) # end div + }) + + shiny::observeEvent( + input$generatePrevious, + { + # change tab + shiny::updateTabsetPanel( + session = session, + inputId = 'mainTab', + selected = 'Select Outcome' + ) + } + ) + + output$downloadButton <- shiny::renderUI( + expr = if(showDownload()) { + shiny::downloadButton( + outputId = session$ns("download"), + label = "Download" + ) + } else { + NULL + }) + + # Modals for outcome and comparator + # model pops up with id and name inputs + # add the outcomeDf() or comparatorDf() + # also add remove button + + # remove outcome/comparator button + + + # Downloadable presentation ---- + shiny::observeEvent( + eventExpr = input$generate, + handlerExpr = { + + shiny::withProgress( + message = 'Cleaning files', value = 0, { + # remove file is exists + if(file.exists(file.path(tempdir(), 'presentation.html'))){ + file.remove(file.path(tempdir(), 'presentation.html')) + showDownload(F) + }; + + shiny::incProgress(0.2, detail = "Generating report") + + ReportGenerator::generatePresentationMultiple( + server = server, + username = username, + password = password, + dbms = dbms, + targetId = as.double(input$targetId), + resultsSchema = resultDatabaseSettings$schema, + subsetId = as.double(input$cmSubsetId), + outcomeIds = as.double(input$outcomeId), + comparatorIds = floor(as.double(input$comparatorId)/1000), # (remove subset), + covariateIds = c( # TODO add this as input? + 316139,320128210,443454210, + 4282096210,441542210 + ), + friendlyNames = list( + targetName = input$targetName, + comparatorNames = input$comparatorName, + indicationName = input$cmTargetName, + outcomeNames = input$outcomeName + ), + details = list( + studyPeriod = paste0(input$dateRestriction, collapse = '-'), + restrictions = paste0("Age - ", paste0(input$ageRange,collapse = '-')) + ), + title = 'Executive Summary Report', # TODO: add title for shiny app here? + lead = 'Shiny App', + date = as.character(Sys.Date()), + outputLocation = tempdir(), + outputName = 'presentation.html' + ) + showDownload(T) + shiny::incProgress(1, detail = "Done") + }) + }) + + output$download <- shiny::downloadHandler( + filename = function() { + paste("presentation-", Sys.Date(), ".html", sep="") + }, + content = function(file){ + if(file.exists(file.path(tempdir(), 'presentation.html'))){ + file.copy( + from = file.path(tempdir(), 'presentation.html'), + to = file + ) + } + } + ) + + + + } + ) +} + + + +getTandOs <- function( + connectionHandler, + resultDatabaseSettings +){ + + # get cohorts + sql <- 'select * from @schema.@cg_table_prefixcohort_definition;' + cg <- connectionHandler$queryDb( + sql = sql, + schema = resultDatabaseSettings$schema, + cg_table_prefix = resultDatabaseSettings$cgTablePrefix + ) + + characterization <- tryCatch( + {nrow(connectionHandler$queryDb( + 'select * from @schema.@c_table_prefixcohort_details limit 1;', + schema = resultDatabaseSettings$schema, + c_table_prefix = resultDatabaseSettings$cTablePrefix + ))>=0}, + error = function(e){return(F)} + ) + cohortIncidence <- tryCatch( + {nrow(connectionHandler$queryDb( + 'select * from @schema.@ci_table_prefixincidence_summary limit 1;', + schema = resultDatabaseSettings$schema, + ci_table_prefix = resultDatabaseSettings$incidenceTablePrefix + ))>=0}, + error = function(e){return(F)} + ) + cohortMethod <- tryCatch( + {nrow(connectionHandler$queryDb( + 'select * from @schema.@cm_table_prefixtarget_comparator_outcome limit 1;', + schema = resultDatabaseSettings$schema, + cm_table_prefix = resultDatabaseSettings$cmTablePrefix + ))>=0}, + error = function(e){return(F)} + ) + prediction <- tryCatch( + {nrow(connectionHandler$queryDb( + 'select * from @schema.@plp_table_prefixmodel_designs limit 1;', + schema = resultDatabaseSettings$schema, + plp_table_prefix = resultDatabaseSettings$plpTablePrefix + ))>=0}, + error = function(e){return(F)} + ) + + # get T and O pairs + sql <- "select distinct tid, oid from + + ( + + {@characterization} ? { + select distinct TARGET_COHORT_ID as tid, OUTCOME_COHORT_ID as oid + from @schema.@c_table_prefixcohort_details where + TARGET_COHORT_ID != 0 and OUTCOME_COHORT_ID != 0 + + union + } + + {@cohort_incidence} ? { + select distinct TARGET_COHORT_DEFINITION_ID as tid, OUTCOME_COHORT_DEFINITION_ID as oid + from @schema.@ci_table_prefixincidence_summary + + union + } + + {@cohort_method} ? { + select distinct TARGET_ID as tid, OUTCOME_ID as oid + from @schema.@cm_table_prefixtarget_comparator_outcome + where OUTCOME_OF_INTEREST = 1 + + union + } + + {@prediction} ? { + select distinct c1.cohort_definition_id as tid, c2.cohort_definition_id as oid + from @schema.@plp_table_prefixmodel_designs md + inner join @schema.@plp_table_prefixcohorts c1 + on c1.cohort_id = md.target_id + inner join @schema.@plp_table_prefixcohorts c2 + on c2.cohort_id = md.outcome_id + } + + ) temp_t_o + + ;" + res <- connectionHandler$queryDb( + sql = sql, + schema = resultDatabaseSettings$schema, + c_table_prefix = resultDatabaseSettings$cTablePrefix, + ci_table_prefix = resultDatabaseSettings$incidenceTablePrefix, + cm_table_prefix = resultDatabaseSettings$cmTablePrefix, + plp_table_prefix = resultDatabaseSettings$plpTablePrefix, + characterization = characterization, + cohort_incidence = cohortIncidence, + cohort_method = cohortMethod, + prediction = prediction + ) + + # add cohort names + res <- merge( + res,cg[,c('cohortDefinitionId','cohortName')], + by.x = 'tid', + by.y = 'cohortDefinitionId' + ) %>% + dplyr::rename(targetName = 'cohortName') + res <- merge( + res,cg[,c('cohortDefinitionId','cohortName')], + by.x = 'oid', + by.y = 'cohortDefinitionId' + ) %>% + dplyr::rename(outcomeName = 'cohortName') + + tos <- lapply(unique(res$tid), function(tid){ + data.frame( + outcomeId = res$oid[res$tid == tid], + outcomeName = res$outcomeName[res$tid == tid] + ) + }) + names(tos) <- unique(res$tid) + + # get target heirarchy + parents <- cg[cg$isSubset == 0,] + groupedCohorts <- lapply(1:nrow(parents), function(i){ + x <- parents$cohortDefinitionId[i]; + + if(x %in% unique(res$tid)){ + list( + cohortId = x, + cohortName = cg$cohortName[cg$cohortDefinitionId == x], + subsets = data.frame( + targetId = cg$cohortDefinitionId[cg$subsetParent == x], + targetName = cg$cohortName[cg$subsetParent == x], + subsetId = cg$subsetDefinitionId[cg$subsetParent == x] + ) + ) + }else{ + return(NULL) + }; + }) + names(groupedCohorts) <- parents$cohortName + + # get comparators + if(cohortMethod){ + comps <- connectionHandler$queryDb( + 'select distinct target_id, comparator_id from + @schema.@cm_table_prefixtarget_comparator_outcome + where outcome_of_interest = 1;', + schema = resultDatabaseSettings$schema, + cm_table_prefix = resultDatabaseSettings$cmTablePrefix + ) + + comps <- merge( + comps,cg[,c('cohortDefinitionId','cohortName')], + by.x = 'comparatorId', + by.y = 'cohortDefinitionId' + ) %>% + dplyr::rename(comparatorName = 'cohortName') + + cs <- lapply(unique(comps$targetId), function(tid){ + data.frame( + comparatorName = unique(comps$comparatorName[comps$targetId == tid]), + comparatorId = unique(comps$comparatorId[comps$targetId == tid]) + ) + } + ) + names(cs) <- unique(comps$targetId) + } + + return( + list( + cg = cg, + groupedTs = groupedCohorts, + tos = tos, + cs = cs, + characterization = characterization, + cohortIncidence = cohortIncidence, + cohortMethod = cohortMethod, + prediction = prediction + ) + ) + +} diff --git a/inst/report-www/report.html b/inst/report-www/report.html new file mode 100644 index 00000000..c2f5883a --- /dev/null +++ b/inst/report-www/report.html @@ -0,0 +1 @@ +

    Use this module to create an anlysis summary presentation for one target cohort, multiple comparators and multiple outcomes.

    \ No newline at end of file diff --git a/man/reportHelperFile.Rd b/man/reportHelperFile.Rd new file mode 100644 index 00000000..2f2735b6 --- /dev/null +++ b/man/reportHelperFile.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/report-main.R +\name{reportHelperFile} +\alias{reportHelperFile} +\title{The location of the report module helper file} +\usage{ +reportHelperFile() +} +\value{ +string location of the report helper file +} +\description{ +The location of the report module helper file +} +\details{ +Returns the location of the report helper file +} diff --git a/man/reportServer.Rd b/man/reportServer.Rd new file mode 100644 index 00000000..61466c47 --- /dev/null +++ b/man/reportServer.Rd @@ -0,0 +1,40 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/report-main.R +\name{reportServer} +\alias{reportServer} +\title{The module server for the shiny app report module} +\usage{ +reportServer( + id = "reportModule", + connectionHandler = NULL, + resultDatabaseSettings = NULL, + server = Sys.getenv("RESULTS_SERVER"), + username = Sys.getenv("RESULTS_USER"), + password = Sys.getenv("RESULTS_PASSWORD"), + dbms = "postgresql" +) +} +\arguments{ +\item{id}{the unique reference id for the module} + +\item{connectionHandler}{a connection to the database with the results} + +\item{resultDatabaseSettings}{a list containing the characterization result schema, dbms, tablePrefix, databaseTable and cgTablePrefix} + +\item{server}{server for the connection to the results for quarto} + +\item{username}{username for the connection to the results for quarto} + +\item{password}{password for the connection to the results for quarto} + +\item{dbms}{dbms for the connection to the results for quarto} +} +\value{ +The server for the shiny app home +} +\description{ +The module server for the shiny app report module +} +\details{ +The user specifies the id for the module +} diff --git a/man/reportViewer.Rd b/man/reportViewer.Rd new file mode 100644 index 00000000..eef7c51e --- /dev/null +++ b/man/reportViewer.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/report-main.R +\name{reportViewer} +\alias{reportViewer} +\title{The module viewer for the shiny app report module} +\usage{ +reportViewer(id = "reportModule") +} +\arguments{ +\item{id}{the unique reference id for the module} +} +\value{ +The user interface to the home page module +} +\description{ +The module viewer for the shiny app report module +} +\details{ +The user specifies the id for the module +} From 679ea0f7fa80d2e3e042e76b2e3aa70c751ed892 Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Tue, 2 Apr 2024 10:23:23 -0400 Subject: [PATCH 027/143] adding explicit pkg calls to pass test --- R/about-main.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/about-main.R b/R/about-main.R index 277ec148..3bb0d804 100644 --- a/R/about-main.R +++ b/R/about-main.R @@ -49,8 +49,8 @@ aboutViewer <- function(id = 'homepage') { #shinydashboard::dashboardBody( shiny::div( shiny::fluidRow( - tags$head(tags$style( - HTML(".small-box {height: 200px; width: 100%;}") + shiny::tags$head(shiny::tags$style( + shiny::HTML(".small-box {height: 200px; width: 100%;}") )), shinydashboard::box(width = "100%", shiny::htmlTemplate( From cdc20e8e617c33d45253db751c8a1d41755e3e82 Mon Sep 17 00:00:00 2001 From: jreps Date: Tue, 2 Apr 2024 13:47:21 -0400 Subject: [PATCH 028/143] Update DESCRIPTION --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 21477b79..f2ac5c3b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: OhdsiShinyModules Type: Package Title: Repository of Shiny Modules for OHDSI Result Viewers -Version: 2.1.3 +Version: 2.1.3.9000 Author: Jenna Reps Maintainer: Jenna Reps Description: Install this package to access useful shiny modules for building shiny apps to explore results using the OHDSI tools . From cd61b960281d835673ea887e4682fbb70b76a8cd Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Wed, 3 Apr 2024 17:54:35 -0400 Subject: [PATCH 029/143] adding vignette Rmds for all modules --- vignettes/Characterization.Rmd | 2 +- vignettes/CohortDiagnostics.Rmd | 2 +- vignettes/CohortMethod.Rmd | 41 +++++-------- vignettes/Cohorts.Rmd | 2 +- vignettes/DataSources.Rmd | 2 +- vignettes/EvidenceSynthesis.Rmd | 60 +++++++++++++++++++ vignettes/Prediction.Rmd | 76 ++++++++++++++++++++++++ vignettes/SelcControlledCaseSeries.Rmd | 82 ++++++++++++++++++++++++++ 8 files changed, 238 insertions(+), 29 deletions(-) create mode 100644 vignettes/EvidenceSynthesis.Rmd create mode 100644 vignettes/Prediction.Rmd create mode 100644 vignettes/SelcControlledCaseSeries.Rmd diff --git a/vignettes/Characterization.Rmd b/vignettes/Characterization.Rmd index 25d7a9d5..56714634 100644 --- a/vignettes/Characterization.Rmd +++ b/vignettes/Characterization.Rmd @@ -1,6 +1,6 @@ --- title: "Characterization" -author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +author: "Nathan Hall" date: '`r Sys.Date()`' header-includes: - \usepackage{fancyhdr} diff --git a/vignettes/CohortDiagnostics.Rmd b/vignettes/CohortDiagnostics.Rmd index 803906d6..25721538 100644 --- a/vignettes/CohortDiagnostics.Rmd +++ b/vignettes/CohortDiagnostics.Rmd @@ -1,6 +1,6 @@ --- title: "Cohort Diagnostics" -author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +author: "Nathan Hall" date: '`r Sys.Date()`' header-includes: - \usepackage{fancyhdr} diff --git a/vignettes/CohortMethod.Rmd b/vignettes/CohortMethod.Rmd index ef489bc1..879a87e5 100644 --- a/vignettes/CohortMethod.Rmd +++ b/vignettes/CohortMethod.Rmd @@ -1,6 +1,6 @@ --- title: "Cohort Method (Estimation)" -author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +author: "Nathan Hall" date: '`r Sys.Date()`' header-includes: - \usepackage{fancyhdr} @@ -35,35 +35,26 @@ knitr::opts_chunk$set(echo = TRUE) # Introduction -In the realm of observational research, where data heterogeneity and complexity are common, assessing and diagnosing the characteristics of cohorts is fundamental to ensuring the reliability and credibility of research findings. This is also an essential step in phenotype development. The OHDSI community has developed an R package, CohortDiagnostics, which provides researchers with a systematic approach to examine various facets of cohorts, enabling them to identify potential biases, assess data completeness, and validate the suitability of cohorts for analysis. This tool is crucial for researchers working within the Observational Health Data Sciences and Informatics (OHDSI) ecosystem, enabling them to ensure the accuracy and reliability of cohort definitions through a detailed examination of incidence rates, cohort characteristics, and the specific codes triggering cohort inclusion criteria. CohortDiagnostics streamlines the process of cohort evaluation by: - -1. Generating a broad spectrum of diagnostics against a CDM database - see more details here: [Features and Functionalities] -2. Providing an interactive R Shiny application within the package for an intuitive exploration and visualization of these diagnostics. For more information on R Shiny, see [here](https://www.rstudio.com/products/shiny/ "R Shiny"). +Observational healthcare data, comprising administrative claims and electronic health records, present a rich source for generating real-world evidence pertinent to treatment effects that directly impact patient well-being. Within this realm, population-level effect estimation assumes a pivotal role, focusing on elucidating the average causal effects of exposures—such as medical interventions like drug exposures or procedures—on specific health outcomes of interest. Population-level effect estimation delves into two primary realms: direct effect estimation and comparative effect estimation. In direct effect estimation, the focus lies on discerning the effect of an exposure on the risk of an outcome compared to no exposure, while comparative effect estimation aims to delineate the effect of a target exposure against a comparator exposure. By contrasting factual outcomes with counterfactual scenarios—what happened versus what would have occurred under different circumstances—these estimation tasks offer critical insights into treatment selection, safety surveillance, and comparative effectiveness. Whether probing individual hypotheses or exploring multiple hypotheses concurrently, the overarching goal remains consistent: to derive high-quality estimates of causal effects from the intricate fabric of observational healthcare data. # Features and Functionalities -CohortDiagnostics offers a suite of features designed to deepen the understanding of cohort dynamics and the intricacies of cohort definitions, including: - -1. **Cohort Definition**: Facilitates the examination and validation of the logic behind cohort definitions, ensuring they accurately capture the intended population. -2. **Concepts in Data Source**: Identifies the specific concepts present within the data source that are relevant to the cohort definitions, enabling a deeper understanding of data coverage and content. -3. **Orphan Concepts**: Highlights concepts that, despite their relevance, are not captured within a cohort's definition. This helps in refining concept sets and cohort criteria to ensure comprehensiveness and relevance. -4. **Cohort Counts**: Provides counts of individuals and records within cohorts, offering a basic measure of cohort size and scope. -5. **Incidence Rate**: Calculates the incidence rate of cohorts, stratified by various demographic and temporal factors such as age, sex, and calendar year, to assess the frequency of patients/records in the cohort and potential patterns over these strata. -6. **Time Distributions**: Examines the distribution of time-related variables within cohorts, such as observation time before and after cohort index date as well as cohort duration, offering insights into cohort dynamics over time and available observation time. -7. **Index Event Breakdown**: Breaks down the specific events that qualify individuals for cohort inclusion, providing clarity on how inclusion criteria are met. -8. **Visit Context**: Analyzes the healthcare context (e.g., inpatient, outpatient) of the index events, offering insights into where and how cohort members are identified within the healthcare system. -9. **Cohort Overlap**: Assesses the degree of overlap between cohorts, which can inform on potential biases, errors, or redundancies in cohort construction, as well as shared characteristics between cohorts of patients. -10. **Cohort Characterization**: Characterizes cohorts by detailing prevalent conditions, medication use, procedures, and more, to understand the clinical profile of cohort members over various time periods relative to index. -11. **Compare Cohort Characterization**: Enables the direct comparison of characteristics between cohorts, facilitating the identification of unique or shared features across different cohorts and across time points. -12. **Meta Data**: Provides meta-information about the data and analyses conducted, ensuring transparency and reproducibility of the cohort diagnostics process. +The [CohortMethod](https://ohdsi.github.io/CohortMethod/ "CohortMethod") R package, a cornerstone of population-level estimation within the OHDSI framework, offers a robust methodology for conducting comparative effectiveness research and pharmacoepidemiology studies. Some of the features offered by conducting population-level effect estimation using the CohortMethod module are: -Together, these features equip researchers with the tools necessary for a thorough examination of cohort definitions, enhancing the quality and reliability of observational health research. +1. **Data Extraction**: Extracts necessary data from databases structured in the OMOP Common Data Model (CDM) format, ensuring uniformity and compatibility across diverse healthcare settings. +2. **Covariate Selection**: Utilizing a comprehensive set of covariates, including drugs, diagnoses, procedures, age, and comorbidity indexes, CohortMethod constructs propensity and outcome models tailored to specific research questions. +3. **Large-Scale Regularized Regression**: Employing large-scale regularized regression techniques, CohortMethod fits propensity and outcome models with precision and efficiency, accommodating the complexities of real-world healthcare data. +4. **Propensity Score Adjustment**: Facilitates propensity score adjustment through trimming, stratification, matching, and weighting, enabling researchers to address confounding and balance covariate distributions across treatment groups. Results are viewable both graphically and in tabular form to assess the model. +5. **Diagnostic Functions**: Diagnostic functions within CohortMethod offer insights into propensity score distributions and covariate balance before and after matching or trimming, enhancing transparency and robustness in estimation procedures. +6. **Supported Outcome Models**: Supported outcome models include (conditional) logistic regression, (conditional) Poisson regression, and (conditional) Cox regression, providing flexibility in modeling various types of outcomes in observational health data research. +7. **Power**: Incorporates power analysis techniques to estimate the statistical power of the study design, aiding in sample size determination and study planning, and provides a minimum-detectable relative risk (MDRR) statistic. +8. **Attrition**: Assesses attrition rates within cohorts, providing insights into potential biases introduced by data loss during the study period, and provides a visualization of attrition across various cohort criteria. +9. **Population Characteristics**: Analyzes population characteristics to understand the demographic and clinical makeup of the study cohorts, informing interpretation of estimation results both before and after propensity score matching. +10. **Covariate Balance**: Visually monitors covariate balance before and after matching or trimming, ensuring that confounding variables are adequately controlled for in the analysis. +11. **Systematic Error**: Assesses effect size estimates for negative controls (true hazard ratio = 1) and positive controls (true hazard ratio > 1) both before and after calibration. Estimates below the diagonal dashed lines are statistically significant (alpha = 0.05) different from the true effect size. A well-calibrated estimator should have the true effect size within the 95 percent confidence interval 95 percent of times, providing researchers with confidence in the reliability of the estimation process and the accuracy of the obtained results. # Utility and Application -CohortDiagnostics significantly contributes to the field of observational health research by providing a robust framework for the evaluation and validation of cohort definitions. Its utility spans several critical areas: +**Comparative Effectiveness Research**: CohortMethod empowers researchers to conduct comparative effectiveness studies by estimating treatment effects while accounting for potential confounding factors and bias inherent in observational data. -1. **Enhancing Cohort Definition Confidence**: By offering detailed diagnostics, CohortDiagnostics helps researchers refine their cohort definitions, ensuring they accurately capture the intended population. This is a critical step in phenotype development, which is a cornerstone of modern observational health data research. -2. **Identifying Data Quality Issues**: Through the identification of orphan concepts and the detailed breakdown of index events, researchers can pinpoint data quality issues or gaps in cohort definitions. Iterating over multiple potential cohort definitions after analyzing these diagnostics is an encouraged and common practice. -3. **Facilitating the Ideas Behind Comparative Analyses**: The package's capabilities to characterize and compare cohorts, as well as to analyze cohort overlaps, are invaluable for researchers looking to understand the nuances and dynamics of their study populations. These diagnostics can help inform comparative studies in the future, after the cohorts and phenotypes are refined and finalized. -4. **Supporting Transparent Research**: By enabling the listing of source codes, data source information, and providing a platform for detailed diagnostics exploration, CohortDiagnostics fosters a culture of transparency and reproducibility in observational research. +**Pharmacoepidemiology and Drug Safety Studies**: In pharmacoepidemiology research, CohortMethod facilitates the evaluation of drug safety and effectiveness by quantifying the association between drug exposures and clinical outcomes in real-world populations. diff --git a/vignettes/Cohorts.Rmd b/vignettes/Cohorts.Rmd index 94cbd5af..bb8b3d8b 100644 --- a/vignettes/Cohorts.Rmd +++ b/vignettes/Cohorts.Rmd @@ -1,6 +1,6 @@ --- title: "Cohorts" -author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +author: "Nathan Hall" date: '`r Sys.Date()`' header-includes: - \usepackage{fancyhdr} diff --git a/vignettes/DataSources.Rmd b/vignettes/DataSources.Rmd index 409dfc65..a00bf4dd 100644 --- a/vignettes/DataSources.Rmd +++ b/vignettes/DataSources.Rmd @@ -1,6 +1,6 @@ --- title: "Data Sources" -author: "Jenna Reps, Jamie Gilbert, Nathan Hall" +author: "Nathan Hall" date: '`r Sys.Date()`' header-includes: - \usepackage{fancyhdr} diff --git a/vignettes/EvidenceSynthesis.Rmd b/vignettes/EvidenceSynthesis.Rmd new file mode 100644 index 00000000..0f26d43e --- /dev/null +++ b/vignettes/EvidenceSynthesis.Rmd @@ -0,0 +1,60 @@ +--- +title: "Evidence Synthesis (Meta, Meta Analysis)" +author: "Nathan Hall" +date: '`r Sys.Date()`' +header-includes: + - \usepackage{fancyhdr} + - \pagestyle{fancy} + - \fancyhead{} + - \fancyfoot[LE,RO]{\thepage} + - \renewcommand{\headrulewidth}{0.4pt} + - \renewcommand{\footrulewidth}{0.4pt} + - \fancyfoot[CO,CE]{OhdsiShinyModules Package Version `r utils::packageVersion("OhdsiShinyModules")`} +output: + html_document: + number_sections: yes + toc: yes + word_document: + toc: yes + pdf_document: + includes: + in_header: preamble.tex + number_sections: yes + toc: yes +--- + +```{=html} + +``` +```{r include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Introduction + +Meta-analysis plays a pivotal role in healthcare research by enabling the synthesis of findings from multiple studies to draw more generalizable conclusions. In the context of distributed health data networks, where data are spread across various sites with diverse populations and practices, synthesizing evidence becomes both a challenge and a necessity. The [EvidenceSynthesis](https://github.com/OHDSI/EvidenceSynthesis "EvidenceSynthesis") R package addresses these challenges head-on. It offers a suite of tools designed for combining causal effect estimates and study diagnostics from multiple data sites, all while adhering to stringent patient privacy requirements and navigating the complexities inherent to observational data. This approach enhances the robustness of meta-analytical conclusions and extends the utility of distributed health data for research purposes. + +# Features and Functionalities + +The Meta module which utilizes the EvidenceSynthesis R package makes use of the following features to summarize the results of a study: + +1. **Meta-Analysis Methods**: Facilitates both traditional fixed-effects and random-effects meta-analyses, accommodating studies with different degrees of between-site or between-database variability. +2. **Forest Plot Generation**: Provides capabilities for creating forest plots, visual summaries that illustrate the effects estimated by individual studies, their confidence intervals, and the synthesized overall effect. +3. **Non-Normal Likelihood Approximations**: Utilizes non-normal approximations for the per-data-site likelihood function to reduce bias in scenarios with small or zero counts, a frequent issue in distributed research environments. + +The syntheses are generated for both Cohort Method and Self-Controlled Case Series estimation results from the study, providing both information on the diagnostic results within each database and the visualized and tabular results of the meta analysis. + +# Utility and Application + +The EvidenceSynthesis package is instrumental in synthesizing evidence from observational studies across multiple healthcare databases. Its significance is underscored in scenarios characterized by: + +**Comparative Effectiveness Research**: Synthesizing evidence from disparate sources allows for stronger, more reliable comparisons of treatment outcomes, enriching the foundation for clinical decision-making. + +**Safety Surveillance**: Aggregated safety data across databases enhance the detection and understanding of adverse drug reactions, contributing to safer patient care. + +**Policy and Clinical Guidelines Development**: Meta-analytical findings informed by comprehensive, real-world data can guide policy formulation and the updating of clinical guidelines, ensuring they are grounded in broad-based evidence. + +**Addressing Challenges of Small Sample Sizes**: The EvidenceSynthesis package notably advances the field by tackling the issue of small sample sizes and zero event counts, which traditional meta-analytical methods often handle poorly. Its innovative use of non-normal likelihood approximations enables more precise effect size estimation under such conditions, ensuring that the insights derived from meta-analyses are both accurate and meaningful. This attribute is particularly beneficial in distributed health data networks, where individual site/database data may be limited but collectively hold significant informational value. diff --git a/vignettes/Prediction.Rmd b/vignettes/Prediction.Rmd new file mode 100644 index 00000000..2b0b6fa3 --- /dev/null +++ b/vignettes/Prediction.Rmd @@ -0,0 +1,76 @@ +--- +title: "Prediction" +author: "Nathan Hall" +date: '`r Sys.Date()`' +header-includes: + - \usepackage{fancyhdr} + - \pagestyle{fancy} + - \fancyhead{} + - \fancyfoot[LE,RO]{\thepage} + - \renewcommand{\headrulewidth}{0.4pt} + - \renewcommand{\footrulewidth}{0.4pt} + - \fancyfoot[CO,CE]{OhdsiShinyModules Package Version `r utils::packageVersion("OhdsiShinyModules")`} +output: + html_document: + number_sections: yes + toc: yes + word_document: + toc: yes + pdf_document: + includes: + in_header: preamble.tex + number_sections: yes + toc: yes +--- + +```{=html} + +``` +```{r include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Introduction + +Patient-level prediction stands as a pivotal component in clinical decision-making, providing clinicians with tools to anticipate diagnostic or prognostic outcomes based on individual patient characteristics. In the complex landscape of modern medicine, where patients generate extensive digital footprints through Electronic Health Records (EHRs), the ability to harness this wealth of data for predictive modeling holds immense potential. However, despite the growing interest in predictive modeling, challenges such as model reproducibility, validation, and transparency persist. The Observational Health Data Science and Informatics (OHDSI) framework, with its Common Data Model (CDM) and standardized methodologies, addresses these challenges by enabling the development and validation of predictive models at scale, facilitating external validation across diverse healthcare settings globally. The OHDSI [PatientLevelPrediction](https://ohdsi.github.io/PatientLevelPrediction/ "Patient-level Prediction") R package encapsulates established best practices for model development and validation. + +# Features and Functionalities + +The Prediction module is dedicated to investigating prediction models tailored to specific prediction problems through a combination of machine learning algorithms and feature engineering techniques. In this module, users are able to explore model design summaries, detailed information about the models fitted, model diagnostics, and a detailed report including performance characteristic results, model discrimination results, and calibration results. + +The full list of features which are explorable in the Prediction module are as follows: + +- Takes one or more target cohorts (Ts) and one or more outcome cohorts (Os) and develops and validates models for all T and O combinations. + +- Allows for multiple prediction design options. + +- Extracts the necessary data from a database in OMOP Common Data Model format for multiple covariate settings. + +- Uses a large set of covariates including for example all drugs, diagnoses, procedures, as well as age, comorbidity indexes, and custom covariates. + +- Allows you to add custom covariates or cohort covariates. + +- Includes a large number of state-of-the-art machine learning algorithms that can be used to develop predictive models, including Regularized logistic regression, Random forest, Gradient boosting machines, Decision tree, Naive Bayes, K-nearest neighbours, Neural network, AdaBoost and Support vector machines. + +- Allows you to add custom algorithms. + +- Allows you to add custom feature engineering + +- Allows you to add custom under/over sampling (or any other sampling) [note: based on existing research this is not recommended] + +- Contains functionality to externally validate models. + +- Includes functions to plot and explore model performance (ROC + Calibration). + +- Build ensemble models using EnsemblePatientLevelPrediction. + +- Build Deep Learning models using DeepPatientLevelPrediction. + +- Generates learning curves. + +# Utility and Application + +Patient-level prediction within the OHDSI framework represents a paradigm shift in clinical decision support, offering the potential to transform patient care through personalized medicine. By leveraging standardized data structures, rigorous methodologies, and transparent reporting practices, patient-level prediction endeavors in OHDSI strive to bridge the gap between predictive modeling research and clinical practice, ultimately enhancing patient outcomes and advancing evidence-based healthcare. diff --git a/vignettes/SelcControlledCaseSeries.Rmd b/vignettes/SelcControlledCaseSeries.Rmd new file mode 100644 index 00000000..d526332a --- /dev/null +++ b/vignettes/SelcControlledCaseSeries.Rmd @@ -0,0 +1,82 @@ +--- +title: "Self-Controlled Case Series" +author: "Nathan Hall" +date: '`r Sys.Date()`' +header-includes: + - \usepackage{fancyhdr} + - \pagestyle{fancy} + - \fancyhead{} + - \fancyfoot[LE,RO]{\thepage} + - \renewcommand{\headrulewidth}{0.4pt} + - \renewcommand{\footrulewidth}{0.4pt} + - \fancyfoot[CO,CE]{OhdsiShinyModules Package Version `r utils::packageVersion("OhdsiShinyModules")`} +output: + html_document: + number_sections: yes + toc: yes + word_document: + toc: yes + pdf_document: + includes: + in_header: preamble.tex + number_sections: yes + toc: yes +--- + +```{=html} + +``` +```{r include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + +# Introduction + +The Self-Controlled Case Series (SCCS) method offers a nuanced approach to investigating the relationship between exposures and outcomes within individual patients over time. SCCS designs are particularly adept at comparing the rate of outcomes during times of exposure to rates during periods of non-exposure, including before, between, and after exposure episodes. By leveraging a Poisson regression that is conditioned on the individual, the SCCS design inherently addresses the question: “Given that a patient has the outcome, is the outcome more likely to occur during exposed time compared to non-exposed time?” The design choices outlined in the method are pivotal for defining an SCCS question, with each choice playing a critical role in the study's design and outcomes: + +**Target Cohort**: This represents the treatment under investigation. +**Outcome Cohort**: This cohort signifies the outcome of interest. +**Time-at-Risk**: Identifies the specific times when the risk of the outcome is considered, often relative to the start and end dates of the target cohort. +**Model**: Defines the statistical model used to estimate the effect, including adjustments for time-varying confounders if necessary. + +One of the SCCS design's strengths is its robustness to confounding by factors that differ between individuals, as each participant serves as their own control. However, it remains sensitive to time-varying confounding factors. To mitigate this, adjustments can be made for factors such as age, seasonality, and calendar time, enhancing the model's accuracy. + +An advanced variant of the SCCS also considers all other drug exposures recorded in the database, significantly expanding the model's variables. This approach employs L1-regularization, with cross-validation used to select the regularization hyperparameter for all exposures except the one of interest. + +An important assumption of the SCCS is that the observation period's end is independent of the outcome date. This may not hold true for outcomes that can be fatal, such as stroke. To address this, extensions to the SCCS model have been developed that correct for any dependency between the observation period end and the outcome. + +# Features and Functionalities + +The [SelfControlledCaseSeries](https://ohdsi.github.io/SelfControlledCaseSeries/ "SCCS") R package allows the user to perform SCCS analyses in an observational database in the OMOP Common Data Model. Some of the features offered by the SCCS module include: + +1. **Data Extraction: Extracts necessary data from databases structured in the OMOP Common Data Model (CDM) format, ensuring uniformity and compatibility across diverse healthcare settings. +2. **Seasonality Adjustment**: Offers the option to adjust for seasonality effects using a spline function, enhancing the model's accuracy by accounting for seasonal variation in exposure and outcome rates. +3. **Age Adjustment**: Provides the option to incorporate age adjustments using a spline function, allowing for more nuanced analyses that consider the impact of age on the exposure-outcome relationship. +4. **Calendar Time Adjustment**: Enables the inclusion of calendar time adjustments using a spline function, addressing potential temporal trends in the data that could confound the exposure-outcome relationship. +5. **Event-dependent Censoring Correction**: Features the ability to correct for event-dependent censoring of the observation period, ensuring that the end of the observation period is appropriately handled, especially in cases where it might be related to the outcome. +6. **Comprehensive Covariate Inclusion**: Allows for the addition of a wide array of covariates in one analysis, such as all recorded drug exposures, facilitating a thorough examination of potential confounders and effect modifiers. +7. **Risk Window Customization**: Supports the construction of various types of covariates and risk windows, including pre-exposure windows, to capture contra-indications and other relevant temporal patterns related to exposure and outcome. +8. **Regularization of Covariates**: Applies regularization to all covariates except the outcome of interest, employing techniques like L1-regularization with cross-validation for selecting the regularization hyperparameter, thereby preventing overfitting and enhancing model reliability. +9. **Self-Controlled Risk Interval Design**: Incorporates the self-controlled risk interval design as a specific application of the SCCS method, offering additional methodological flexibility for studying short-term effects of exposures. +10. **Power**: Incorporates power analysis techniques to estimate the statistical power of the study design, aiding in sample size determination and study planning, and provides a minimum-detectable relative risk (MDRR) statistic. +11. **Attrition**: Assesses attrition rates within cohorts, providing insights into potential biases introduced by data loss during the study period, and provides a visualization of attrition across various cohort criteria. +12. **Spanning**: Analyzes the number of subjects observed for 3 consecutive months, providing insights into the cohort's consistency and stability over time. +13. **Time Trend**: Assesses the ratio of observed to expected outcomes per month, with adjustments for calendar time, seasonality, and/or age as specified in the model, to examine time trends in the data. +14. **Time to Event**: Evaluates the number of events and subjects observed per week relative to the start of the first exposure, offering critical insights into the temporal relationship between exposure and outcome. +15. **Event-dependent Observation**: Provides histograms for the time between the first occurrence of the outcome and the end of observation, stratified by censored and uncensored ends of observation, to assess the impact of event-dependent observation periods. +16. **Systematic Error**: Assesses effect size estimates for negative controls (true hazard ratio = 1) and positive controls (true hazard ratio > 1) both before and after calibration. Estimates below the diagonal dashed lines are statistically significant (alpha = 0.05) different from the true effect size. A well-calibrated estimator should have the true effect size within the 95 percent confidence interval 95 percent of times, providing researchers with confidence in the reliability of the estimation process and the accuracy of the obtained results. + +# Utility and Application + +The SCCS method is particularly applicable in several key areas of epidemiological research and pharmacovigilance: + +**Drug Safety Surveillance**: The SCCS method is widely used in drug safety surveillance to identify adverse effects of medications post-marketing. It is well-suited to detect short-term risks associated with drug exposures, especially where the onset of the adverse event is expected to be temporally close to the exposure. + +**Vaccine Safety Evaluation**: The SCCS design is ideal for assessing the safety of vaccines, especially in evaluating the risk of adverse events following immunization. Its self-controlled nature helps to address concerns about confounding by indication and other biases that can affect observational studies in vaccine safety. + +**Comparative Effectiveness Research**: While primarily designed for evaluating the safety of medical interventions, the SCCS method can also be adapted to compare the effectiveness of different treatments or interventions within the same individual over time, particularly for acute conditions. + +**Epidemiological Research**: More broadly, the SCCS method is used in epidemiological research to study the temporal relationships between exposures and outcomes, offering insights into the causality and mechanisms underlying health conditions and diseases. From 399aa45181d5bfe798156a9f2c2c125718684977 Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Wed, 3 Apr 2024 17:54:35 -0400 Subject: [PATCH 030/143] adding vignette Rmds for all modules From e545877fbfe53b9147fa62039125b10b7fa61985 Mon Sep 17 00:00:00 2001 From: jreps Date: Fri, 5 Apr 2024 09:49:36 -0400 Subject: [PATCH 031/143] Update _pkgdown.yml -updating the pkgdown yml --- _pkgdown.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/_pkgdown.yml b/_pkgdown.yml index 00fb3c41..5f10913c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -43,6 +43,27 @@ reference: contents: - OhdsiShinyModules - getLogoImage + - title: "About module" + desc: > + Modules for the information page. + contents: + - aboutHelperFile + - aboutViewer + - aboutServer + - title: "Report module" + desc: > + Modules for creating summary html report. + contents: + - reportHelperFile + - reportViewer + - reportServer + - title: "SCCS module" + desc: > + Modules for viewing self controlled case series results. + contents: + - sccsHelperFile + - sccsViewer + - sccsServer - title: "Prediction module" desc: > Modules for prediction results. @@ -87,13 +108,6 @@ reference: - characterizationTableServer - characterizationTimeToEventViewer - characterizationTimeToEventServer - - title: "About module" - desc: > - Modules for the information page. - contents: - - aboutHelperFile - - aboutViewer - - aboutServer - title: "Cohort Generator module" desc: > Modules for the cohort generator package. From d4de00f4bb0cd9ba4e364072a1cd61201c57e23d Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Fri, 5 Apr 2024 11:33:57 -0400 Subject: [PATCH 032/143] updating pkgdown --- R/OhdsiShinyModules.R | 2 +- _pkgdown.yml | 50 ++++++++++++++++--- docs/404.html | 26 +++++++++- docs/authors.html | 30 +++++++++-- docs/index.html | 28 ++++++++++- docs/pkgdown.yml | 10 +++- man/OhdsiShinyModules.Rd | 3 +- vignettes/Characterization.Rmd | 2 +- vignettes/CohortDiagnostics.Rmd | 2 +- vignettes/CohortMethod.Rmd | 2 +- vignettes/Cohorts.Rmd | 2 +- vignettes/DataSources.Rmd | 2 +- vignettes/EvidenceSynthesis.Rmd | 2 +- vignettes/Prediction.Rmd | 2 +- ...eries.Rmd => SelfControlledCaseSeries.Rmd} | 2 +- 15 files changed, 139 insertions(+), 26 deletions(-) rename vignettes/{SelcControlledCaseSeries.Rmd => SelfControlledCaseSeries.Rmd} (99%) diff --git a/R/OhdsiShinyModules.R b/R/OhdsiShinyModules.R index be906dcd..fd0f0bd7 100644 --- a/R/OhdsiShinyModules.R +++ b/R/OhdsiShinyModules.R @@ -20,7 +20,7 @@ #' #' @description A selection of shiny modules for exploring standardized OHDSI results #' -#' @docType package +#' @docType _PACKAGE #' @name OhdsiShinyModules #' @importFrom dplyr %>% #' @importFrom rlang .data diff --git a/_pkgdown.yml b/_pkgdown.yml index 5f10913c..bb3e103e 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -140,14 +140,10 @@ reference: - cohortMethodPropensityModelServer - cohortMethodPropensityScoreDistViewer - cohortMethodPropensityScoreDistServer - - cohortMethodResultsTableViewer - - cohortMethodResultsTableServer - - cohortMethodSubgroupsViewer - - cohortMethodSubgroupsServer + - cohortMethodResultSummaryTableViewer + - cohortMethodResultSummaryTableServer - cohortMethodSystematicErrorViewer - cohortMethodSystematicErrorServer - - cohortMethodTitlePanelViewer - - cohortMethodTitlePanelServer - title: "Data diagnostics module" desc: > Modules for the DataDiagnostics package. @@ -159,7 +155,8 @@ reference: - dataDiagnosticSummaryServer - dataDiagnosticSummaryViewer - dataDiagnosticViewer - - title: "Cohort Diagnostic module" + - dataDiagnosticHelperFile + - title: "Cohort Diagnostics module" desc: > Modules for the CohortDiagnostics package. contents: @@ -184,4 +181,41 @@ reference: - timeDistributionsView - visitContextView - inclusionRulesView - \ No newline at end of file + - title: "Components module" + desc: > + Modules for the component functions shared across modules. + contents: + - createCustomColDefList + - createLargeSqlQuery + - LargeDataTable + - largeTableView + - largeTableServer + - makeButtonLabel + - title: "Data sources module" + desc: > + Modules for the data sources results. + contents: + - datasourcesHelperFile + - datasourcesServer + - datasourcesViewer + - title: "Evidence synthesis module" + desc: > + Modules for the evidence synthesis (Meta) analysis results. + contents: + - evidenceSynthesisHelperFile + - evidenceSynthesisServer + - evidenceSynthesisViewer + - title: "Home module" + desc: > + Modules for the home page. + contents: + - homeHelperFile + - homeServer + - homeViewer + - title: "PheValuator module" + desc: > + Modules for the PheValuator results. + contents: + - phevaluatorHelperFile + - phevaluatorServer + - phevaluatorViewer \ No newline at end of file diff --git a/docs/404.html b/docs/404.html index f062b816..11727824 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ OhdsiShinyModules - 2.1.2 + 2.1.3.9000 @@ -60,6 +60,30 @@
  • Adding Shiny Modules
  • +
  • + Characterization +
  • +
  • + Cohort Diagnostics +
  • +
  • + Cohort Method (Estimation) +
  • +
  • + Cohorts +
  • +
  • + Data Sources +
  • +
  • + Evidence Synthesis (Meta, Meta Analysis) +
  • +
  • + Prediction +
  • +
  • + Self-Controlled Case Series +
  • diff --git a/docs/authors.html b/docs/authors.html index 1dd691c0..b262e850 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@ OhdsiShinyModules - 2.1.2 + 2.1.3.9000 @@ -43,6 +43,30 @@
  • Changelog @@ -85,13 +109,13 @@

    Citation

    Reps J (2024). OhdsiShinyModules: Repository of Shiny Modules for OHDSI Result Viewers. -R package version 2.1.2. +R package version 2.1.3.9000.

    @Manual{,
       title = {OhdsiShinyModules: Repository of Shiny Modules for OHDSI Result Viewers},
       author = {Jenna Reps},
       year = {2024},
    -  note = {R package version 2.1.2},
    +  note = {R package version 2.1.3.9000},
     }
    diff --git a/docs/index.html b/docs/index.html index 1fb8ab5e..525dc371 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,7 +33,7 @@ OhdsiShinyModules - 2.1.2 + 2.1.3.9000 @@ -61,6 +61,30 @@
  • Adding Shiny Modules
  • +
  • + Characterization +
  • +
  • + Cohort Diagnostics +
  • +
  • + Cohort Method (Estimation) +
  • +
  • + Cohorts +
  • +
  • + Data Sources +
  • +
  • + Evidence Synthesis (Meta, Meta Analysis) +
  • +
  • + Prediction +
  • +
  • + Self-Controlled Case Series +
  • @@ -123,7 +147,7 @@

    Installationhere for configuring your R environment, including Java.

  • To install the latest stable version:

  • -
    install.packages(remotes)
    +
    install.packages('remotes')
     remotes::install_github('ohdsi/OhdsiShinyModules')
    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 65abfb39..beb6e0b5 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -3,5 +3,13 @@ pkgdown: 2.0.7 pkgdown_sha: ~ articles: AddingShinyModules: AddingShinyModules.html -last_built: 2024-01-25T16:37Z + Characterization: Characterization.html + CohortDiagnostics: CohortDiagnostics.html + CohortMethod: CohortMethod.html + Cohorts: Cohorts.html + DataSources: DataSources.html + EvidenceSynthesis: EvidenceSynthesis.html + Prediction: Prediction.html + SelfControlledCaseSeries: SelfControlledCaseSeries.html +last_built: 2024-04-05T15:33Z diff --git a/man/OhdsiShinyModules.Rd b/man/OhdsiShinyModules.Rd index fe505b2c..f29283c8 100644 --- a/man/OhdsiShinyModules.Rd +++ b/man/OhdsiShinyModules.Rd @@ -1,8 +1,7 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/OhdsiShinyModules.R -\docType{package} +\docType{_PACKAGE} \name{OhdsiShinyModules} -\alias{OhdsiShinyModules-package} \alias{OhdsiShinyModules} \title{OhdsiShinyModules} \description{ diff --git a/vignettes/Characterization.Rmd b/vignettes/Characterization.Rmd index 56714634..d83788b5 100644 --- a/vignettes/Characterization.Rmd +++ b/vignettes/Characterization.Rmd @@ -26,7 +26,7 @@ output: ```{=html} ``` ```{r include=FALSE} diff --git a/vignettes/CohortDiagnostics.Rmd b/vignettes/CohortDiagnostics.Rmd index 25721538..b21f95c7 100644 --- a/vignettes/CohortDiagnostics.Rmd +++ b/vignettes/CohortDiagnostics.Rmd @@ -26,7 +26,7 @@ output: ```{=html} ``` ```{r include=FALSE} diff --git a/vignettes/CohortMethod.Rmd b/vignettes/CohortMethod.Rmd index 879a87e5..e83f05d6 100644 --- a/vignettes/CohortMethod.Rmd +++ b/vignettes/CohortMethod.Rmd @@ -26,7 +26,7 @@ output: ```{=html} ``` ```{r include=FALSE} diff --git a/vignettes/Cohorts.Rmd b/vignettes/Cohorts.Rmd index bb8b3d8b..f49a88f5 100644 --- a/vignettes/Cohorts.Rmd +++ b/vignettes/Cohorts.Rmd @@ -26,7 +26,7 @@ output: ```{=html} ``` ```{r include=FALSE} diff --git a/vignettes/DataSources.Rmd b/vignettes/DataSources.Rmd index a00bf4dd..c04147d1 100644 --- a/vignettes/DataSources.Rmd +++ b/vignettes/DataSources.Rmd @@ -26,7 +26,7 @@ output: ```{=html} ``` ```{r include=FALSE} diff --git a/vignettes/EvidenceSynthesis.Rmd b/vignettes/EvidenceSynthesis.Rmd index 0f26d43e..39e2edcc 100644 --- a/vignettes/EvidenceSynthesis.Rmd +++ b/vignettes/EvidenceSynthesis.Rmd @@ -26,7 +26,7 @@ output: ```{=html} ``` ```{r include=FALSE} diff --git a/vignettes/Prediction.Rmd b/vignettes/Prediction.Rmd index 2b0b6fa3..42a16b72 100644 --- a/vignettes/Prediction.Rmd +++ b/vignettes/Prediction.Rmd @@ -26,7 +26,7 @@ output: ```{=html} ``` ```{r include=FALSE} diff --git a/vignettes/SelcControlledCaseSeries.Rmd b/vignettes/SelfControlledCaseSeries.Rmd similarity index 99% rename from vignettes/SelcControlledCaseSeries.Rmd rename to vignettes/SelfControlledCaseSeries.Rmd index d526332a..9f72d894 100644 --- a/vignettes/SelcControlledCaseSeries.Rmd +++ b/vignettes/SelfControlledCaseSeries.Rmd @@ -26,7 +26,7 @@ output: ```{=html} ``` ```{r include=FALSE} From e4dd6678985197f3dacd54e1853627ac8a8d9aef Mon Sep 17 00:00:00 2001 From: Nathan Hall Date: Tue, 9 Apr 2024 15:35:18 -0400 Subject: [PATCH 033/143] updating pkgdown yml --- _pkgdown.yml | 32 +- docs/articles/AddingShinyModules.html | 48 ++- docs/articles/Characterization.html | 241 +++++++++++++++ docs/articles/CohortDiagnostics.html | 297 ++++++++++++++++++ docs/articles/CohortMethod.html | 274 +++++++++++++++++ docs/articles/Cohorts.html | 255 ++++++++++++++++ docs/articles/DataSources.html | 251 +++++++++++++++ docs/articles/EvidenceSynthesis.html | 238 +++++++++++++++ docs/articles/Prediction.html | 241 +++++++++++++++ docs/articles/SelfControlledCaseSeries.html | 323 ++++++++++++++++++++ docs/articles/index.html | 44 ++- docs/pkgdown.yml | 2 +- 12 files changed, 2214 insertions(+), 32 deletions(-) create mode 100644 docs/articles/Characterization.html create mode 100644 docs/articles/CohortDiagnostics.html create mode 100644 docs/articles/CohortMethod.html create mode 100644 docs/articles/Cohorts.html create mode 100644 docs/articles/DataSources.html create mode 100644 docs/articles/EvidenceSynthesis.html create mode 100644 docs/articles/Prediction.html create mode 100644 docs/articles/SelfControlledCaseSeries.html diff --git a/_pkgdown.yml b/_pkgdown.yml index bb3e103e..feae8394 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -62,7 +62,7 @@ reference: Modules for viewing self controlled case series results. contents: - sccsHelperFile - - sccsViewer + - sccsView - sccsServer - title: "Prediction module" desc: > @@ -71,24 +71,24 @@ reference: - patientLevelPredictionHelperFile - patientLevelPredictionViewer - patientLevelPredictionServer - - patientLevelPredictionDiagnosticsServer - - patientLevelPredictionDiagnosticsViewer - - patientLevelPredictionDesignSummaryViewer - - patientLevelPredictionDesignSummaryServer - - patientLevelPredictionModelSummaryViewer - - patientLevelPredictionModelSummaryServer - - patientLevelPredictionSettingsViewer - - patientLevelPredictionSettingsServer + - patientLevelPredictionCalibrationViewer + - patientLevelPredictionCalibrationServer - patientLevelPredictionCovariateSummaryViewer - patientLevelPredictionCovariateSummaryServer - patientLevelPredictionCutoffViewer - patientLevelPredictionCutoffServer + - patientLevelPredictionDesignSummaryViewer + - patientLevelPredictionDesignSummaryServer + - patientLevelPredictionDiagnosticsServer + - patientLevelPredictionDiagnosticsViewer - patientLevelPredictionDiscriminationViewer - patientLevelPredictionDiscriminationServer - - patientLevelPredictionCalibrationViewer - - patientLevelPredictionCalibrationServer + - patientLevelPredictionModelSummaryViewer + - patientLevelPredictionModelSummaryServer - patientLevelPredictionNbViewer - patientLevelPredictionNbServer + - patientLevelPredictionSettingsViewer + - patientLevelPredictionSettingsServer - patientLevelPredictionValidationViewer - patientLevelPredictionValidationServer - title: "Decription module" @@ -128,8 +128,6 @@ reference: - cohortMethodCovariateBalanceServer - cohortMethodDiagnosticsSummaryViewer - cohortMethodDiagnosticsSummaryServer - - cohortMethodForestPlotViewer - - cohortMethodForestPlotServer - cohortMethodKaplanMeierViewer - cohortMethodKaplanMeierServer - cohortMethodPopulationCharacteristicsViewer @@ -140,8 +138,8 @@ reference: - cohortMethodPropensityModelServer - cohortMethodPropensityScoreDistViewer - cohortMethodPropensityScoreDistServer - - cohortMethodResultSummaryTableViewer - - cohortMethodResultSummaryTableServer + - cohortMethodResultSummaryViewer + - cohortMethodResultSummaryServer - cohortMethodSystematicErrorViewer - cohortMethodSystematicErrorServer - title: "Data diagnostics module" @@ -186,7 +184,7 @@ reference: Modules for the component functions shared across modules. contents: - createCustomColDefList - - createLargeSqlQuery + - createLargeSqlQueryDt - LargeDataTable - largeTableView - largeTableServer @@ -218,4 +216,4 @@ reference: contents: - phevaluatorHelperFile - phevaluatorServer - - phevaluatorViewer \ No newline at end of file + - phevaluatorViewer diff --git a/docs/articles/AddingShinyModules.html b/docs/articles/AddingShinyModules.html index 92b0fbdb..372f0775 100644 --- a/docs/articles/AddingShinyModules.html +++ b/docs/articles/AddingShinyModules.html @@ -33,7 +33,7 @@ OhdsiShinyModules - 1.0.2 + 2.1.3.9000
    @@ -61,6 +61,30 @@
  • Adding Shiny Modules
  • +
  • + Characterization +
  • +
  • + Cohort Diagnostics +
  • +
  • + Cohort Method (Estimation) +
  • +
  • + Cohorts +
  • +
  • + Data Sources +
  • +
  • + Evidence Synthesis (Meta, Meta Analysis) +
  • +
  • + Prediction +
  • +
  • + Self-Controlled Case Series +
  • @@ -69,7 +93,7 @@
  • diff --git a/docs/reference/cohortDefinitionsView.html b/docs/reference/cohortDefinitionsView.html index f503f519..f6b6d355 100644 --- a/docs/reference/cohortDefinitionsView.html +++ b/docs/reference/cohortDefinitionsView.html @@ -17,7 +17,7 @@ OhdsiShinyModules - 1.0.2 + 2.1.3.9000 @@ -43,12 +43,36 @@
  • Changelog
  • @@ -69,7 +93,7 @@