mbus-backend
    Preparing search index...

    Class ReminderSubscriptions

    Subscriptions go through a pipeline, see types above for details.

    Index
    subscriptions: {
        subscription: PreThreshold | PostThreshold;
        token: RegistrationToken;
    }[]
    • Adds a new subscription, uses prediction data to determine a candidate vid. Existing reminders for the same event and token are removed. REQUIRES: predsByStopId has predictions sorted by arrival timestamp

      Parameters

      Returns void

    • updates the status of all registrations, returning an object representing the notifications that should be sent

      • threshold reminders are sent only for subscriptions of PreThreshold, and trigger when the candidate vehicle has an arrival time at or under thresh and an arrival timestamp after mustBeAfter
      • at the stop reminders are sent only for subscriptions of PostThreshold and trigger when the tracked vehicle has a pred of 1/0 or if pred becomes null and vidPredPrev <= shouldBeArrivingThresh
      • disappeared reminders are sent in both stages
        • stage 0 if there no longer is a valid candidateVid
        • stage 1 if the relevant pred of the tracked vehicle becomes null and the the bus isn't too close to the stop
      • delayed reminders are sent in both stages
        • stage 0 if the relevant pred of the candidate vehicle increases (can also happen from the candidate vehicle changing)
        • stage 1 if the relevant pred goes up and it doesn't seem like the bus going past the stop (this is still relevant even when tracking a specific vehicle if routes loop back on themselves weirdly)

      REQUIRES: predsByStopId and predsByVid have predictions sorted by arrival timestamp

      Parameters

      • predsByStopId: Record<string, Prediction[] | undefined>
      • predsByVid: Record<string, Prediction[] | undefined>
      • now: number

      Returns RemindersToTrigger