-
Notifications
You must be signed in to change notification settings - Fork 8
Ticket Alert Mechanism
Jack Li edited this page Oct 16, 2022
·
3 revisions
- Follow the Ticket Storage design at wiki page.
- Alert handling is asynchronous action and is triggered when updating the
best_available_seats
andbest_history_seats
collections. A queue is constructed to schedule the alert handlers.
- Let
A
be the list of current best available seats andB
the list of new best available seats. - Query list
A
andB
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
frombest_available_seats
and insertD
tobest_available_seats
. - Save
C
tobest_history_seats
. - Use
D
to invoke a handler to analyze them against thebest_history_seats
asynchronously.
- 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
Calculation
- % change = (new_price - min) / (max-min) or (max - new_price) / (max-min)
Calculation
- percentile = new_price_rank / total_count_of_history_seats
Example
- If there are
r1
number of history tickets whose prices <= new price andtotal
the total count of history tickets, then the percentile =r1/total
.
If the two thresholds are low, the alerting is less sensitive, meaning the tracker will be less frequent to send price alerts to users.
= 0.5
Example
min = $100, max = $200, the threshold will be met when the price is <= $150.
= 0.5 (i.e. the median)
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.
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.
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.
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.