Reproducing the R Submissions Pilot 2 Shiny Application using Rhino

A short blog post about a Rhino pilot submission.
Submissions
Community
Authors

Ismael Rodriguez

Vedha Viyash

André Veríssimo

APPSILON

Published

October 10, 2023

There is significant momentum in driving the adoption of R packages in the life sciences industries, in particular, the R Consortium Submissions Working Group is dedicated to promoting the use of R for regulatory submissions to the FDA.

The R Consortium Submissions Working Group successfully completed an R-based submission in November 2021 through the eCTD portal (R Submissions Pilot 1). This Pilot was completed on March 10, 2022 after a successful statistical review and evaluation by the FDA staff.

Moving forward, the Pilot 2 aimed to include a Shiny application that the FDA staff could deploy on their own servers. The R Consortium recently announced that on September 27, 2023, the R Submissions Working Group successfully completed the follow-up to the Pilot 2 R Shiny-based submission and received a response letter from FDA CDER. This marks the first publicly available submission package that includes a Shiny component. The full FDA response letter can be found here.

The Shiny application that was sent for the Pilot 2 had the goal to display the 4 Tables, Listings and Figures (TLFs) that were sent for the Pilot 1 with basic filtering functionality. 

The submission package adhered to the eCTD folder structure and contained 5 deliverables. Among the deliverables was the proprietary R package {pilot2wrappers}, which enables the execution of the Shiny application. 

The FDA staff were expected to receive the electronic submission packages in the eCTD format, install and load open-source R packages used as dependencies in the included Shiny application, reconstruct and load the submitted Shiny application, and communicate potential improvements in writing. 

In the following stage, the R Consortium’s R Submission Working Group launched Pilot 4, aiming to investigate innovative technologies like Linux containers and web assembly. These technologies are being explored to package a Shiny application into a self-contained unit, streamlining the transfer and execution processes for the application.

In this post, our aim is to outline how we used the Rhino framework to reproduce the Shiny application that was successfully submitted to the FDA for the Pilot 2 project. Additionally, we detail the challenges identified during the process and how we were able to successfully address them by using an open-source package.

Reproducing the R Submission Pilot 2 Shiny App using Rhino

While the original Shiny application submitted to the FDA was wrapped using {Golem}, we replicated the application using our in-house developed framework Rhino. The main motivation was to provide an example of an R Submission that is not an R package and to identify and solve any issues that may arise from this approach.

Our demo application (FDA-pilot-app) is accessible on our website, alongside other Shiny and Rhinoverse demonstration apps.

The code for FDA-pilot-app is open-source. You can create your own Rhino-based application by following our tutorial and viewing our workshop, which is available on YouTube

Brief Introduction to Rhino

The Rhino framework was developed by Appsilon to create enterprise-level Shiny applications, consistently and efficiently. This framework allows developers to apply the best software engineering practices, modularize code, test it thoroughly, enhance UI aesthetics, and monitor user adoption effectively.

Rhino provides support in 3 main areas:

  1. Clear Code: scalable architecture, modularization based on Box and Shiny modules.

  2. Quality: comprehensive testing such as unit tests, E2E tests with Cypress and Shinytest2, logging, monitoring and linting.

  3. Automation: project startup, CI with GitHub Actions, dependencies management with {renv}, configuration management with config, Sass and JavaScript bundling with ES6 support via Node.js.

Rhino is an ideal fit for highly regulated environments such as regulatory submissions or other drug development processes.

FDA-pilot-app structure

The structure of this application is available on the github repository. The structure of this Shiny app is the following.

.
├── app
│   ├── view
│   │   └── demographic_table.R
|   |   └── km_plot.R
|   |   └── primary_table.R
|   |   └── efficacy_table.R
|   |   └── completion_table.R
│   ├── logic
│   │   └── adam_data.R
│   │   └── eff_modles.R
│   │   └── formatters.R
│   │   └── helpers.R
│   │   └── kmplot_helpers.R
│   │   └── Tplyr_helpers.R
│   ├── data
│   │   └── adam
│   │       └── adadas.xpt
│   │       └── adlbc.xpt
│   │       └── adsl.xpt
│   │       └── adtte.xpt
│   ├── docs
│   │   └── about.md
│   ├── js
│   │   └── index.js
│   ├── static
│   │   └── favicon.ico
│   ├── styles
│   │   └── main.scss
│   └── app.R
├── tests
│   ├── cypress
│   │   └── integration
│   │       └── app.spec.js
│   ├── testthat
│   │
│   └── cypress.json
├── app.R
├── rhino_submission.Rproj
├── dependencies.R
├── renv.lock
├── rhino.yml
└── README.md

