gitShiny}: Creating a Shiny app as a tool for Learning Git

Blogs home Featured Image

Towards the start of my placement, I was introduced to Shiny apps: {shiny} is an R package which allows users to create applications directly within R. I knew that this was something I wanted to learn more about. Additionally, I was introduced to Git, a version control system which is a best practice within data science and software development. As a result, I started a personal project with the aim of creating a Shiny app as a tool for learning Git, its main target audience being new Graduates and Placement Students.

The project had two main goals: the first to create an app for learning how to use Git locally; the second to expand on this to include remote Git.

Goal 1: Local Git

To create the app as an R package, I decided to use the framework provided by the R package {golem}. Using this framework had many advantages including keeping track of dependencies and easy app modularisation. I used several other packages when creating the app, including {shinydashboard} to allow for a dashboard layout. The code for each page of the dashboard is contained within its own module, which means that the code is well organised and easy to read.

One challenge I faced was the development of a few UI features. Most of these were solved by using the package {shinyjs} which allows users to improve Shiny apps using JavaScript. I used this to hide and disable relevant action buttons and when creating a bottom navigation bar. This navigation bar is used to move between the pages of the dashboard. This proved difficult, but with the help of the open-source community I was able to resolve the issue, creating a key feature of the app’s UI.

After developing the first stage of the app, I gave a demonstration to data science colleagues who gave positive feedback, with ideas for the future development of the app. Once the first version of the app was complete, it was time to test it. I used the package {shinytest} to automate the testing via a snapshot-based testing strategy. Once the tests passed, I finally deployed the app using RStudio Connect, which allows users to access it via a URL. I also deployed it via shinyapps.io.

Following the completion of the first version of the app, I gave a presentation at the BarcelonaR conference, demonstrating the app and the code behind it. The code for this version can be found on GitHub along with smaller example apps.

Goal 2: Remote Git

The next, and major release, of the app continues the materials for learning Git both locally and remotely. It also includes a project designed to introduce the user to the concept of an Agile framework, as well as a practical scenario for using Git.

Moreover, I created a help page and took the opportunity to learn how to send emails from within a Shiny app. This was a successful learning exercise, however the main challenge that followed this was its maintenance. Eventually I removed this feature and instead created a help page that contains a number of Git references.

Towards the end of the development, I gave another demonstration to data science colleagues, receiving positive feedback. The app also received direct user testing from a new Graduate. Once some changes were made based on this feedback, I tested the app again using {shinytest}. Finally, I deployed this via RStudio Connect, ready to be used.

Results from the Project

I learnt a lot from this project, such as how to create a production grade Shiny app, best practices for using Git, and R package building. Moreover, the app will help users gain knowledge and experience of using Git for version control, specifically Graduates and Placement Students.

Since finishing the project, I have continued to expand my knowledge of the Shiny ecosystem by exploring code profiling, load balancing and load testing. {shiny} is an excellent package, allowing for flexibility and creativity.