Advancing FDA Clinical Trial Submissions with R: Reproducing the R Submissions Pilot 2 Shiny App Using Rhino

Reading time:
time
min
By:
Vedha Viyash
July 13, 2023

<h2>A Brief Overview of the RConsortium Submissions Working Group</h2>
The <a href="https://www.r-consortium.org/" target="_blank" rel="noopener">RConsortium</a> Submissions working group is dedicated to promoting the use of <strong>R in the life science industry</strong>, particularly in <strong>FDA submissions</strong>. RConsortium’s mission is centered around creating example R-based submissions for various scenarios, <strong>demonstrating the potential of R and Shiny apps for clinical trial data</strong> analysis and visualization.

<video width="100%" height="auto" src="https://wordpress.appsilon.com/wp-content/uploads/2023/07/rhino_fda_pilot_r_shiny_app_e-ctd.webm" loop="true" autoplay="true" controls="true"></video>
<h2>Importance of R in the Life Science Industry and FDA Submissions</h2>
R has been gaining traction in the life science industry, emerging as a powerful alternative to traditional tools like SAS for data analysis, visualization, and statistical modeling. Historically, the pharmaceutical industry has heavily relied on SAS. However, R's open-source nature provides significant advantages in terms of reproducibility and accessibility. 

The efforts of the RConsortium working group in showcasing R-based submissions not only emphasize the potential of R but also highlight the possibility of revolutionizing the management and submission of clinical trial data. This, in turn, fosters a more collaborative and transparent environment within the industry.
<h2>RConsortium Submissions Working Group Pilots</h2>
<h3>Background of the Pilots</h3>
The RConsortium working group has initiated several pilots aimed at demonstrating the capabilities of R and Shiny apps in various FDA submission scenarios.
<h3>Overview of Pilot 1, 2, 3, and 4</h3>
Pilot 1 focused on showcasing an R-based submission containing common analyses within the current FDA e-submission system and process.

Pilot 2 expanded upon Pilot 1 by including a Shiny app developed using the {golem} framework, and was also submitted through the FDA e-submission system and process.

Pilots 3 and 4 are currently ongoing, with the aim of further demonstrating the potential of R in various submission scenarios.
<h3>Achievements of Pilot 1 and Pilot 2</h3>
The successful completion of Pilot 1 and Pilot 2 has demonstrated the potential of R and Shiny apps in the context of FDA submissions, paving the way for wider adoption of R in the life science industry.
<h2>Pilot 2 App Technical Deep-Dive</h2>
The “<a href="https://github.com/RConsortium/submissions-pilot2" target="_blank" rel="noopener">submissions-pilot2 repository</a>” was used for the development of the Shiny app in the Pilot 2 submission, while the “<a href="https://github.com/RConsortium/submissions-pilot2-to-fda" target="_blank" rel="noopener">submissions-pilot2-to-fda</a>” repository contained the files for the eCTD submission.

The Shiny app is built using the <a href="https://github.com/insightsengineering/teal" target="_blank" rel="noopener">teal</a> package with six teal modules:
<ol><li style="list-style-type: none;"><ol><li style="font-weight: 400;" aria-level="1">`App Information` - Render the `about.md` markdown to display some information about the app. Rendered using `shiny::includeMarkdown()`</li><li style="font-weight: 400;" aria-level="1">`Demographic Table` - A table with summary statistics associated with baseline clinical characteristics and other demographic factors is shown. Built using <a href="https://github.com/insightsengineering/rtables" target="_blank" rel="noopener">rtables</a>.</li><li style="font-weight: 400;" aria-level="1">`KM-Plot for TTDE` - A Kaplan-Meier (KM) plot of the Time to First Dermatologic Event (TTDE) with strata defined by treatment group is displayed along with an informative risk set table across time. Built using the packages <a href="https://github.com/openpharma/visR" target="_blank" rel="noopener">visR</a>, and <a href="https://github.com/wilkelab/cowplot" target="_blank" rel="noopener">cowplot</a>.</li><li style="font-weight: 400;" aria-level="1">`Primary Table` - A summary table of the primary efficacy analysis is shown for each of the time points of assessment (baseline and week 24) comparing each treatment group. The primary efficacy variable (change from baseline in ADAS Cog (11)) was analyzed using an Analysis of Covariance (ANCOVA) model with treatment and baseline value as covariates, comparing Placebo to Xanomeline High Dose. Built using <a href="https://github.com/atorus-research/Tplyr" target="_blank" rel="noopener">Tplyr</a>, and <a href="https://github.com/hughjonesd/huxtable" target="_blank" rel="noopener">huxtable</a>.</li><li style="font-weight: 400;" aria-level="1">`Efficacy Table` - A summary table of an additional efficacy analysis is shown for baseline and week 20. The efficacy variable (Glucose) was analyzed using ANCOVA model with treatment and baseline value as covariates, comparing Placebo to Xanomeline High Dose. Built using <a href="https://github.com/glin/reactable" target="_blank" rel="noopener">reactable</a>.</li><li style="font-weight: 400;" aria-level="1">`Visit Completion Table` - A summary table of the number of patients remaining in the treatment period for each scheduled visit from baseline to week 24. Built using <a href="https://github.com/hughjonesd/huxtable" target="_blank" rel="noopener">huxtable</a>.</li></ol>
</li>
</ol>
The teal app is wrapped using the <a href="https://github.com/ThinkR-open/golem" target="_blank" rel="noopener">golem</a> framework. Additionally, the <a href="https://github.com/rstudio/renv" target="_blank" rel="noopener">renv</a> package is employed to create a <b>r</b>eproducible <b>env</b>ironment of R packages for the Shiny app.

