transitmatters / t-performance-dash

TransitMatters performance visualizer for the MBTA
https://dashboard.transitmatters.org/
MIT License
48 stars 16 forks source link

Move alerts to fetch from v3 API #974

Closed devinmatte closed 1 month ago

devinmatte commented 2 months ago

Stop using the performance API for alerts, we should fetch from the V3 API

We can format the result from v3 in a way that the dashboard expects for now

[
    {
        "valid_from": "2024-04-07T06:26:01",
        "valid_to": "2024-04-07T16:35:41",
        "text": "Route 1 experiencing delays of up to 20 minutes"
    },
    {
        "valid_from": "2024-04-07T16:36:15",
        "valid_to": "2024-04-07T16:36:15",
        "text": "Route 1 experiencing delays of up to 20 minutes"
    },
    {
        "valid_from": "2024-04-07T09:49:45",
        "valid_to": "2024-04-08T02:24:45",
        "text": "Route 1 experiencing delays of up to 20 minutes"
    }
]

To get all alerts for route 1 on April 5th 2024

curl -X GET "https://api-v3.mbta.com/alerts?filter%5Bactivity%5D=BOARD%2CEXIT%2CRIDE&filter%5Broute%5D=1&filter%5Bdatetime%5D=2024-04-05T10%3A34%3A11.808361" -H "accept: application/vnd.api+json"