Efficient Submissions to the FDA

To comply with the Electronic Submission File Formats and Specifications for the eCTD submission, the programming code should carry a “.txt” extension. In the R Submissions Pilot 3 the group did not use {pkglite} as the FDA clarified that “.zip” and “.r” files are acceptable for submission. In this case, we utilized the {pkglite} R package to efficiently pack and unpack the FDA-pilot-app. This approach would facilitate the FDA reviewers in setting up the submission on their systems.

This package allows packing R packages to “.txt” files, which are supported for the submission of proprietary packages to the FDA via the eCTD gateway. 

Packing the FDA-pilot-app into a .txt file

The code below can be used to pack the Shiny application into a .txt file:

app_name <- "rhinosubmission"
renv_spec <- pkglite::file_spec(
  "renv",
  pattern = "^settings\\.dcf$|^activate\\.R$",
  format = "text", recursive = FALSE
)
tests_spec <- pkglite::file_tests()
app_spec <- pkglite::file_auto("app")
root_spec <- pkglite::file_spec(
  path = ".",
  pattern = "^\\.Rprofile$|^rhino\\.yml$|^renv\\.lock$|^dependencies\\.R$|^config\\.yml$|^app\\.R$|^README\\.md$|\\.Rproj$",
  all_files = TRUE,
  recursive = FALSE
)
write(paste0("Package: ", app_name), "DESCRIPTION", append = TRUE)
pkglite::collate(
  getwd(),
  renv_spec,
  tests_spec,
  app_spec,
  root_spec
) |> pkglite::pack()
file.remove("DESCRIPTION")

Unpacking the FDA-pilot-app

The packed “.txt” file can be unpacked into a Shiny app by using {pkglite} as follows:

pkglite::unpack("rhinosubmission.txt")

Lessons Learned

Our initial objective was to prove that it would be possible to submit a Shiny application using Rhino through the eCTD gateway. During the rewriting process we identified that this could be done by integrating the open-source {pkglite} package. By following this approach, we concluded that it would be possible to submit a Shiny application through the eCTD gateway. This was also achieved through the successful submission of a package that included a Shiny component in Pilot 2.

Having rewritten the R Submissions Pilot 2 Shiny application using Rhino holds major implications for the adoption of our framework within the life sciences. Apart from being a strong, opinionated framework that improves reproducibility and reliability for Shiny development, using Rhino for regulatory submissions could improve the flexibility and speed in the clinical reporting pipeline. This would accelerate the adoption of R/Shiny for submissions to the FDA or other regulatory agencies. 

Rhino for Life Sciences

Rhino, a powerful framework built on R and Shiny, facilitates the development of FDA-compliant applications in the life sciences. With its comprehensive toolset, Rhino simplifies the development process by offering secure data management, audit trails, version control, and robust validation capabilities. These features ensure that applications meet the rigorous requirements of regulatory agencies.

References

Zhao, Y., Xiao, N., Anderson, K., & Zhang, Y. (2023). Electronic common technical document submission with analysis using R. Clinical Trials, 20(1), 89--92. https://doi.org/10.1177/17407745221123244

Last updated

2024-11-15 19:41:24.156343

Details

Reuse

Citation

BibTeX citation:
@online{rodriguez2023,
  author = {Rodriguez, Ismael and Viyash, Vedha and Veríssimo, André and
    , APPSILON},
  title = {Reproducing the {R} {Submissions} {Pilot} 2 {Shiny}
    {Application} Using {Rhino}},
  date = {2023-10-10},
  url = {https://pharmaverse.github.io/blog/posts/2023-08-14_rhino_submission_2/rhino_submission_2.html},
  langid = {en}
}
For attribution, please cite this work as:
Rodriguez, Ismael, Vedha Viyash, André Veríssimo, and APPSILON. 2023. “Reproducing the R Submissions Pilot 2 Shiny Application Using Rhino.” October 10, 2023. https://pharmaverse.github.io/blog/posts/2023-08-14_rhino_submission_2/rhino_submission_2.html.