Viewing the diagnostics

The Diagnostics Explorer shiny application is able to present the results output of Cohort Diagnostics in either local mode (i.e. using premerged file) or database mode (connected to postgres database server). The Shiny app can be found here. Make sure to copy all files in the DiagnosticsExplorer folder. When launching the application. You maybe asked to install additional packages required by the app, such as shiny, shinydashboard, shinyWidgets, DT, htmltools, scales, plotly, dplyr, purrr, tidyr, ggiraph.

The Diagnostics Explorer Shiny app
The Diagnostics Explorer Shiny app

Note that each of the tabs on the left has an information icon. Clicking on these icons will show additional information on each diagnostic, how they were computed, and how they may be interpreted.

Launching Diagnostics Explorer

  • From R, launch the DiagnosticExplorer shiny application by calling the ‘launchDiagnosticsExplorer()’ function of CohortDiagnostics.
  • From R-studio, you may start the project by clicking on the ‘DiagnosticsExplorer.Rproj’ in the shiny folder, then open the global.R and press the ‘RunApp’ button. From R-server (shiny server), you will need to copy all the files in the DiagnosticsExplorer shiny app into a folder on the server. The server should automatically launch the application (please talk to the shiny server administrator for your site specific rules.)

Running the app using local file mode (Sqlite db).

Local mode is the most common mode to run the Shiny application. We recommend that you convert all the csv files that are the precomputed output of Cohort Diagnostics into an sqlite database file as follows

createMergedResultsFile("C:/temp/allZipFiles", sqliteDbPath = "MyCohortDiagnosticsResulst.sqlite")

.RData files enables faster load of the Shiny application. Once you have converted your results data into an sqlite database file, you may launch the Diagnostics Explorer app as follows:

launchDiagnosticsExplorer(sqliteDbPath = "MyCohortDiagnosticsResulst.sqlite")

If running the application from a R-studio environment, please make sure the sqlite file is in a folder called ‘data’.

Publishing to Posit Connect or shinyapps.io

Publishing the shiny app to a shared posit connect source can be achieved by first setting up credentials for your server. You will need to contact your internal administrator for publishing and access rights.

Alternatively, you can use the shinyapps.io service, which provides some limited free usage for hosting your applications.

Firstly, it is advised that you update to the latest version of OHDSI shiny modules with:

remotes::install_packages('OHDSI/OhdsiShinyModules')

This will update the dependencies for your shiny app.

Following this you will need a copyable resource for your shiny app. This can be achieved by launching the DiagnosticsExplorer with publishable options

launchDiagnosticsExplorer(
  sqliteDbPath = "MyCohortDiagnosticsResulst.sqlite",
  makePublishable = TRUE,
  publishDir = file.path(getwd(), "MyStudyDiagnosticsExplorer"),
  overwritePublishDir = TRUE
)

This will create a shiny app folder "MyStudyDiagnosticsExplorer" in your R working directory. The above will also overwrite the existing application folder and copy your sqlite file in to it. Following this, the shiny window should load and show a “publsh” button.

Publish button
Publish button

After this you can follow the RStudio prompts to upload to your rsconnect/posit connect or shinyapps.io server.

Sharing a zipped copy of your shiny app

To automatically create a zip archive containing the DiagnosticsExplorer shiny application for deployment on shared environments, such as data.ohdsi.org, run the function createDiagnosticsExplorerZip:

createDiagnosticsExplorerZip(outputZipfile = "MyCdProject.zip", sqliteDbPath = "MyCohortDiagnosticsResulst.sqlite")

This archive will contain a fully executable shiny application.

Running the app using Database mode

We recommend the use of a database system, when file size of the cohort diagnostics output becomes large e.g. > 100mb, as using the sqlite database may leading sluggish performance. Currently, only postgres server is fully supported, though platforms with DatabaseConnector support may work (currently experimental). See Vignette on Database mode on how to load data into remote database.

Running over the network

If you want to run the application over the network then set runOverNetwork = TRUE while launching the application using ‘launchDiagnosticsExplorer()’. This will make the shiny application available over your network (i.e. within your networks firewall).