mattkumar / dynamic-tlf

Dynamic and Interactive Tables, Listings and Figures Contest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic-TLFS-contest

R Studio Table Contest 2022 Entry

About

This is my entry into the R Studio 2022 Table Contest. It uses Tplyr, reactable, shiny and Quarto to present an insights dashboard for clinical trial data analysis.

You may view it here.

Preview

Here is a preview of the dashboard. Click to view to a higher resolution video version.

Aims

My aims for this project were two-fold:

  1. Investigate whether we can dynamically create tables which can be used to guide an exploratory analysis.

    The analysis starts with an anchor table, where individual cells can be clicked to retrieve the study participants ID's who comprise it. These are subsequently fed into additional tables, listings and figures through reactives.

    In previous work, I've hard coded the anchor table by pre-specifying the variables to be displayed. With this work, you can now dynamically specify the anchor table to include any variables you like, which in turn can be used explore subgroups on-the-fly.

    This work is largely enabled by utilizing the metadata building features of the Tplyr package.

  2. Currently, no dashboard extension or package exists for Quarto. I used this opportunity to also see if I could (roughly) mimic what flexdashboard offers by using Quarto and custom css. My inspiration was the bootswatch lux theme.

Linked TLFs

The linked TLFs are also interactive and share the spirit of "drilling down" and exploration

Adverse Events Table

  • Uses reactable's groupBy to succinctly present a large table
  • Cells (in the second column) are hyper-linked to open a MedlinePlus search of that term. I found this resource was helpful in learning about medical conditions when analyzing clinical trials data.
  • A table-wide search functionality to pin-point certain SOCs/PTs of interest
  • A button to expand all SOCs at once to show the nested PTs

Adverse Event Figure

  • The highcharter column chart is a drill down plot. The first layer displays the top 4 System Organ Classes for a given subset
  • Clicking each of bars lets you drill down into a stacked column chart for the Preferred Terms x Severity
  • Customized tool tips to display information more clearly (i.e. severity of adverse event)
  • It's a visual representation of the adverse event linked table, but could be extended to show other data views too

Patient Listing 1

  • Uses reactable's filter + search to navigate a potentially exhaustive table
  • Leverages reactable's columnGroups + formatting to organize the data layout
  • Capable of exporting a list subject identifiers as a CSV file to enable further analyses of interesting subgroups

Patient Listing 2

  • Uses reactablefmtr's inline visual to show vital signs measured at three times relative to baseline (i.e. percent change)
  • Leverages reactable's columnGroups + formatting to organize the data layout
  • Paired with shiny inputs to enable switching of Blood Pressure Parameters and Visits

Code Organization

For this project, I've used renv so that you may recreate this in an offline setting.

While there are many ways to structure this dashboard, I chose not to experiment with modules and and keep things simple until a proper dashboard extension or framework for Quarto is released. I've instead isolated key parts of the code into their own server chunks with comments for ease of review.

Data

The data for this example comes from the TestDataFactory repository operated by phuse. This data is not stored in the app deployment or my code repository - it is accessed directly from the source repository.

Future

This app can be extended in a number of different ways:

  • Including additional, linked TLFs; the sky's the limit!
  • Uploading data functionality - the way I've began to structure the server will enable this in the future (i.e. using renderUI)
  • More robust organization, control and validation for when the anchor table is updated

About

Dynamic and Interactive Tables, Listings and Figures Contest

License:MIT License


Languages

Language:HTML 39.8%Language:JavaScript 38.5%Language:R 20.6%Language:SCSS 1.1%