Skip to content

SAFEHR-data/omopcat

Repository files navigation

omopcat

Lifecycle: experimental R-CMD-check codecov

The omopcat web app provides an interactive dashboard to display a catalogue of available OMOP data. It enables users to interactively explore available OMOP concepts by showing useful summary statistics and subsequently export a selection of concepts of interest.

Overview

  1. Installation
  2. Usage
  3. Deployment
  4. Developer instructions

Installation

The data catalogue consists of 2 separate R packages:

  • omopcat defines the Shiny app to display the catalogue
  • omopcat.preprocessing contains the functionality to summarise an OMOP data source to use as input for the app

The source for these is contained in the app/ and preprocessing/ directories, respectively.

You can install the development version of these packages from within R like so:

install.packages("remotes")
usethis::create_github_token()
credentials::set_github_pat()

remotes::install_github("SAFEHR-data/omopcat/app") # omopcat
remotes::install_github("SAFEHR-data/omopcat/preprocessing") # omopcat.preprocessing

You will need to copy the PAT from the web page that usethis::create_github_token opens and paste it into the input that credentials::set_github_pat provides.

Usage

Once the app is installed, you can run it locally with

library(omopcat)
run_app()

By default, this will run the app in dev mode and use a small dummy data set to host the app (see the wiki for more details).

To run the app in production mode, set the GOLEM_CONFIG_ACTIVE environment variable to production. From within R this can be done by

library(omopcat)
Sys.setenv(GOLEM_CONFIG_ACTIVE = "production")
run_app()

or by setting it in a local .Renviron file.

Note that running the app locally in production mode should only be done for testing purposes. To run a truly productionised version, we provide a containerised deployment.

Deploying with Docker

We provide a Docker container and docker-compose configuration to run the app in a production environment.

Configure environment variables

Copy the .env.sample file to .env and fill out the required values

cp .env.sample .env

Pre-processing

The pre-processing pipeline can be run with the following command

docker compose run preprocess

This will generate the necessary files to run the omopcat app with and store them at the path defined by the DATA_VOLUME_PATH environment variable.

Running the app

To deploy a production version, using the data from data/prod_data (generated by the preprocess service), run

docker compose up -d omopcat

By default, the app will be hosted at http://localhost:3838.

Public version

Copy the public.env.sample to public.env and fill out the necessary environment variables.

Then run the pre-processing pipeline with

docker compose --env-file public.env run preprocess

and deploy the app with

docker compose --env-file public.env -p omopcat-public up -d omopcat