To comply with the <a href="https://www.fda.gov/files/medical%20devices/published/Tobacco-Electronic-Submission-File-Formats-and-Specifications.pdf" target="_blank" rel="noopener">Electronic Submission File Formats and Specifications</a> for the eCTD submission, it is crucial that the programming code has a ‘.TXT’ extension. Consequently, the Shiny app files are converted into ‘.TXT’ format using the <a href="https://github.com/Merck/pkglite/" target="_blank" rel="noopener">pkglite</a> package. Detailed documentation on this process can be found in the <a href="https://github.com/RConsortium/submissions-pilot2/blob/main/vignettes/adrg-prepare.Rmd" target="_blank" rel="noopener">adrg-prepare.Rmd vignette</a>, providing step-by-step instructions for meeting this requirement.

<a href="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ae8923c12912d3dffbb_Rhino-FDA-eCTD-Shiny-app-rewrite-svg.svg"><img class="aligncenter size-medium wp-image-19982" src="https://webflow-prod-assets.s3.amazonaws.com/6525256482c9e9a06c7a9d3c%2F65b01ae8923c12912d3dffbb_Rhino-FDA-eCTD-Shiny-app-rewrite-svg.svg" alt="Rhino FDA eCTD Shiny app rewrite" width="500" height="300" /></a>

&nbsp;

&nbsp;

&nbsp;
<h2>Rewriting the Pilot 2 App Using the {Rhino} Framework</h2>
<h3>Introducing Rhino</h3>
The <a href="https://appsilon.github.io/rhino/" target="_blank" rel="noopener">Rhino framework</a> was developed by Appsilon to create enterprise-level Shiny applications. It allows developers to apply the best software engineering practices, modularize code, test it well, make UI beautiful and to track user adoption.

Rhino provides support in 3 main areas:
<ol><li style="list-style-type: none;"><ol><li style="font-weight: 400;" aria-level="1"><b>Clear code</b>: scalable architecture, modularization based on Box and Shiny modules.</li><li style="font-weight: 400;" aria-level="1"><b>Quality</b>: comprehensive testing such as unit tests, E2E tests with Cypress, logging and monitoring and linting.</li><li style="font-weight: 400;" aria-level="1"><b>Automation</b>: project startup, CI with GitHub Actions, dependencies management with {<a href="https://github.com/rstudio/renv" target="_blank" rel="noopener">Renv</a>}, configuration management with config, Sass and JavaScript bundling with ES6 support via Node.js.</li></ol>
</li>
</ol>
The Rhino framework is exceptionally well-suited for highly regulated environments, particularly those involved in regulatory submissions and drug development processes. Its capabilities align with the needs of these industries, ensuring compliance and streamlining the development of Shiny applications. While there are other projects aimed at improving the structure of Shiny applications, exploring the <a href="https://appsilon.github.io/rhino/" target="_blank" rel="noopener">Rhino documentation</a> will provide insights into how Rhino differentiates itself from these alternatives.
<h3>The motivation behind rewriting the app with Rhino</h3>
The motivation for selecting the Rhino framework to rewrite the Pilot 2 app was to offer an example of a Shiny app submission that is not an R package. Our <a href="https://connect.appsilon.com/rhino-fda-pilot/" target="_blank" rel="noopener">FDA pilot app</a> can be found on our <a href="https://demo.appsilon.com/" target="_blank" rel="noopener">Appsilon R Shiny Demo Gallery</a>, providing a practical demonstration of the capabilities and advantages of a Rhino app.
<h3>Learnings from the Rewrite Process</h3>
During the rewriting process, a technical solution was developed to submit the non-R package Shiny app using the Rhino framework. This involved creating a simple DESCRIPTION file with just a package name. The `pkglite::pack()` function was utilized to pack the Shiny app into a text file suitable for submission through the eCTD gateway. This approach simulated the same submission approach used for the Pilot 2 app.
<h2>Broader Implications of Rhino, R Programming, and Clinical Trials</h2>
The successful rewriting of the Pilot 2 app using the Rhino framework holds significant potential for Shiny users in the life science industry. If accepted by the FDA, this achievement could have far-reaching implications, demonstrating the feasibility of submitting plain R code and Shiny apps without the need to wrap them into R packages. 

