How it works
This Coreflux LoT Notebook polls the MBTA v3 API every 2 minutes, reads active subway and light-rail alerts, and publishes them into stable topics. It turns the raw JSON:API response into three fixed alert slots, a live alert count, and an events/alert_change topic when the count changes.
Key features
- REST_API route: Fetches MBTA alerts from
https://api-v3.mbta.com/alerts?filter[route_type]=0,1. - Self-starting clock: Bootstraps polling with
feed/enabledand a 2-minute action. - JSON validation: Confirms the MBTA response shape before parsing.
- Fixed alert slots: Fan-out to
alerts/1..3keeps topic structure stable. - Edge detection: Publishes
events/alert_changeonly when the active count moves. - Collapsed report model: Emits a compact
SubwayReportsummary toreports/network.
Prerequisites
- Internet egress from Coreflux
- No MBTA API key required at this cadence
Setup
- Deploy the route, actions, and model.
- Ensure
demo/subway/feed/enabledis1to poll. - Read
demo/subway/reports/networkfor the latest summary.
