The project born as a simple standalone R script to analyze and visualize the most updated Covid related data that the Italian health ministry publish daily. In March 2020 the idea was mainly forecasting using time series analysis with HoltWinters (link1, link2) and SARIMA (link), and everything was running from my PC. During November 2020 some friends asked me to provide the graphs in a better usable way. So I decided to create a cloud native application that can run in the most famous hosting platform like AWS, Azure, etc.
The application is currently hosted on a VPS hosting and on Heroku, the latter without the images generated by R.
The following images are screenshots.
Homepage of the application |
Graphs by region |
Intensive care patients in Italy, generated by R |
Intensive care patients in Italy by regions, generated by R |
At the beginning, the application consists of an R script running on my local PC, of course R does not provide a production ready web server. So I decided to use Spring Boot as orchestrator for calling the R scripts, download the data, trigger the scheduled batches and serve the frontend. As frontend, I chose VueJs, because of the separation of concerns between frontend logic and graphic template. Instead of javascript, I use typescript that allows a cleaner syntax and compile time warnings.
- retrieve data and generate graphs with R
- usa spring-boot as server and integrate Java with R
- deploy the application on a remote Virtual Private Server
- run as a service
- log with syslog and log rolling
- reverse proxy with nginx
- expose in https with a verified certificate
- integrate a Vue frontend with spring-boot
- generate interactive graphs with a Vue using data from the underlying API
- localization
- if R is not available on the system, avoid the R specific features
- automate the deployment from github to the destination server
You can compile and run with the following command
mvn clean package && java -jar dist/target/*.jar
The webapp is available at localhost:8080.
To generate the images with R you need to query the endpoint /admin/generate-images.
Here you can find details for the requirements if you are interested to install on your server.
- Icons made by Freepik