Analyst Approach to Scalable BizOps using RStudio
I'm deeply inspired by people at R-Studio, whose efforts make the Data Science community a much better place, and inspires people to do big things.
In 2018 I had the opportunity of having a word with J Cheng, CTO of Rstudio, on the possibilities of using Shiny for scalable web applications that bypasses developer requirements to analysts, statisticians, and especially research students.
This post revolves around creating R+Shiny webapps that are scalable enough to pass as full fledged applications.
Shiny is an R package that makes it easy to build interactive web apps straight from R. You can host standalone apps on a webpage or embed them in R Markdown documents or build dashboards.
You can also extend your Shiny apps with CSS themes, htmlwidgets, and JavaScript actions
HOW AND WHERE I MADE THEM?
I've been making Shiny applications since 5 years, and have replaced $3000 worth of annual third-party subscriptions such as Tableau, SalesForce, Google Spreadsheet and various other third party integrations with shiny applications.
Here is a fully scalable project I'd created for a company called Limetray that was adopted y 60+ people and running on 300 instances at a point of time. The cost of operating such an application would be around $20/mo
FREE BUILDs
These can be scaled up to any organisation, given a EC2 Micro AWS Server, Rstudio server, and decently indexed MySQL, or even Mongo database accesses that would cost maximum $15/mo
The following illustration shows an app that does similar work to QuickBooks, a revenue logging service that costs $9.99 a month.
PRODUCT DEVELOPMENT SCOPE
1. IT STARTS WITH A LOGIN AND ENDS WITH A LOGOUT
The application, starts off with a login page which makes use of an authAPI to authenticate credentials, and the package shinyStore() to cache information of successfully logged users, such as they need not log in again. I have also implemented a logout functionality which updates stored cache, and causes the app to reload using session$reload()
2. USING THE APPLICATION TO INPUT INFORMATION
Post login, a standard Bootstrap UI shows up with the login functionality visible on the top right end. The whole UI is a sequential form where each output loads taking in the global variables made in the previous steps.
Upon completing the entire form (ie. After filling in all the Sales information in order to generate invoice and save information to the databases) the UI looks something like this.
Sufficient number of checks are implemented in order for the POST request to become fool-proof
Packages used to input data are RHandsontable() for input tables, shinyBS() for notifications and modals, and other simple bootstrap inputs that come with Shiny
3. USING THE APPLICATION TO MANAGE INFORMATION
Once the form is complete, I click save and a POST request goes to a database currently hosted on AWS wherin suitable tables are made to segregate data to be used in the future in this application.
Once submitted, you're redirected to the second tab of this application which is used to change payment statuses, earlier added by Sales Teams, so that finance and revenue teams can take action on them
The following UI is powered by HTML based tickers on the top, DT::datatable() package with custom JS to facilitate usage of buttons within the table, along with more modules to show status on payments against transaction
This can be used to ascertain what payments are due for action in a given timeframe, email notifications are sent to relevant teams to remind of what all is to be done
A user can change statuses from here and update databases instantly. A secondary authentication is called for saving new changes using Modals, and revenues are managed without accessing any Excel or GoogleSheets.
Users with additional accesses can also edit existing data triggering UPDATE queries to the same databases, and saving old images of the current information.
5. CREATING INVOICES WITH R
The user can create invoices by using a small javascript code, renders an HTML based invoice > Initiates 'Print' Command > And gives 'Save as PDF' option
And that pretty much sums it up how I created a product to save for Product Teams bandwidth and replacing developers for one of the internal products of my Company.
CONCLUSION
We can harness the power of R's computational, and Shiny's ease of developement along with ongoing developments such as shareable downloadable applications to act as reproducible research and fulfil for ad-hoc product requirements across institutions and companies.
You can reach me at kapil29bahadur@gmail.com for any ad-hoc product requirements, as well as collaborations and assistance over Shiny or R as PRD tool.