Such flexibility in the submission process would promote the wider adoption of R within the industry, particularly for regulatory submissions, fostering innovation and streamlining regulatory procedures.
<h2>Future Collaboration</h2>
Global consumers benefit from having access to safe and advanced pharmaceutical systems. The United States FDA’s Center for Drug evaluation and Research is one of the more advanced and stringent consumer watchdogs. 

R programming and Shiny applications are advancing in the pharmaceutical and biotechnology industries. The enormous amounts of data generated from clinical trials alone, requires tools like R for analysis and Shiny for automation, web deployment, end-user efficiency and more.

With the successful FDA Pilot 2 submission by the RConsortium, Shiny has proven itself capable of holding up to the needs and requirements that policy demands. With the Rhino FDA Pilot rewrite, R developers have an open source tool for the software engineering practices and development tools that meet software industry standards.
<h3>Achieve Results with Appsilon</h3>
Appsilon is a renowned technology consulting company specializing in advanced analytics and custom software development for Fortune 500s and Life Science teams. With their expertise in R programming and Shiny applications, Appsilon can assist pharmaceutical and biotechnology companies in building robust and compliant systems.
<h3>Appsilon Team - Domain Expertise and Data Science Solutions</h3>
Appsilon's team of experienced data scientists and software engineers can collaborate with clients to design and develop tailored solutions that meet their specific project needs. Whether it's creating interactive data dashboards, automating regulatory reporting processes, or implementing advanced analytics algorithms, Appsilon has the knowledge and skills to deliver high-quality and compliant solutions.
<h3>Rhino and the Life Sciences</h3>
The Rhino framework, built on top of R and Shiny, provides a comprehensive set of tools and functionalities that simplify the development of FDA-compliant applications. It offers features such as secure data management, audit trails, version control, and robust validation capabilities, ensuring that the developed systems meet the stringent requirements of regulatory agencies.

By leveraging Appsilon services or utilizing appropriate open source packages, organizations can navigate the complex landscape of engineering and industry compliance in the pharmaceutical sector. These solutions enable the development of reliable, secure, and compliant applications that adhere to the standards set by regulatory agencies like the FDA or EMA. 

With Appsilon's expertise and the Rhino framework, organizations can confidently pursue their projects, knowing that they are equipped with the necessary tools and support to achieve solid engineering and industry compliance.

Learn, engage, and create an impact with R, Shiny, Rhino, and more:
<ul><li style="list-style-type: none;"><ul><li><a href="https://appsilon.com/gxp-compliance-in-pharma-made-easier-good-documentation-practices-with-r-markdown-and-officedown/" target="_blank" rel="noopener">GxP Compliance in Pharma: Documentation in R Markdown</a></li><li><a href="https://appsilon.com/pharmaceutical-and-clinical-trial-data-analysis-packages/" target="_blank" rel="noopener">R Packages for Clinical Trial Data</a></li><li><a href="https://appsilon.com/automating-end-to-end-cypress-tests-in-rhino-a-guide-to-seamless-ui-testing-for-shiny-apps/" target="_blank" rel="noopener">Automating End-to-End Cypress Tests in Rhino</a></li><li><a href="https://appsilon.com/shiny-molstar-r-package-molecular-structures-visualizations/" target="_blank" rel="noopener">A New Era in Molecular Visualization in R: shiny.molstar</a></li><li><a href="https://appsilon.com/gosling-r-shiny/" target="_blank" rel="noopener">Interactive Genomics Charts in R Shiny: shiny.gosling</a></li></ul>
</li>
</ul>
Ready to move from analysis to action? <a href="https://casestudies.appsilon.com/" target="_blank" rel="noopener">Explore Appsilon's case studies in the life sciences</a>.

Have questions or insights?

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

Is Your Software GxP Compliant?

Download a checklist designed for clinical managers in data departments to make sure that software meets requirements for FDA and EMA submissions.
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
shiny
open source
pharma
rhino
r