Creating an exam archive system with a Data Scientist’s toolkit
By: Rahul Saxena
Tags: Students, Rstats, Exam Preparation, Covid 19, Data Science

With the rising uncertainty around the promotion criterion for university students in the midst of the COVID-19 pandemic, I decided to create a centralized platform to aggregate examination resources from the students themselves.

Motivation:

For any person, the daily updates of new cases and deaths related to COVID-19 is traumatic. University students, however, have to deal with a plethora of additional issues ranging from rescinded job offers to the uncertainty of getting promoted to the next semester. This has been a cause of rising anxiety among my batch mates too. So, this project is how I decided to do my part to help my batch mates as well as college mates.

Exposing R Shiny to uncharted territories:

I have recently been selected for a prestigious summer program by Google under the “R Project for Statistical Computing”. My project basically involves working on an R package that makes your R code more efficient. So, I thought that undertaking this project with R Shiny could expose me to some more optimization ideas for my summer project and hence I chose R Shinydashboard.

As you already might be aware that R Shiny is primarily used for creating dashboards and interactively communicating your findings, after data analysis, wrangling, manipulation, etc. My project, however, was a typical web development project with almost no element of working with data in it. Still, I went on ahead with it so that I may discover new optimization ideas for my summer fellowship project.

With this approach, I was bound to face many challenges, which I will be addressing in the next sections.

Coding Strategy:

Typically an R Shiny project is divided into two files, a ui.R file and a server.R file. However, a single file named app.R could also be used.

ui.R

In the side bar panel, I first enumerated all the expected features of this app including the ability to upload and download Question Papers, Solutions to those question papers and Class Notes. I also included the “shinyWidgets” library so that I could use “SweetAlert” upon successful upload of a file and also “downloadBttn” which provides more customization options compared to the default R Shiny “downloadButton” I used the fluidRow boxes to create several input fields to collect information about the paper being uploaded. I also used the “accept” parameter of the fileInput() function to accept only PDF files. I chose the icons from the “font awesome” website and used class = “fa-spin” for the “About” Section to draw attention to it.

Representational Code, for full code scroll down to conclusion

server.R

To persistently store the PDF files being uploaded, I had to use a workaround involving the “pdftools” library. After selecting the semester, I wanted the subject options to be only limited to the subjects of that semester. This was something that I achieved using a helper function and the req() function. After the successful uploading of a paper/notes etc, I wanted to send a Success Notification, which is something I achieved by including the “shinyWidgets” library and using observeEvent() code blocks. To initiate downloads from my local storage (my “www” folder), in the “downloadHandler”, I converted the filename parameter to a function and called that very function in the content parameter with file.copy() function.

Representational Code, for full code scroll down to the conclusion

Snippets of the completed app: