Shiny Gatherings x Pharmaverse: Building Clinical Data Analysis Apps with {teal}

Reading time:
time
min
By:
Gift Kenneth
October 29, 2024

In this edition of Shiny Gatherings x Pharmaverse, we were thrilled to welcome Nina and Dony, Principal Data Scientists at Genentech, for an insightful session on building clinical data analysis apps using the {teal} framework. 

Explore how {teal} and {pharmaverseadam} simplify clinical dashboards for faster insights. Learn how these tools streamline data management so you can focus on what matters.

Both Nina and Dony shared their experiences in R and open-source development in the pharmaverse and walked us through {teal}, an R/Shiny-based framework designed to simplify data exploration in clinical research and beyond. Here’s a summary of the session, including key demos and takeaways.

Watch the Video: 

What is {teal}?

{teal} is an open-source, scalable R/Shiny framework developed by Roche and Genentech and later made open-source to facilitate interactive data exploration. While primarily created to support clinical trial analysis,{teal} is robust enough to also handle a wide range of general data exploration use cases.

Some key features of {teal} include:

  • Dynamic filtering for tailored data exploration
  • *Code reproducibility via built-in code generation
  • *Report generation with easy export options
  • Modular framework to enhance reusability

*When supported by the module.

How {teal} Works: Anatomy of a {teal} App

Nina introduced the basic structure of a {teal} app, walking attendees through the anatomy of the app's components:

  1. Header: Customized by the developer to show app titles or navigation links.
  2. Filter Panel: Enables dynamic filtering of datasets, giving users flexibility to explore subsets of the data.
  3. Encoding Panel: Allows users to configure and modify how variables are analyzed and visualized.
  4. Output Panel: Displays the results (tables, plots) based on user selections.
  5. Show R Code Feature: Provides the exact R code used to generate the outputs, aiding reproducibility.
  6. Reporter Module: Lets users generate and download custom reports based on their analysis.

The {teal} framework offers modular building blocks through R packages like {teal.slice}, {teal.reporter}, and {teal.widgets}, allowing users to create feature-rich, interactive data apps with minimal effort.

Creating a Custom {teal} Module: Dony’s Workshop

Dony’s segment focused on developing a custom {teal} module to demonstrate the power of the framework. He shared code templates and explained key concepts step-by-step.

Shiny Gatherings x Pharmaverse: Building Clinical Data Analysis Apps with {teal} 

Step-by-Step: Custom {teal} Module

Here’s a quick rundown of what Dony demonstrated during the webinar: 

  1. Initializing a {teal} App:
  • The app requires three key elements: init(), data, and modules.
  • Users must define a {teal_data} object to specify which datasets to load.
    Example datasets like iris and mtcars were used for illustration.

  1. Building a Simple App:
  • Dony showcased how to load data into a {teal} app and display it in a data table.
  • He added dynamic filtering to allow users to explore datasets interactively.
  1. Enhancing the App with a Plot Module:
  • A histogram plot was introduced to visualize continuous variables.
  • Using input() functions, users could switch between datasets and adjust bin widths for the histogram interactively.
  1. Enabling Code Reproducibility:
  • Dony demonstrated the Show R Code feature by integrating a button that allows users to see and copy the exact code used to generate their analysis.
  • This feature ensures transparency and reproducibility across projects.
  1. Generating Reports with {teal.reporter}:
  • Dony walked through the reporting module, allowing users to save outputs in R Markdown or PNG formats.
  • He added custom filters to the report and showed how to include relevant plots and code snippets.
Catch up on Shiny Gatherings #8 with Paweł Rucki to see how {teal} drives pharma innovation. Explore key insights and its impact on clinical data management.

What’s New With Teal  

Nina concluded the session by providing insights into upcoming updates and enhancements for {teal}:

  • Teal Gallery: A collection of {teal} apps showcasing different modules and their use cases.
  • teal_transform_module(): Enables users to transform data within the app interface, extending module behavior with custom operations applied during load and data updates.
  • UI/UX Improvements: The team is working on a visual overhaul to make apps more intuitive.
  • Cross-industry Collaboration: {teal} is expanding through partnerships, working on new modules and enhancements.

Nina also invited attendees to explore the {teal} roadmap on GitHub, where they can track the progress of new features and contribute to the project.

Summing Building Clinical Data Apps with teal

The Shiny Gathering offered a deep dive into the capabilities of the {teal} framework, highlighting its potential for simplifying clinical data analysis while ensuring reproducibility and interactivity. 

Whether you're a seasoned R user or new to Shiny, {teal} provides a robust platform for building analytical applications that meet the evolving needs of the healthcare and pharmaceutical industries.

Be sure to explore {teal} and start building your own custom modules!

Tickets are still available for our GxP Validation Summit which is now fully online and free! Learn more and sign up today using this link.

Resources

Have questions or insights?

Engage with experts, share ideas and take your data journey to the next level!

Sign up for ShinyWeekly

Join 4,2k explorers and get the Shiny Weekly Newsletter into your mailbox
for the latest in R/Shiny and Data Science.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Explore Possibilities

Share Your Data Goals with Us

From advanced analytics to platform development and pharma consulting, we craft solutions tailored to your needs.

Talk to our Experts
pharmaverse
pharma