Coreflux Templates

MBTA Subway Alert Monitor

Monitor MBTA subway and light-rail alerts with Coreflux.

Dataflow

How it flows

Actions, models, routes and the topics that link them. Click a node to trace its flow.

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/enabled and a 2-minute action.
  • JSON validation: Confirms the MBTA response shape before parsing.
  • Fixed alert slots: Fan-out to alerts/1..3 keeps topic structure stable.
  • Edge detection: Publishes events/alert_change only when the active count moves.
  • Collapsed report model: Emits a compact SubwayReport summary to reports/network.

Prerequisites

  • Internet egress from Coreflux
  • No MBTA API key required at this cadence

Setup

  1. Deploy the route, actions, and model.
  2. Ensure demo/subway/feed/enabled is 1 to poll.
  3. Read demo/subway/reports/network for the latest summary.

What this template does

The notebook

What’s inside

Browse the markdown and code cells before you download.

LoT Notebook:demo_subway_status.lotnb
Related use cases

Similar templates

Templates chosen for overlap in routes, tags, and category.

View all in Smart Cities

Get this template

1 file