10-15 bucks!

Adam Cone
Posted on May 10, 2016

Contributed by Adam Cone.He  is currently in the NYC Data Science Academy 12 week full time Data Science Bootcamp program taking place between April 11th to July 1st, 2016. This post is based on his second class project - R Shiny (due on the 4th week of the program). The video of his presentation is here:

Open Produce is small grocery store on the south side of Chicago. The owners wrote their own Point-of-Sale (POS) system to collect data relating to deveries, inventory, sales, and other aspects of the business. Open Produce made some of their total revenue data available in an interactive format  on their website:

OPData

The overall revenue trend seems pretty consistently positive since Open Produce began taking data. Kudos to Open Produce! Mazel tov! For my Shiny project, I wanted also look at overall revenue. Specifically, I wanted to provide both Open Produce staff and customers a free an easy way to visualize the data themselves to gain insights. To this end, I developed the following Shiny app, hosted by Shinyapps.io here:

https://adamcone.shinyapps.io/OpenProduceShiny/

To generate this app, I first prepared the data with an R file, then wrote the app itself using three more R files: ui.R, server.R, and helpers.R. The data wrangling code is:

https://gist.github.com/adamcone/d3b81d6d6a0a89de365f93e2cea5149a

After this data wrangling, my data looked like this:

items_tbl

Now, for the Shiny code. Here's the ui.R code:

https://gist.github.com/adamcone/3c0e89d1f2ae3f22b6560956935a8c06

Here's the server.R code:

https://gist.github.com/adamcone/9376e93fb30965fb6a96e7ec1a672c28

And here's the helpers.R code:

https://gist.github.com/adamcone/ecd6c226334a6a2eedbfa5c850173063

Playing around with the app myself led me to two insights that I didn't have beforehand, although I had spent a lot of time with the data. First, I noticed that the total Open Produce revenue, in approximately 4 month bins, essentially quadrupled between the first bin and the final bin for the 6.5 years of data I had ( about $100,000 to $400,000 total revenue over each four-month period). In addition, the growth was roughly constant over the intervening ~6 years.

shiny_overall

So, I was interested in sub-categories that may not obey this trend. One was revenue collected from items purchased with Payment Type Credit/Debit only:

shiny_cd

It seems that while overall revenue increased smoothly by a factor of about 4, Credit/Debit purchases increased smoothly from about $40,000 to $250,000, or a factor of 6.25 over the same period. It appears to me that Credit/Debit purchases were disproportionately responsible for the overall revenue increase.

In addition, narrowing the Product Unit Price Range ($) to $10-$15 was even more extreme:

shiny1015

The growth in products with unit prices from $10-15 was enormous. There was essentially no revenue from these products until about July 2010, when they started steadily increasing. After that, the growth seemed to spike in early 2015. While this data was available before I had looked at the Shiny app, I didn't make this connection until I could visualize the data. Also, using Shiny, I was able to pinpoint that the majority of revenue generated from $10-15 items was sold in the middle Time of Day: 2:00pm-8:00pm.

If I were to develop this app further, besides prettying it up a bit, I would want to include more item categories, such as dairy/frozen/drinks, etc. Also, it would be interesting to have data about where the items were physically in the store when they were purchased.

About Author

Adam Cone

Adam Cone

Adam Cone received his BA with honors in Math from NYU, where he conducted original research in computational neural science and experimental fluid mechanics. He received his MA in Applied Math from UCLA, concentrating in differential equations and...
View all posts by Adam Cone >

Related Articles

Leave a Comment

Avatar
dungeon hunter 5 hack 2016 July 9, 2016
This is the appropriate blog for anyone who desires to find out about this matter. You realize so much its almost hard to argue with you (not that I actually would desire… HaHa). You undoubtedly set a brand new spin on a topic thats been written about for years. Amazing stuff, just excellent!
Avatar
Chang June 29, 2016
I was waiting for this kind of subject. Thank you very much for the place.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp