Skip to content

Ticket Alert Mechanism

Jack Li edited this page Oct 16, 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 C := A-B which is the seats based on the comparator should check for (sec, row?, seat?, price).
  • Compute D := B-A which is the new seats.
  • Remove C from best_available_seats and insert D to best_available_seats.
  • Save C to best_history_seats.
  • Use D to invoke a handler to analyze them against the best_history_seats asynchronously.

Async task

  • Query the collection best_history_seats with some filter.
  • Find the percentile of the seat based on some criteria (e.g. rank or price).
  • 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

Metrics

Percent of change from min/max price to new price

Calculation

  • % change = (new_price - min) / (max-min) or (max - new_price) / (max-min)

Percentile of the new price in best_history_seats

Calculation

  • percentile = new_price_rank / total_count_of_history_seats

Example

  • If there are r1 number of history tickets whose prices <= new price and total the total count of history tickets, then the percentile = r1/total.

Thresholds

If the two thresholds are low, the alerting is less sensitive, meaning the tracker will be less frequent to send price alerts to users.

Percent of change from min/max price to new price

= 0.5
Example min = $100, max = $200, the threshold will be met when the price is <= $150.

Percentile of the new price in history prices in best_history_seats

= 0.5 (i.e. the median)

Alert Actions and Conditions

Rank Increases - Similar Prices

Precondition:

  • In comparison to the new seat, tickets in best_history_seats that shared a similar price (>= new ticket price) and have a lower rank have been found.

Main Success Scenario:

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

Rank Decreases - Similar Prices

Precondition:

  • In comparison to the new seat, tickets in best_history_seats that shared a similar price (<= new ticket price) and have a higher rank have been found.

Main Success Scenario:

  • Alert user of a rank drop with new and old prices and the percentile.

Price Decreases - Similar Ranks

Precondition:

  • In comparison to the new seat, tickets in best_history_seats that shared a similar rank (<= new ticket rank) and have a higher price have been found.
  • 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 querying, and the percentile.

Price Increases - Similar Ranks

Precondition:

  • In comparison to the new seat, tickets in best_history_seats that shared a similar rank (>= new ticket rank) and have a lower price have been found.
  • i.e. Found a higher price of seats than those of the same viewing experience (rank).

Main Success Scenario:

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