# Sales Dashboard for Chain Stores
This is a simple web application that consumes .xlsx sales reports, one at a time, and visualizes the aggregate data for all of the reports. It's built with Ruby and includes elements of OOP - and it has a functioning, nearly responsive HTML/ CSS/ JS front end. Check out the screenshots (/screenshots) and video file of the app in action (/screenshots/chain_stores_demo.gif)
## Structure of the Code
Server: Ruby with Sinatra (open-source DSL, dependent on Rack server interface)
Database: PostgreSQL
Ruby Gems:
* PG - for PostgreSQL
* ActiveRecord - Modeling tool for CRUD'ing database
* Roo (and dependency spreadsheet) - Processes .xlsx into accessible interface/ JSON
* Chartkick - a less-customizable D3 for charting data
CSS: used reset.css to reduce browswer inconsistencies
## To install and run locally
* Save files locally
* Install PostgreSQL and run schema.sql file
* Change the connection.rb username value to your own PSQL username
* Install Ruby Gems https://rubygems.org/pages/download if you haven't already
* Bundle gems or individually install gems.. "gem install <gem>"
* Type "ruby server.rb" from parent directory
* Navigate to port :4567
* Start by uploading a sales_report using the top-right button on the web interface
## File upload restriction occurs if:
* file is not .xlsx
* File is not formatted correctly (not built in yet!)
## Next Features
* Upload multiple files at one time
* Include a database table to store files saved and check to see if files have already been uploaded before allowing users to upload duplicate sales report
* Verify structure of xlsx report before allowing upload
* Delete incorrect sales reports
* Update parser to allow for more dynamic file structure
* Easily see worst performing products
* Split and minify CSS documents; clean up successful upload page and look to move upload workflow into a modal so users remain on the same screen
* Responsiveness (especially on the top-right table view)
## Notes on my process and design
* I usually prefer to employ a testing engine like Minitest for Ruby projects, but I was under a bit of a time crunch and didn't have the bandwidth to allow for proper testing design.
* I explored 3-4 other .xlsx parsers. This gave me the best interface and it made the File.io process nearly seamless
* Check out the Report class in /public/ruby_classes/report.rb -> Much refactoring left to do but it's pretty powerful
* I'd like to spend more time refactoring the server file, and hopefully creating more classes (before I build out more features!) to handle data transfer/ calculation on the server side
* It's always tough to balance clean server logic with presenting a great front end. I ended up spending my final few hours focusing on the presentation of the platform -- and there's still much more I hope to do (advanced filtering, D3 instead for better tooltips, etc.)