library(SqlRender) knitr::opts_chunk$set( cache = FALSE, comment = "#>", error = FALSE, tidy = FALSE )
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.
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.
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 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.
After this you can follow the RStudio prompts to upload to your rsconnect/posit connect or shinyapps.io server.
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.
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.
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).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.