Skip to content

A dashboard for visualizing DoorDash order history and scripts to get order history. Made with React, TypeScript, MUI X Charts, and Python.

Notifications You must be signed in to change notification settings

theodoremoreland/OrderDashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Order Dashboard

View the web application

Table of Contents

Overview

I rather enjoy being referred to as a "DoorDash VIP" when I call their customer support, despite the fact that being a DoorDash VIP is probably not a good thing. I knew my DoorDash spending habits were bad, but how bad warranted VIP status?

I wrote a couple scripts to web scrape and transform my order history data from the DoorDash website. The data (in the form of a JSON file) can be supplied to the dashboard.

The dashboard is initialized with random data. The randomized data can be shuffled by clicking the refresh icon in the navbar. Actual data in the form of a properly formatted JSON file can be supplied to the dashboard via clicking the attach/add icon in the navbar.

JSON data should be of the following format:

[
    {
        "storeName": "Store 1",
        "date": "Oct 13 2023",
        "cost": 121.67,
        "itemCount": 3,
        "items": ["item1", "item2", "item3"],
        "wasCancelled": false,
        "dayOfWeek": "Mon"
    },
    ...
]

Technologies Used

  • React
  • TypeScript
  • JavaScript
  • Python
  • HTML
  • CSS
  • Material UI (for inputs)
  • Material UI X Charts (for charts and data grid)
  • Zod
  • Jest
  • Docker
  • Vite

How to run locally

It is assumed all command line commands will be executed in a UNIX based command line environment.

With Docker

Note: Confirm that Docker is running prior to proceeding and that port 8080 is not being used by another program.

  1. Clone this repository.
  2. cd into docker directory
cd docker/
  1. Build docker image and start container
docker compose up --build
  1. Visit http://localhost:8080

With Windows

Note: Node is required to run the dashboard locally. This was developed using Node version v20.3.0. git is used to download this repository in the steps below. It is assumed you are already familiar with both.

  1. Clone this repository

  2. Run the following commands from the root of this project on your local machine

cd app/
npm i
npm run dev

Getting the order data

If you're interested, you can use my scripts and follow the method I used to grab my order history data (for your order history data). However, the method I used is relatively primitive and volatile, considering it isn't fully automated and is based on a particular version of the DoorDash website. If DoorDash updates the order history page, the script used to grab the order history will likely fail. This was sufficient for the scope of the project as I didn't anticipate much value in repeating this process (I wanted to identify trends but not monitor them).

Two scripts are used to get the order history and prepare the data for analysis. One script parses the data scripts/webScraper.js. The other script transforms that data into a format better suited for performing analysis scripts/transform_data.py.

Web scraping

  1. Log in to your DoorDash account via the DoorDash website.
  2. Visit the Order History page on the DoorDash website.
  3. Open the "developer tools" from the Order History page.
  4. Copy and paste the JavaScript from scripts/webScraper.js into the dev console.
  5. Press Enter key and wait for script to finish running.
  6. Once the script is complete, copy the message printed in the dev console into an empty JSON file.

Transforming data

The data created from the web scraping steps need to be transformed before performing analytics. The file @ scripts/transform_data.py is used to transform the data.

Note: Python is required to run the transform_data.py script.

  1. Run the transform_data.py script and point it to the JSON file created of the order data printed from webScraper.js.

Screenshots

Desktop

Default view (data for all years)

After toggling KPIs from Totals to Averages

Dropdown for switching between years for visualizations

After switching to the year 2018

Dropdown for Activity scatter chart

After clicking Total Items option for scatter chart dropdown

Dropdown for Top Streaks list

After switching to No Orders for Top Streaks list

Hovering over dropdown for Top Stores bar chart

After selecting "by Total Items" for Top Stores bar chart

Hovering over Totals by Month pie chart

Hovering over Totals by Weekday pie chart

After clicking arrow on data grid to view items 11-15

Hovering over randomize button

After randomizing data via clicking randomize button

Dialog for supplying JSON file to dashboard

Setting List to display 7 items and Bar Chart to display 10 items

After setting List to display 7 items and Bar Chart to display 10 items

Mobile

Top of the page (mobile)

Menu (mobile)

Display settings (mobile)

Attach file (mobile)

Years dropdown (mobile)

After changing year and toggling to Averages instead of totals (mobile)

Top Stores and Top Streaks (mobile)

Total Spend by Month and Total Spend by Weekday (mobile)

Order History table (mobile)