An R Shiny App to visualize and analyze grocery data as well as to act as a hub for automated report and invoice generation. See below for a short description of the tabs included in this dashboard.
A demo version of the app is available here: R Shiny Dashboard Demo. It takes about 30-45 seconds for the dashboard to load initially, due to known hosting limitations. View the code at the end of this page on how to download and run the app on your local machine.
I collected product data by scraping 2 online gorcery services - elGrocer (based in UAE) and Ocado (based in UK). After cleaning the data, I made them available in the grocerycart
package.
For more information on how the data was collected, cleaned and analyzed, view the grocerycart R package. The package includes 16 grocery related datasets and a tutorial on how you can collect and clean more data.
Also, I simulated a fake grocery store's customers, orders and baskets dataset based on the scraped data. You too can generate and download such a dataset via the 'Generate Grocery Data' tab in the dashboard.
Here are 4 short videos to give you a preview of the app:
basket_analysis_tab.mov
generate_grocery_data_tabs.mov
ocado_tabs.mov
dark_theme.mov
Here is a brief description of the 6 tabs in the R Shiny App:
- Basket Analysis: Analyzes the simulated grocery data.
- Generate Grocery Data: Automatically generates a set of 3 downloadable, related random datasets from a fictional grocery store, funmart.
- Automated Reports: Automatically creates downloadable and editable powerpoint report and word invoice based on the data uploaded and input paramters set by the user.
- Recommendations: Recommends 10 products based on 5 products already in the basket. The 'Popular items (POPULAR)' recommendation algorithm is used.
- Summary Elgrocer: Descriptive Summary of the data scraped from the elgrocer website (more analysis can be conducted).
- Summary Ocado: Descriptive Summary of the data scraped from the ocado website (more analysis can be conducted).
Here are some features that can be included for a more complex version of the App:
- A live version of the App can be built by connecting the R scripts to a live database, causing the dashboard to automatically update periodically (i.e., hourly or daily), or even whenever a user clicks on a 'Refresh' button.
- Statistical models can be built to predict future orders (i.e., predict customer lifetime revenue).
- Include a filtering option (i.e., only view January data).
- Allow users to sign up to receive a daily summary of the dashboard's KPIs.
- Text analysis of reviews or customer chat support, if available (i.e., what are the common questions that customers are asking -> build an automated bot support that answers these FAQs).
- Deploy App on Amazon Web Services, Digital Ocean or Heroku for better performance and security.
ui & server: shiny
, shinyFeedback
, grocerycart
, bs4Dash
, gt
, plotly
, visNetwork
, reactable
, reactablefmtr
, ggplot2
, dplyr
, stringr
, cohorts
, arules
, arulesViz
, Matrix
, recommenderlab
, officer
, lubridate
, flextable
, patchwork
, fabricatr
, wakefield
, randomNames
, charlatan
, magrittr
, purrr
.
basket_analysis.R: grocerycart
, dplyr
, lubridate
, ggplot2
, ggforce
, gt
, reactable
, reactablefmtr
, purrr
, stringr
, hrbrthemes
, scales
.
eg_analysis.R: grocerycart
, tidyverse
, stringr
, forcats
, ggrepel
, ggimage
, ggbeeswarm
.
oc_analysis.R: grocerycart
, tidyverse
, stringr
, reactable
, gganimate
, ggflags
, ggimage
, ggrepel
, htmltools
, hrbrthemes
, scales
, glue
.
To download and run the app directly on your machine (i.e.,local R session), run the following code:
# install the packages used in this project
cran_packages <- c("shiny", "shinyFeedback", "bs4Dash", "gt", "plotly", "visNetwork",
"reactable", "reactablefmtr", "ggplot2", "dplyr", "stringr", "cohorts",
"arules", "arulesViz", "Matrix", "recommenderlab", "officer", "lubridate",
"flextable", "patchwork", "randomNames", "charlatan", "magrittr", "purrr",
"ggforce", "hrbrthemes", "scales", "tidyverse", "forcats", "ggrepel",
"ggimage", "ggbeeswarm", "gganimate", "htmltools", "glue")
cran_to_install <- cran_packages[!cran_packages %in% installed.packages()[, "Package"]]
install.packages(to_install, repos = "https://cran.rstudio.com/")
devtools::install_github("https://github.com/moamiristat/grocery.git")
devtools::install_github("https://github.com/trinker/wakefield.git")
devtools::install_github("https://github.com/jimjam-slam/ggflags.git")
install.packages("fabricatr", dependencies = TRUE, repos = c("http://r.declaredesign.org",
"https://cloud.r-project.org"))
# download and run the application - the app will open automatically
library("shiny")
shiny::runGitHub('grocery', 'moamiristat')