Skip to content

Ticket Alert Mechanism

Jack Li edited this page Oct 15, 2022 · 3 revisions

Precondition

  • Follow the Ticket Storage design at wiki page.

Design

  • Alert handling is asynchronous action and is triggered when updating the best_available_seats and best_history_seats collections. A queue is constructed to schedule the alert handlers.

Algorithms

Periodic task

  • Let A be the list of current best available seats and B the list of new best available seats.
  • Query list A and B by scraping_id from the database.
  • Compute A-B which is the seats based on the comparator should check for (sec, row?, seat?, price).
  • Compute B-A which is the new seats.
  • Remove A-B from best_available_seats and insert B-A to best_available_seats.
  • Save A-B to best_history_seats.
  • Use B-A to invoke a handler to analyze them against the best_history_seats asynchronously.

Async task

  • Query the database and get the sorted list of best_history_seats.
  • Use binary search to find the seat and get the percentile of the seat based on the rank.
  • If found the exact same seat based on (sec, row?, seat?), get the history price(s) of the seat.
  • Alert the user based on alert conditions

Alert Actions and Conditions

Rank Increases - Exact Same Price

TBD

Rank Increases - Similar Prices

TBD

Price Decreases - Similar Tickets Available with the Same Rank

Precondition:

  • Similar tickets (roughly the same rank) have been found and the new ticket price is lower than those of the closest history rank match.
  • i.e. Found a lower price of seats than those of the same viewing experience (rank).

Main Success Scenario:

  • Alert user of a price drop with alternative seat (new) price, old prices in the neighborhood of the spot located from the binary search, and the percentile.

Price Increases - Exact Same Ticket

Precondition:

  • The exact same ticket has been found in best_history_seats and the price is higher than the most recent history price.

Main Success Scenario:

  • Alert user of a price increase with the old and new price and the percentile.

Price Decreases - Exact Same Ticket

Precondition:

  • The exact same ticket has been found in best_history_seats and the price is lower than the most recent history price.

Main Success Scenario:

  • Alert user of a price drop with the old and new price and the percentile.
Clone this wiki locally