{"id":"anomaly","title":"Anomaly detection: where each table comes from and what it feeds","desc":"Three lanes, the agency account, the open feeds and the region account; five columns, source, Bronze, Silver, Gold and out; each table a box, each step a numbered pill, each connection an arrow; the account crossings in blue.","lanes":[{"id":"agency","title":"The agency's account  ·  stays home"},{"id":"public","title":"Open feeds  ·  public"},{"id":"region","title":"The region's account  ·  the exchange"}],"layers":[{"id":"source","name":"Source","color":"#3987e5"},{"id":"bronze","name":"Bronze","color":"#b0703a"},{"id":"silver","name":"Silver","color":"#a1a1a6"},{"id":"gold","name":"Gold","color":"#c98500"},{"id":"out","name":"Out","color":"#d55181"}],"status":{"tested":{"label":"tested on the sample","color":"#199e70"},"replayed":{"label":"replayed on the sample","color":"#c98500"},"standard":{"label":"already standard","color":"#3987e5"},"sample":{"label":"the sample files","color":"#a1a1a6"},"planned":{"label":"planned","color":"#86868b"}},"layout":{"NW":220,"NH":68,"GX":420,"GY":92,"X0":60,"PAD":40,"GAP":84,"TW":124,"TH":44},"tables":[{"lane":"agency","layer":"source","row":0,"name":"AVL stop times","role":["the location system's export, one row","per trip per stop; 26 columns"],"status":"sample","shape":"vendor CSV, `;`-delimited, UTF-8 BOM","grain":"one row per trip per stop","keys":"CALENDAR_ID, TRIP_ID, ROUTE_ABBR, GEO_NODE_ABBR, GEO_NAME prefix","part":"one file a month","keep":"the agency's rule","key":"agency","standard":"","columns":[{"name":"CALENDAR_ID","type":"text","key":"PK","desc":"1YYYYMMDD: a leading 1, then the service date"},{"name":"TIME_TABLE_VERSION_NAME","type":"text","key":"","desc":"board period, such as 24AU05; appears inside GTFS service_id"},{"name":"BLOCK_ABBR","type":"text","key":"","desc":"vehicle block, one bus's day of work; not a vehicle id"},{"name":"TRIP_ID","type":"text","key":"PK","desc":"vendor trip id; never equal to GTFS trip_id"},{"name":"ROUTE_ABBR","type":"text","key":"PK","desc":"route number as riders know it; equals GTFS route_short_name"},{"name":"ROUTE_DIRECTION_ABBR","type":"text","key":"","desc":"direction code, such as Noh or Soh"},{"name":"VARIANT","type":"text","key":"","desc":"pattern letter shown on the bus"},{"name":"GEO_NODE_ABBR","type":"text","key":"PK","desc":"stop number; equals GTFS stop_code"},{"name":"GEO_NAME","type":"text","key":"PK","desc":"'<sequence> - <stop name>': the stop sequence hides in the prefix"},{"name":"START_TERMINAL","type":"text","key":"","desc":"display"},{"name":"END_TERMINAL","type":"text","key":"","desc":"display"},{"name":"TRIP_EDGE","type":"text","key":"","desc":"first, middle or last stop of the trip"},{"name":"TIME_POINT_ID","type":"text","key":"","desc":"timepoint reference; NULL between timepoints"},{"name":"TIME_POINT_ABBR","type":"text","key":"","desc":"timepoint short name"},{"name":"TIME_POINT_NAME","type":"text","key":"","desc":"timepoint name"},{"name":"SERVICE_ABBR","type":"text","key":"","desc":"Weekday, Saturday, Sunday or Holiday1"},{"name":"SCHED_TRIP_START","type":"int s","key":"","desc":"scheduled trip start, seconds past midnight"},{"name":"SCHED_TRIP_END","type":"int s","key":"","desc":"scheduled trip end, seconds past midnight"},{"name":"SCHED_TRIP_DURATION","type":"int s","key":"","desc":"scheduled trip length"},{"name":"SCHED_TIME_PER_STOP","type":"int s","key":"","desc":"the plan at this stop, seconds past midnight; past 86,400 after midnight"},{"name":"ACTUAL_TRIP_DURATION","type":"int s","key":"","desc":"observed trip length"},{"name":"ACTUAL_ARRIVAL_TIME","type":"int s","key":"","desc":"observed arrival, seconds past midnight; NULL when not observed"},{"name":"ACTUAL_DEPARTURE_TIME","type":"int s","key":"","desc":"observed departure, seconds past midnight"},{"name":"DWELLING_TIME","type":"int s","key":"","desc":"time stopped at the stop"},{"name":"ADHERENCE_IN_SECS","type":"int s","key":"","desc":"scheduled minus actual in the file: the sign is the reverse of the dictionary's"},{"name":"KPI","type":"text","key":"","desc":"ON-TIME, EARLY or LATE: the vendor's label, agency thresholds"}],"id":"avl","status_label":"the sample files"},{"lane":"agency","layer":"source","row":1,"name":"APC counters","role":["the door counters' export, one row","per trip per stop; 18 columns"],"status":"sample","shape":"vendor CSV, `;`-delimited, UTF-8 BOM; first two columns in the opposite order to AVL","grain":"one row per trip per stop; a visit may have several","keys":"CALENDAR_ID, TRIP_ID, ROUTE_ABBR, STOP_NUMBER, PATTERN_STOP_SEQUENCE","part":"one file a month","keep":"the agency's rule","key":"agency","standard":"","columns":[{"name":"TIME_TABLE_VERSION_NAME","type":"text","key":"","desc":"board period"},{"name":"CALENDAR_ID","type":"text","key":"PK","desc":"1YYYYMMDD"},{"name":"BLOCK_ABBR","type":"text","key":"","desc":"vehicle block"},{"name":"TRIP_ID","type":"text","key":"PK","desc":"vendor trip id; joins to AVL"},{"name":"ROUTE_ABBR","type":"text","key":"PK","desc":"route number"},{"name":"ROUTE_DIRECTION_ABBR","type":"text","key":"","desc":"direction code"},{"name":"VARIANT","type":"text","key":"","desc":"pattern letter"},{"name":"PATTERN_STOP_SEQUENCE","type":"int","key":"PK","desc":"stop order along the trip"},{"name":"STOP_NUMBER","type":"text","key":"PK","desc":"stop number; equals GTFS stop_code"},{"name":"STOP_NAME","type":"text","key":"","desc":"display"},{"name":"TOTAL_CAPACITY","type":"int","key":"","desc":"vehicle capacity, seated and standing"},{"name":"SEATING_CAPACITY","type":"int","key":"","desc":"seats"},{"name":"BOARD","type":"int","key":"","desc":"people who got on at this stop"},{"name":"ALIGHT","type":"int","key":"","desc":"people who got off"},{"name":"DEPARTURE_LOAD","type":"int","key":"","desc":"people on board when leaving"},{"name":"SERVICE_ABBR","type":"text","key":"","desc":"service day type"},{"name":"TRIP_BEGIN_TIME","type":"int s","key":"","desc":"seconds past midnight; the only time in this file"},{"name":"TRIP_END_TIME","type":"int s","key":"","desc":"seconds past midnight"}],"id":"apc","status_label":"the sample files"},{"lane":"agency","layer":"bronze","row":0,"name":"Raw AVL export","role":["as exported: 1YYYYMMDD dates, times","in seconds, NULL as a string"],"status":"sample","shape":"as received, plus file and landing time","grain":"as received","keys":"none imposed","part":"by file and service day","keep":"the agency's rule; never leaves","key":"agency","standard":"","columns":[{"name":"CALENDAR_ID","type":"text","key":"PK","desc":"1YYYYMMDD: a leading 1, then the service date"},{"name":"TIME_TABLE_VERSION_NAME","type":"text","key":"","desc":"board period, such as 24AU05; appears inside GTFS service_id"},{"name":"BLOCK_ABBR","type":"text","key":"","desc":"vehicle block, one bus's day of work; not a vehicle id"},{"name":"TRIP_ID","type":"text","key":"PK","desc":"vendor trip id; never equal to GTFS trip_id"},{"name":"ROUTE_ABBR","type":"text","key":"PK","desc":"route number as riders know it; equals GTFS route_short_name"},{"name":"ROUTE_DIRECTION_ABBR","type":"text","key":"","desc":"direction code, such as Noh or Soh"},{"name":"VARIANT","type":"text","key":"","desc":"pattern letter shown on the bus"},{"name":"GEO_NODE_ABBR","type":"text","key":"PK","desc":"stop number; equals GTFS stop_code"},{"name":"GEO_NAME","type":"text","key":"PK","desc":"'<sequence> - <stop name>': the stop sequence hides in the prefix"},{"name":"START_TERMINAL","type":"text","key":"","desc":"display"},{"name":"END_TERMINAL","type":"text","key":"","desc":"display"},{"name":"TRIP_EDGE","type":"text","key":"","desc":"first, middle or last stop of the trip"},{"name":"TIME_POINT_ID","type":"text","key":"","desc":"timepoint reference; NULL between timepoints"},{"name":"TIME_POINT_ABBR","type":"text","key":"","desc":"timepoint short name"},{"name":"TIME_POINT_NAME","type":"text","key":"","desc":"timepoint name"},{"name":"SERVICE_ABBR","type":"text","key":"","desc":"Weekday, Saturday, Sunday or Holiday1"},{"name":"SCHED_TRIP_START","type":"int s","key":"","desc":"scheduled trip start, seconds past midnight"},{"name":"SCHED_TRIP_END","type":"int s","key":"","desc":"scheduled trip end, seconds past midnight"},{"name":"SCHED_TRIP_DURATION","type":"int s","key":"","desc":"scheduled trip length"},{"name":"SCHED_TIME_PER_STOP","type":"int s","key":"","desc":"the plan at this stop, seconds past midnight; past 86,400 after midnight"},{"name":"ACTUAL_TRIP_DURATION","type":"int s","key":"","desc":"observed trip length"},{"name":"ACTUAL_ARRIVAL_TIME","type":"int s","key":"","desc":"observed arrival, seconds past midnight; NULL when not observed"},{"name":"ACTUAL_DEPARTURE_TIME","type":"int s","key":"","desc":"observed departure, seconds past midnight"},{"name":"DWELLING_TIME","type":"int s","key":"","desc":"time stopped at the stop"},{"name":"ADHERENCE_IN_SECS","type":"int s","key":"","desc":"scheduled minus actual in the file: the sign is the reverse of the dictionary's"},{"name":"KPI","type":"text","key":"","desc":"ON-TIME, EARLY or LATE: the vendor's label, agency thresholds"},{"name":"_source_file","type":"text","key":"","desc":"the export file this row came from"},{"name":"_landed_at","type":"datetime","key":"","desc":"when the file landed"}],"id":"b_avl","status_label":"the sample files"},{"lane":"agency","layer":"bronze","row":1,"name":"Raw APC export","role":["as exported; duplicate records","of one visit kept as they are"],"status":"sample","shape":"as received, plus file and landing time","grain":"as received","keys":"none imposed","part":"by file and service day","keep":"the agency's rule; never leaves","key":"agency","standard":"","columns":[{"name":"TIME_TABLE_VERSION_NAME","type":"text","key":"","desc":"board period"},{"name":"CALENDAR_ID","type":"text","key":"PK","desc":"1YYYYMMDD"},{"name":"BLOCK_ABBR","type":"text","key":"","desc":"vehicle block"},{"name":"TRIP_ID","type":"text","key":"PK","desc":"vendor trip id; joins to AVL"},{"name":"ROUTE_ABBR","type":"text","key":"PK","desc":"route number"},{"name":"ROUTE_DIRECTION_ABBR","type":"text","key":"","desc":"direction code"},{"name":"VARIANT","type":"text","key":"","desc":"pattern letter"},{"name":"PATTERN_STOP_SEQUENCE","type":"int","key":"PK","desc":"stop order along the trip"},{"name":"STOP_NUMBER","type":"text","key":"PK","desc":"stop number; equals GTFS stop_code"},{"name":"STOP_NAME","type":"text","key":"","desc":"display"},{"name":"TOTAL_CAPACITY","type":"int","key":"","desc":"vehicle capacity, seated and standing"},{"name":"SEATING_CAPACITY","type":"int","key":"","desc":"seats"},{"name":"BOARD","type":"int","key":"","desc":"people who got on at this stop"},{"name":"ALIGHT","type":"int","key":"","desc":"people who got off"},{"name":"DEPARTURE_LOAD","type":"int","key":"","desc":"people on board when leaving"},{"name":"SERVICE_ABBR","type":"text","key":"","desc":"service day type"},{"name":"TRIP_BEGIN_TIME","type":"int s","key":"","desc":"seconds past midnight; the only time in this file"},{"name":"TRIP_END_TIME","type":"int s","key":"","desc":"seconds past midnight"},{"name":"_source_file","type":"text","key":"","desc":"the export file this row came from"},{"name":"_landed_at","type":"datetime","key":"","desc":"when the file landed"}],"id":"b_apc","status_label":"the sample files"},{"lane":"agency","layer":"silver","row":0,"name":"TIDES stop_visits","role":["5.45 M rows from the month, one per","trip per stop; 100% pass the schema"],"status":"tested","shape":"TIDES `stop_visits` (AVL skeleton, APC counts merged)","grain":"service day × trip × stop sequence","keys":"service_date, trip_id_performed, trip_stop_sequence; stop_id = GTFS stop","part":"by service day","keep":"the agency's rule; the region never reads it","key":"agency","standard":"TIDES stop_visits","columns":[{"name":"service_date","type":"date","key":"PK","desc":"the service day"},{"name":"trip_id_performed","type":"text","key":"PK","desc":"the vendor trip id, unchanged"},{"name":"trip_stop_sequence","type":"int","key":"PK","desc":"1, 2, 3 along the trip"},{"name":"scheduled_stop_sequence","type":"int","key":"","desc":"GTFS stop_sequence; null until the trip map fills it"},{"name":"pattern_id","type":"text","key":"","desc":"route, direction and variant"},{"name":"vehicle_id","type":"text","key":"","desc":"null: the export names a block, not a vehicle"},{"name":"dwell","type":"int s","key":"","desc":"time stopped"},{"name":"stop_id","type":"text","key":"FK","desc":"GTFS stops.stop_id; equals stop_code in this feed"},{"name":"timepoint","type":"bool","key":"","desc":"true at a timepoint"},{"name":"schedule_arrival_time","type":"datetime","key":"","desc":""},{"name":"schedule_departure_time","type":"datetime","key":"","desc":"the file has one scheduled time per stop"},{"name":"actual_arrival_time","type":"datetime","key":"","desc":""},{"name":"actual_departure_time","type":"datetime","key":"","desc":""},{"name":"boarding_1","type":"int","key":"","desc":"people who got on"},{"name":"alighting_1","type":"int","key":"","desc":"people who got off"},{"name":"departure_load","type":"int","key":"","desc":"people on board leaving"},{"name":"schedule_relationship","type":"enum","key":"","desc":"Scheduled, or Missing when nothing was observed"}],"id":"a_silver","status_label":"tested on the sample"},{"lane":"agency","layer":"silver","row":1,"name":"TIDES trips_performed","role":["one row per trip per day: route,","direction and the timetable trip"],"status":"planned","shape":"TIDES `trips_performed`","grain":"service day × trip","keys":"service_date, trip_id_performed; trip_id_scheduled = GTFS trip_id through the trip map","part":"by service day","keep":"the agency's rule; never leaves","key":"agency","standard":"TIDES trips_performed","columns":[{"name":"service_date","type":"date","key":"PK","desc":""},{"name":"trip_id_performed","type":"text","key":"PK","desc":"the vendor trip id"},{"name":"vehicle_id","type":"text","key":"","desc":"required by TIDES; the export has none, so null until the vehicle id is exported"},{"name":"trip_id_scheduled","type":"text","key":"FK","desc":"GTFS trips.trip_id through the trip map: 99.78% of trip-days match one trip exactly"},{"name":"route_id","type":"text","key":"FK","desc":"GTFS routes.route_id"},{"name":"route_type","type":"int","key":"","desc":""},{"name":"direction_id","type":"int","key":"","desc":"0 or 1, from the timetable trip"},{"name":"block_id","type":"text","key":"","desc":"the vendor block"},{"name":"shape_id","type":"text","key":"FK","desc":""},{"name":"pattern_id","type":"text","key":"","desc":""},{"name":"trip_start_stop_id","type":"text","key":"FK","desc":""},{"name":"trip_end_stop_id","type":"text","key":"FK","desc":""},{"name":"schedule_trip_start","type":"datetime","key":"","desc":""},{"name":"schedule_trip_end","type":"datetime","key":"","desc":""},{"name":"actual_trip_start","type":"datetime","key":"","desc":""},{"name":"actual_trip_end","type":"datetime","key":"","desc":""},{"name":"schedule_relationship","type":"enum","key":"","desc":"Scheduled, or Canceled when no stop was observed"}],"id":"a_trips","status_label":"planned"},{"lane":"agency","layer":"gold","row":0,"name":"5-minute loads","role":["people on board per route, direction,","stop and 5-minute window; no rider"],"status":"replayed","shape":"TIDES `passenger_events`, summed; five extras named in the contract (decision 60)","grain":"route × direction × stop × 5-minute window","keys":"service_date, route_id, direction_id, stop_id, window_start","part":"sent every 5 minutes, within 2","keep":"24 hours on the lane","key":"region, on arrival","standard":"TIDES passenger_events, summed","columns":[{"name":"service_date","type":"date","key":"PK","desc":"TIDES"},{"name":"route_id","type":"text","key":"PK","desc":"GTFS route_id; extra named in the contract: passenger_events has no route"},{"name":"direction_id","type":"int","key":"PK","desc":"extra named in the contract (decision 60): the region's series are per direction"},{"name":"stop_id","type":"text","key":"PK","desc":"TIDES"},{"name":"window_start","type":"datetime","key":"PK","desc":"the 5-minute window; extra named in the contract"},{"name":"boardings","type":"int","key":"","desc":"TIDES event_count summed, event_type boarding"},{"name":"alightings","type":"int","key":"","desc":"TIDES event_count summed, event_type alighting"},{"name":"on_board","type":"int","key":"","desc":"extra named in the contract: the mean departure load over the window's visits (decision 60); the sum is on_board × visits"},{"name":"visits","type":"int","key":"","desc":"extra named in the contract (decision 60): windows under 3 visits show unknown"}],"id":"a_gold","status_label":"replayed on the sample"},{"lane":"public","layer":"source","row":0,"name":"GTFS timetables","role":["every party's published schedule;","the yardstick for delay"],"status":"standard","shape":"GTFS zip, as published","grain":"one row per trip per stop (stop_times)","keys":"trip_id, stop_id, stop_sequence; service_id carries the board period","part":"by party and feed version","keep":"every version the archive still covers","key":"none, open","standard":"GTFS","columns":[{"name":"agency.agency_id","type":"text","key":"PK","desc":"the publisher","group":"agency.txt"},{"name":"agency.agency_name","type":"text","key":"","desc":"","group":"agency.txt"},{"name":"agency.agency_timezone","type":"text","key":"","desc":"America/Toronto","group":"agency.txt"},{"name":"stops.stop_id","type":"text","key":"PK","desc":"the stop's id in the feed","group":"stops.txt"},{"name":"stops.stop_code","type":"text","key":"","desc":"the number on the pole; the vendor files' stop number","group":"stops.txt"},{"name":"stops.stop_name","type":"text","key":"","desc":"","group":"stops.txt"},{"name":"stops.stop_lat","type":"number","key":"","desc":"WGS-84","group":"stops.txt"},{"name":"stops.stop_lon","type":"number","key":"","desc":"WGS-84","group":"stops.txt"},{"name":"stops.location_type","type":"int","key":"","desc":"stop, station or entrance","group":"stops.txt"},{"name":"stops.parent_station","type":"text","key":"FK","desc":"stops.stop_id of the station","group":"stops.txt"},{"name":"routes.route_id","type":"text","key":"PK","desc":"","group":"routes.txt"},{"name":"routes.agency_id","type":"text","key":"FK","desc":"","group":"routes.txt"},{"name":"routes.route_short_name","type":"text","key":"","desc":"the route number","group":"routes.txt"},{"name":"routes.route_long_name","type":"text","key":"","desc":"","group":"routes.txt"},{"name":"routes.route_type","type":"int","key":"","desc":"3 is bus","group":"routes.txt"},{"name":"trips.route_id","type":"text","key":"FK","desc":"","group":"trips.txt"},{"name":"trips.service_id","type":"text","key":"FK","desc":"carries the board period","group":"trips.txt"},{"name":"trips.trip_id","type":"text","key":"PK","desc":"the timetable trip","group":"trips.txt"},{"name":"trips.trip_headsign","type":"text","key":"","desc":"","group":"trips.txt"},{"name":"trips.direction_id","type":"int","key":"","desc":"0 or 1","group":"trips.txt"},{"name":"trips.block_id","type":"text","key":"","desc":"","group":"trips.txt"},{"name":"trips.shape_id","type":"text","key":"FK","desc":"","group":"trips.txt"},{"name":"stop_times.trip_id","type":"text","key":"PK","desc":"","group":"stop_times.txt"},{"name":"stop_times.arrival_time","type":"time","key":"","desc":"HH:MM:SS, past 24:00 after midnight","group":"stop_times.txt"},{"name":"stop_times.departure_time","type":"time","key":"","desc":"","group":"stop_times.txt"},{"name":"stop_times.stop_id","type":"text","key":"FK","desc":"","group":"stop_times.txt"},{"name":"stop_times.stop_sequence","type":"int","key":"PK","desc":"increasing along the trip","group":"stop_times.txt"},{"name":"stop_times.timepoint","type":"int","key":"","desc":"1 where the time is exact","group":"stop_times.txt"},{"name":"calendar_dates.service_id","type":"text","key":"PK","desc":"","group":"calendar_dates.txt"},{"name":"calendar_dates.date","type":"date","key":"PK","desc":"YYYYMMDD","group":"calendar_dates.txt"},{"name":"calendar_dates.exception_type","type":"int","key":"","desc":"1 added, 2 removed; this feed has no calendar.txt","group":"calendar_dates.txt"},{"name":"shapes.shape_id","type":"text","key":"PK","desc":"","group":"shapes.txt"},{"name":"shapes.shape_pt_lat","type":"number","key":"","desc":"","group":"shapes.txt"},{"name":"shapes.shape_pt_lon","type":"number","key":"","desc":"","group":"shapes.txt"},{"name":"shapes.shape_pt_sequence","type":"int","key":"PK","desc":"","group":"shapes.txt"},{"name":"feed_info.feed_publisher_name","type":"text","key":"","desc":"","group":"feed_info.txt"},{"name":"feed_info.feed_version","type":"text","key":"","desc":"the version string the publisher sets","group":"feed_info.txt"},{"name":"feed_info.feed_start_date","type":"date","key":"","desc":"","group":"feed_info.txt"},{"name":"feed_info.feed_end_date","type":"date","key":"","desc":"","group":"feed_info.txt"}],"id":"gtfs","status_label":"already standard"},{"lane":"public","layer":"source","row":1,"name":"GTFS-Realtime feeds","role":["positions, trip updates, alerts;","24 M positions a day, 4,559 vehicles"],"status":"standard","shape":"GTFS-Realtime protobuf, as each party publishes it","grain":"one position per vehicle every 10 s; one trip update per trip","keys":"party, vehicle id, trip id, timestamp","part":"polled every 10 s","keep":"not stored as such; see the live lane","key":"none, open","standard":"GTFS-Realtime","columns":[{"name":"header.timestamp","type":"epoch s","key":"","desc":"when the feed was built","group":"FeedHeader"},{"name":"header.gtfs_realtime_version","type":"text","key":"","desc":"2.0","group":"FeedHeader"},{"name":"vp.entity_id","type":"text","key":"PK","desc":"entity id, usually the vehicle","group":"VehiclePosition"},{"name":"vp.trip.trip_id","type":"text","key":"FK","desc":"the timetable trip the vehicle runs","group":"VehiclePosition"},{"name":"vp.trip.route_id","type":"text","key":"FK","desc":"","group":"VehiclePosition"},{"name":"vp.trip.direction_id","type":"int","key":"","desc":"","group":"VehiclePosition"},{"name":"vp.trip.start_date","type":"date","key":"","desc":"YYYYMMDD: the service day","group":"VehiclePosition"},{"name":"vp.trip.schedule_relationship","type":"enum","key":"","desc":"SCHEDULED, ADDED, UNSCHEDULED, CANCELED","group":"VehiclePosition"},{"name":"vp.vehicle.id","type":"text","key":"","desc":"the vehicle as the party names it","group":"VehiclePosition"},{"name":"vp.vehicle.label","type":"text","key":"","desc":"the number riders see","group":"VehiclePosition"},{"name":"vp.position.latitude","type":"number","key":"","desc":"WGS-84","group":"VehiclePosition"},{"name":"vp.position.longitude","type":"number","key":"","desc":"WGS-84","group":"VehiclePosition"},{"name":"vp.position.bearing","type":"number","key":"","desc":"degrees from north","group":"VehiclePosition"},{"name":"vp.position.speed","type":"number","key":"","desc":"metres per second","group":"VehiclePosition"},{"name":"vp.position.odometer","type":"number","key":"","desc":"metres","group":"VehiclePosition"},{"name":"vp.current_stop_sequence","type":"int","key":"","desc":"GTFS stop_sequence of the stop in hand","group":"VehiclePosition"},{"name":"vp.stop_id","type":"text","key":"FK","desc":"the stop in hand","group":"VehiclePosition"},{"name":"vp.current_status","type":"enum","key":"","desc":"INCOMING_AT, STOPPED_AT, IN_TRANSIT_TO","group":"VehiclePosition"},{"name":"vp.timestamp","type":"epoch s","key":"PK","desc":"when the position was measured","group":"VehiclePosition"},{"name":"vp.occupancy_status","type":"enum","key":"","desc":"EMPTY to FULL; some parties publish it","group":"VehiclePosition"},{"name":"vp.occupancy_percentage","type":"int","key":"","desc":"","group":"VehiclePosition"},{"name":"tu.trip.trip_id","type":"text","key":"PK","desc":"","group":"TripUpdate"},{"name":"tu.trip.route_id","type":"text","key":"","desc":"","group":"TripUpdate"},{"name":"tu.trip.start_date","type":"date","key":"","desc":"","group":"TripUpdate"},{"name":"tu.vehicle.id","type":"text","key":"","desc":"","group":"TripUpdate"},{"name":"tu.stop_time_update.stop_sequence","type":"int","key":"PK","desc":"","group":"TripUpdate"},{"name":"tu.stop_time_update.stop_id","type":"text","key":"","desc":"","group":"TripUpdate"},{"name":"tu.stop_time_update.arrival.delay","type":"int s","key":"","desc":"late is positive","group":"TripUpdate"},{"name":"tu.stop_time_update.arrival.time","type":"epoch s","key":"","desc":"the predicted or observed arrival","group":"TripUpdate"},{"name":"tu.stop_time_update.departure.time","type":"epoch s","key":"","desc":"","group":"TripUpdate"},{"name":"tu.stop_time_update.schedule_relationship","type":"enum","key":"","desc":"SCHEDULED, SKIPPED, NO_DATA","group":"TripUpdate"},{"name":"tu.timestamp","type":"epoch s","key":"","desc":"","group":"TripUpdate"},{"name":"tu.delay","type":"int s","key":"","desc":"the trip's current delay, where published","group":"TripUpdate"},{"name":"alert.active_period","type":"range","key":"","desc":"","group":"Alert"},{"name":"alert.informed_entity","type":"list","key":"","desc":"routes, stops, trips named","group":"Alert"},{"name":"alert.cause","type":"enum","key":"","desc":"","group":"Alert"},{"name":"alert.effect","type":"enum","key":"","desc":"NO_SERVICE, DETOUR, SIGNIFICANT_DELAYS and more","group":"Alert"},{"name":"alert.header_text","type":"text","key":"","desc":"","group":"Alert"},{"name":"alert.description_text","type":"text","key":"","desc":"","group":"Alert"}],"id":"rt","status_label":"already standard"},{"lane":"public","layer":"source","row":2,"name":"Weather and events","role":["forecasts, event calendars;","to label an alert: snow, a game"],"status":"planned","shape":"not chosen","grain":"not chosen","keys":"place and time","part":"not chosen","keep":"not chosen","key":"none, open","standard":"","columns":[{"name":"observed_at","type":"datetime","key":"","desc":"not chosen"},{"name":"place","type":"text","key":"","desc":"not chosen"},{"name":"condition","type":"text","key":"","desc":"snow, rain, heat; not chosen"},{"name":"event_name","type":"text","key":"","desc":"not chosen"},{"name":"venue","type":"text","key":"","desc":"not chosen"},{"name":"starts_at","type":"datetime","key":"","desc":"not chosen"}],"id":"weather","status_label":"planned"},{"lane":"region","layer":"source","row":2,"name":"Registry","role":["parties, feeds, contracts, shared stops;","the party id on every regional row"],"status":"planned","shape":"Aurora tables: parties, contracts, shared_stops","grain":"one party; one contract version; one shared stop pair","keys":"party_id; contract_id; party_id, stop_id, neighbour_party","part":"not partitioned","keep":"while the region runs; a leaver's row marked left, kept for audit","key":"region","standard":"","columns":[{"name":"parties.party_id","type":"text","key":"PK","desc":"the id on every regional row","group":"parties"},{"name":"parties.name","type":"text","key":"","desc":"","group":"parties"},{"name":"parties.kind","type":"enum","key":"","desc":"full sharer or feed-only","group":"parties"},{"name":"parties.presto_operator_name","type":"text","key":"","desc":"the name PRESTO writes on a tap from this party; null for a party not on PRESTO (Bike Share)","group":"parties"},{"name":"parties.feed_url_rt","type":"text","key":"","desc":"the GTFS-Realtime address polled","group":"parties"},{"name":"parties.feed_url_gtfs","type":"text","key":"","desc":"the timetable address fetched","group":"parties"},{"name":"parties.status","type":"enum","key":"","desc":"joined, leaving, left","group":"parties"},{"name":"parties.joined_at","type":"datetime","key":"","desc":"","group":"parties"},{"name":"parties.left_at","type":"datetime","key":"","desc":"","group":"parties"},{"name":"parties.key_arn","type":"text","key":"","desc":"the agency's KMS key the region holds a grant on","group":"parties"},{"name":"contracts.contract_id","type":"text","key":"PK","desc":"","group":"contracts"},{"name":"contracts.party_id","type":"text","key":"FK","desc":"","group":"contracts"},{"name":"contracts.name","type":"text","key":"","desc":"live-loads, transfer-totals","group":"contracts"},{"name":"contracts.version","type":"int","key":"","desc":"","group":"contracts"},{"name":"contracts.status","type":"enum","key":"","desc":"drafted, active, retired","group":"contracts"},{"name":"contracts.deadline","type":"text","key":"","desc":"06:00 for the nightly file; within 2 minutes for the loads","group":"contracts"},{"name":"contracts.terms","type":"json","key":"","desc":"the twelve clauses (decision 55)","group":"contracts"},{"name":"shared_stops.party_id","type":"text","key":"PK","desc":"","group":"shared_stops"},{"name":"shared_stops.stop_id","type":"text","key":"PK","desc":"the party's stop id","group":"shared_stops"},{"name":"shared_stops.neighbour_party","type":"text","key":"PK","desc":"","group":"shared_stops"},{"name":"shared_stops.neighbour_stop_id","type":"text","key":"","desc":"the same place in the neighbour's feed","group":"shared_stops"},{"name":"shared_stops.distance_m","type":"number","key":"","desc":"between the two stop points","group":"shared_stops"}],"id":"registry","status_label":"planned"},{"lane":"region","layer":"source","row":3,"name":"Regional transfer table","role":["the transfer use case's Gold, nightly;","each agency's rows under its key"],"status":"planned","shape":"Iceberg table; the contract's row, with the party ids resolved","grain":"to-agency × from-party × route × date × 3-hour band","keys":"party_id, from_party, service_date, to_route, time_band","part":"by party (the to-agency) and service date","keep":"3 years; a leaver's rows deleted, snapshots expired, reports rebuilt","key":"each agency's, by revocable grant","standard":"TIDES station_activities plus extras","columns":[{"name":"party_id","type":"text","key":"PK","desc":"the to-agency: who counted"},{"name":"from_party","type":"text","key":"PK","desc":"the from-operator resolved to a party id; 'unknown' for a name not in the registry"},{"name":"service_date","type":"date","key":"PK","desc":""},{"name":"to_route","type":"text","key":"PK","desc":""},{"name":"time_band","type":"text","key":"PK","desc":""},{"name":"transfers","type":"int","key":"","desc":"null for a party whose file was missing at 06:30"},{"name":"median_wait_min","type":"number","key":"","desc":""},{"name":"share_wait_over_15","type":"number","key":"","desc":""},{"name":"status","type":"enum","key":"","desc":"reported, or unknown when the file was late or missing"},{"name":"contract_version","type":"int","key":"","desc":"the contract the file was checked against"},{"name":"loaded_at","type":"datetime","key":"","desc":""}],"id":"totals","status_label":"planned"},{"lane":"region","layer":"bronze","row":0,"name":"Live lane","role":["positions and loads as received,","in order; 24 hours; region's key"],"status":"planned","shape":"records as received (Kinesis Data Streams), two record kinds","grain":"one record per position or per load row","keys":"party_id, sequence_number","part":"one shard per party","keep":"24 hours","key":"region","standard":"","columns":[{"name":"party_id","type":"text","key":"PK","desc":"from the registry: whose feed, whose adapter","group":"envelope"},{"name":"record_kind","type":"enum","key":"","desc":"position or load","group":"envelope"},{"name":"sequence_number","type":"text","key":"PK","desc":"the stream's order","group":"envelope"},{"name":"arrived_at","type":"datetime","key":"","desc":"","group":"envelope"},{"name":"pos.vehicle_id","type":"text","key":"","desc":"as the feed names it","group":"position record"},{"name":"pos.trip_id","type":"text","key":"","desc":"the timetable trip","group":"position record"},{"name":"pos.route_id","type":"text","key":"","desc":"","group":"position record"},{"name":"pos.direction_id","type":"int","key":"","desc":"","group":"position record"},{"name":"pos.start_date","type":"date","key":"","desc":"the service day","group":"position record"},{"name":"pos.schedule_relationship","type":"enum","key":"","desc":"","group":"position record"},{"name":"pos.latitude","type":"number","key":"","desc":"","group":"position record"},{"name":"pos.longitude","type":"number","key":"","desc":"","group":"position record"},{"name":"pos.bearing","type":"number","key":"","desc":"degrees","group":"position record"},{"name":"pos.speed","type":"number","key":"","desc":"m/s","group":"position record"},{"name":"pos.odometer","type":"number","key":"","desc":"metres","group":"position record"},{"name":"pos.stop_id","type":"text","key":"","desc":"","group":"position record"},{"name":"pos.current_stop_sequence","type":"int","key":"","desc":"","group":"position record"},{"name":"pos.current_status","type":"enum","key":"","desc":"","group":"position record"},{"name":"pos.occupancy_status","type":"enum","key":"","desc":"where published","group":"position record"},{"name":"pos.timestamp","type":"epoch s","key":"","desc":"when measured","group":"position record"},{"name":"load.service_date","type":"date","key":"","desc":"","group":"load record"},{"name":"load.route_id","type":"text","key":"","desc":"","group":"load record"},{"name":"load.direction_id","type":"int","key":"","desc":"","group":"load record"},{"name":"load.stop_id","type":"text","key":"","desc":"","group":"load record"},{"name":"load.window_start","type":"datetime","key":"","desc":"","group":"load record"},{"name":"load.boardings","type":"int","key":"","desc":"","group":"load record"},{"name":"load.alightings","type":"int","key":"","desc":"","group":"load record"},{"name":"load.on_board","type":"int","key":"","desc":"","group":"load record"},{"name":"load.visits","type":"int","key":"","desc":"","group":"load record"}],"id":"lane","status_label":"planned"},{"lane":"region","layer":"silver","row":1,"name":"TIDES vehicle_locations","role":["feed archive: Parquet, Iceberg;","for replays and tuning the bands"],"status":"planned","shape":"TIDES `vehicle_locations` plus extras","grain":"one row per position","keys":"location_ping_id; party_id, service_date, vehicle_id, event_timestamp","part":"by party and service day","keep":"3 years, as costed; a leaver's part deleted at once, snapshots expired","key":"region","standard":"TIDES vehicle_locations","columns":[{"name":"location_ping_id","type":"text","key":"PK","desc":"generated from party, vehicle and time"},{"name":"service_date","type":"date","key":"","desc":"TIDES; the partition"},{"name":"event_timestamp","type":"datetime","key":"","desc":"TIDES"},{"name":"trip_id_performed","type":"text","key":"","desc":"TIDES; the feed's trip id"},{"name":"trip_id_scheduled","type":"text","key":"FK","desc":"TIDES; the same id, as published"},{"name":"scheduled_stop_sequence","type":"int","key":"","desc":"TIDES"},{"name":"vehicle_id","type":"text","key":"","desc":"TIDES"},{"name":"stop_id","type":"text","key":"FK","desc":"TIDES"},{"name":"current_status","type":"enum","key":"","desc":"TIDES"},{"name":"latitude","type":"number","key":"","desc":"TIDES"},{"name":"longitude","type":"number","key":"","desc":"TIDES"},{"name":"heading","type":"number","key":"","desc":"TIDES, degrees"},{"name":"speed","type":"number","key":"","desc":"TIDES, m/s"},{"name":"odometer","type":"number","key":"","desc":"TIDES, metres"},{"name":"schedule_relationship","type":"enum","key":"","desc":"TIDES"},{"name":"party_id","type":"text","key":"PK","desc":"extra: the partition and the leaver's prefix"},{"name":"route_id","type":"text","key":"","desc":"extra: vehicle_locations has no route"},{"name":"direction_id","type":"int","key":"","desc":"extra"},{"name":"occupancy_status","type":"enum","key":"","desc":"extra: as the feed publishes it"}],"id":"archive","status_label":"planned"},{"lane":"region","layer":"silver","row":2,"name":"Timetables","role":["GTFS as published, per party","and version; the standard shape"],"status":"standard","shape":"GTFS, unchanged, plus party and version","grain":"as GTFS","keys":"party_id, feed_version, then each file's own key","part":"by party and feed version","keep":"while the archive covers it","key":"region","standard":"GTFS","columns":[{"name":"party_id","type":"text","key":"PK","desc":"who published it; from the registry","group":"key"},{"name":"feed_version","type":"text","key":"PK","desc":"feed_info.feed_version, or the zip's hash when absent","group":"key"},{"name":"fetched_at","type":"datetime","key":"","desc":"","group":"key"},{"name":"agency.agency_id","type":"text","key":"PK","desc":"the publisher","group":"agency.txt"},{"name":"agency.agency_name","type":"text","key":"","desc":"","group":"agency.txt"},{"name":"agency.agency_timezone","type":"text","key":"","desc":"America/Toronto","group":"agency.txt"},{"name":"stops.stop_id","type":"text","key":"PK","desc":"the stop's id in the feed","group":"stops.txt"},{"name":"stops.stop_code","type":"text","key":"","desc":"the number on the pole; the vendor files' stop number","group":"stops.txt"},{"name":"stops.stop_name","type":"text","key":"","desc":"","group":"stops.txt"},{"name":"stops.stop_lat","type":"number","key":"","desc":"WGS-84","group":"stops.txt"},{"name":"stops.stop_lon","type":"number","key":"","desc":"WGS-84","group":"stops.txt"},{"name":"stops.location_type","type":"int","key":"","desc":"stop, station or entrance","group":"stops.txt"},{"name":"stops.parent_station","type":"text","key":"FK","desc":"stops.stop_id of the station","group":"stops.txt"},{"name":"routes.route_id","type":"text","key":"PK","desc":"","group":"routes.txt"},{"name":"routes.agency_id","type":"text","key":"FK","desc":"","group":"routes.txt"},{"name":"routes.route_short_name","type":"text","key":"","desc":"the route number","group":"routes.txt"},{"name":"routes.route_long_name","type":"text","key":"","desc":"","group":"routes.txt"},{"name":"routes.route_type","type":"int","key":"","desc":"3 is bus","group":"routes.txt"},{"name":"trips.route_id","type":"text","key":"FK","desc":"","group":"trips.txt"},{"name":"trips.service_id","type":"text","key":"FK","desc":"carries the board period","group":"trips.txt"},{"name":"trips.trip_id","type":"text","key":"PK","desc":"the timetable trip","group":"trips.txt"},{"name":"trips.trip_headsign","type":"text","key":"","desc":"","group":"trips.txt"},{"name":"trips.direction_id","type":"int","key":"","desc":"0 or 1","group":"trips.txt"},{"name":"trips.block_id","type":"text","key":"","desc":"","group":"trips.txt"},{"name":"trips.shape_id","type":"text","key":"FK","desc":"","group":"trips.txt"},{"name":"stop_times.trip_id","type":"text","key":"PK","desc":"","group":"stop_times.txt"},{"name":"stop_times.arrival_time","type":"time","key":"","desc":"HH:MM:SS, past 24:00 after midnight","group":"stop_times.txt"},{"name":"stop_times.departure_time","type":"time","key":"","desc":"","group":"stop_times.txt"},{"name":"stop_times.stop_id","type":"text","key":"FK","desc":"","group":"stop_times.txt"},{"name":"stop_times.stop_sequence","type":"int","key":"PK","desc":"increasing along the trip","group":"stop_times.txt"},{"name":"stop_times.timepoint","type":"int","key":"","desc":"1 where the time is exact","group":"stop_times.txt"},{"name":"calendar_dates.service_id","type":"text","key":"PK","desc":"","group":"calendar_dates.txt"},{"name":"calendar_dates.date","type":"date","key":"PK","desc":"YYYYMMDD","group":"calendar_dates.txt"},{"name":"calendar_dates.exception_type","type":"int","key":"","desc":"1 added, 2 removed; this feed has no calendar.txt","group":"calendar_dates.txt"},{"name":"shapes.shape_id","type":"text","key":"PK","desc":"","group":"shapes.txt"},{"name":"shapes.shape_pt_lat","type":"number","key":"","desc":"","group":"shapes.txt"},{"name":"shapes.shape_pt_lon","type":"number","key":"","desc":"","group":"shapes.txt"},{"name":"shapes.shape_pt_sequence","type":"int","key":"PK","desc":"","group":"shapes.txt"},{"name":"feed_info.feed_publisher_name","type":"text","key":"","desc":"","group":"feed_info.txt"},{"name":"feed_info.feed_version","type":"text","key":"","desc":"the version string the publisher sets","group":"feed_info.txt"},{"name":"feed_info.feed_start_date","type":"date","key":"","desc":"","group":"feed_info.txt"},{"name":"feed_info.feed_end_date","type":"date","key":"","desc":"","group":"feed_info.txt"}],"id":"timetables","status_label":"already standard"},{"lane":"region","layer":"gold","row":0,"name":"Last state per vehicle","role":["place, time and counter reading;","what the rules compare against"],"status":"planned","shape":"DynamoDB items of two kinds: a vehicle, a counter","grain":"one item per vehicle, overwritten; one per route and stop for the counters","keys":"pk = party_id; sk = vehicle_id, or route_id and stop_id","part":"by party","keep":"until overwritten; expires a day after the last sighting","key":"region","standard":"","columns":[{"name":"pk","type":"text","key":"PK","desc":"party_id"},{"name":"sk","type":"text","key":"PK","desc":"V#vehicle_id, or C#route_id#stop_id"},{"name":"kind","type":"enum","key":"","desc":"vehicle or counter"},{"name":"last_seen","type":"datetime","key":"","desc":"the newest position's time","group":"vehicle"},{"name":"latitude","type":"number","key":"","desc":"","group":"vehicle"},{"name":"longitude","type":"number","key":"","desc":"","group":"vehicle"},{"name":"stop_id","type":"text","key":"","desc":"","group":"vehicle"},{"name":"trip_id","type":"text","key":"","desc":"","group":"vehicle"},{"name":"route_id","type":"text","key":"","desc":"","group":"vehicle"},{"name":"direction_id","type":"int","key":"","desc":"","group":"vehicle"},{"name":"moved_at","type":"datetime","key":"","desc":"the last time the position changed by more than a few metres","group":"vehicle"},{"name":"jump","type":"bool","key":"","desc":"the last move was faster than a bus can go","group":"vehicle"},{"name":"last_window","type":"datetime","key":"","desc":"the newest load row's window","group":"counter"},{"name":"last_nonzero_window","type":"datetime","key":"","desc":"the last window with anyone counted","group":"counter"},{"name":"zero_windows","type":"int","key":"","desc":"windows in a row with nobody counted","group":"counter"},{"name":"expires_at","type":"datetime","key":"","desc":"a day after last_seen: the table's own expiry"}],"id":"state","status_label":"planned"},{"lane":"region","layer":"gold","row":1,"name":"Delay and load per route","role":["route × direction × 5 minutes;","1,680 series, a band each; 63 days"],"status":"replayed","shape":"CloudWatch metrics; the band is the detector's","grain":"route × direction × 5-minute window, one value per metric","keys":"party_id, route_id, direction_id, metric_name, timestamp","part":"one series per route and direction","keep":"63 days; cannot be deleted sooner","key":"region","standard":"","columns":[{"name":"namespace","type":"text","key":"","desc":"constant"},{"name":"metric_name","type":"enum","key":"PK","desc":"delay_min or on_board"},{"name":"party_id","type":"text","key":"PK","desc":"dimension"},{"name":"route_id","type":"text","key":"PK","desc":"dimension"},{"name":"direction_id","type":"int","key":"PK","desc":"dimension"},{"name":"timestamp","type":"datetime","key":"PK","desc":"the window start"},{"name":"value","type":"number","key":"","desc":"the median delay in minutes, or the mean people on board"},{"name":"sample_count","type":"int","key":"","desc":"vehicles or stops the value is taken over"},{"name":"unit","type":"text","key":"","desc":"Count"},{"name":"expected_low","type":"number","key":"","desc":"the detector's band, learnt from two weeks of history"},{"name":"expected_high","type":"number","key":"","desc":"the detector's band"}],"id":"metrics","status_label":"replayed on the sample"},{"lane":"region","layer":"gold","row":3,"name":"Who is affected","role":["shared stops × last night's","transfer totals; rebuilt nightly"],"status":"planned","shape":"DynamoDB item, built with Athena","grain":"party × route × stop → neighbours and their share","keys":"pk = party_id; sk = route_id#stop_id","part":"by party","keep":"replaced nightly","key":"built under each agency's key, by grant","standard":"","columns":[{"name":"pk","type":"text","key":"PK","desc":"the party whose route is late"},{"name":"sk","type":"text","key":"PK","desc":"route_id#stop_id, a shared stop on the route"},{"name":"neighbours","type":"list","key":"","desc":"one entry per neighbour who takes riders from this route here"},{"name":"neighbours[].party","type":"text","key":"FK","desc":"the neighbour","group":"neighbours"},{"name":"neighbours[].stop_id","type":"text","key":"","desc":"the same place in the neighbour's feed","group":"neighbours"},{"name":"neighbours[].to_route","type":"text","key":"","desc":"the neighbour's route they change to","group":"neighbours"},{"name":"neighbours[].time_band","type":"text","key":"","desc":"3-hour band","group":"neighbours"},{"name":"neighbours[].transfers_typical","type":"int","key":"","desc":"median of the last four weeks' totals","group":"neighbours"},{"name":"neighbours[].share","type":"number","key":"","desc":"of all transfers from this route and stop","group":"neighbours"},{"name":"built_at","type":"datetime","key":"","desc":""}],"id":"affects","status_label":"planned"},{"lane":"region","layer":"out","row":0,"name":"Alerts","role":["kind, party, where, since, seen,","who is affected; kept 13 months"],"status":"replayed","shape":"no TIDES home; the shape the contract names (DynamoDB alert log)","grain":"one row per alert, open or cleared","keys":"alert_id; party_id and month for the partition","part":"by party and month","keep":"13 months at the region; copies stay with receivers","key":"region; each receiver's own","standard":"","columns":[{"name":"alert_id","type":"text","key":"PK","desc":"generated, time-ordered"},{"name":"party_id","type":"text","key":"FK","desc":"whose feed or vehicle"},{"name":"month","type":"text","key":"","desc":"YYYY-MM of since: the partition"},{"name":"kind","type":"enum","key":"","desc":"feed_gap, frozen_vehicle, position_jump, dead_counter, delay_anomaly, load_anomaly"},{"name":"route_id","type":"text","key":"","desc":""},{"name":"direction_id","type":"int","key":"","desc":""},{"name":"vehicle_id","type":"text","key":"","desc":"for a vehicle rule, as the party's feed names it"},{"name":"stop_id","type":"text","key":"","desc":"for a counter rule"},{"name":"since","type":"datetime","key":"","desc":"the first window outside the band, or when the rule fired"},{"name":"until","type":"datetime","key":"","desc":"null while open"},{"name":"expected_low","type":"number","key":"","desc":"the band, for the detector's alerts"},{"name":"expected_high","type":"number","key":"","desc":""},{"name":"seen","type":"number","key":"","desc":"the value that broke it"},{"name":"unit","type":"text","key":"","desc":"minutes late, or people on board"},{"name":"affects","type":"list","key":"","desc":"neighbours, their stops and routes, typical transfers; empty when unknown"},{"name":"label","type":"text","key":"","desc":"planned: snow, an event nearby; null until weather and events are sourced"},{"name":"status","type":"enum","key":"","desc":"open or cleared"},{"name":"created_at","type":"datetime","key":"","desc":""}],"id":"alerts","status_label":"replayed on the sample"},{"lane":"region","layer":"out","row":2,"name":"Live alert feed","role":["open alerts as JSON, to control","rooms and the regional views"],"status":"planned","shape":"JSON over the API","grain":"the open alerts a reader may see","keys":"reader's party; allow-or-deny rules","part":"per request","keep":"not stored","key":"region","standard":"","columns":[{"name":"alert_id","type":"text","key":"PK","desc":""},{"name":"party_id","type":"text","key":"","desc":""},{"name":"kind","type":"enum","key":"","desc":""},{"name":"route_id","type":"text","key":"","desc":""},{"name":"direction_id","type":"int","key":"","desc":""},{"name":"vehicle_id","type":"text","key":"","desc":""},{"name":"stop_id","type":"text","key":"","desc":""},{"name":"since","type":"datetime","key":"","desc":""},{"name":"expected","type":"text","key":"","desc":"low to high, as one string"},{"name":"seen","type":"number","key":"","desc":""},{"name":"unit","type":"text","key":"","desc":""},{"name":"affects","type":"list","key":"","desc":""},{"name":"label","type":"text","key":"","desc":""},{"name":"served_at","type":"datetime","key":"","desc":""}],"id":"feed","status_label":"planned"}],"transforms":[{"id":"T1","name":"Land the vendor exports","short":"Land exports","lane":"agency","col":0.5,"row":0.5,"service":"S3 landing","when":"monthly in the sample; nightly in a live agency","inputs":["avl","apc"],"outputs":["b_avl","b_apc"],"detail":{"grain":"unchanged: one row per trip per stop","joins":["none"],"filters":["none: every byte kept"],"dedup":["none: Bronze is never edited, so Silver can be rebuilt from it"],"nulls":["the string NULL stays a string here"],"units":["seconds past midnight stay seconds"],"privacy":["no fare data in these two files"],"key":"the agency's"},"columns":[{"out":"b_avl.CALENDAR_ID","expr":"avl.CALENDAR_ID","from":["avl.CALENDAR_ID"],"rule":"copy"},{"out":"b_avl.TIME_TABLE_VERSION_NAME","expr":"avl.TIME_TABLE_VERSION_NAME","from":["avl.TIME_TABLE_VERSION_NAME"],"rule":"copy"},{"out":"b_avl.BLOCK_ABBR","expr":"avl.BLOCK_ABBR","from":["avl.BLOCK_ABBR"],"rule":"copy"},{"out":"b_avl.TRIP_ID","expr":"avl.TRIP_ID","from":["avl.TRIP_ID"],"rule":"copy"},{"out":"b_avl.ROUTE_ABBR","expr":"avl.ROUTE_ABBR","from":["avl.ROUTE_ABBR"],"rule":"copy"},{"out":"b_avl.ROUTE_DIRECTION_ABBR","expr":"avl.ROUTE_DIRECTION_ABBR","from":["avl.ROUTE_DIRECTION_ABBR"],"rule":"copy"},{"out":"b_avl.VARIANT","expr":"avl.VARIANT","from":["avl.VARIANT"],"rule":"copy"},{"out":"b_avl.GEO_NODE_ABBR","expr":"avl.GEO_NODE_ABBR","from":["avl.GEO_NODE_ABBR"],"rule":"copy"},{"out":"b_avl.GEO_NAME","expr":"avl.GEO_NAME","from":["avl.GEO_NAME"],"rule":"copy"},{"out":"b_avl.START_TERMINAL","expr":"avl.START_TERMINAL","from":["avl.START_TERMINAL"],"rule":"copy"},{"out":"b_avl.END_TERMINAL","expr":"avl.END_TERMINAL","from":["avl.END_TERMINAL"],"rule":"copy"},{"out":"b_avl.TRIP_EDGE","expr":"avl.TRIP_EDGE","from":["avl.TRIP_EDGE"],"rule":"copy"},{"out":"b_avl.TIME_POINT_ID","expr":"avl.TIME_POINT_ID","from":["avl.TIME_POINT_ID"],"rule":"copy"},{"out":"b_avl.TIME_POINT_ABBR","expr":"avl.TIME_POINT_ABBR","from":["avl.TIME_POINT_ABBR"],"rule":"copy"},{"out":"b_avl.TIME_POINT_NAME","expr":"avl.TIME_POINT_NAME","from":["avl.TIME_POINT_NAME"],"rule":"copy"},{"out":"b_avl.SERVICE_ABBR","expr":"avl.SERVICE_ABBR","from":["avl.SERVICE_ABBR"],"rule":"copy"},{"out":"b_avl.SCHED_TRIP_START","expr":"avl.SCHED_TRIP_START","from":["avl.SCHED_TRIP_START"],"rule":"copy"},{"out":"b_avl.SCHED_TRIP_END","expr":"avl.SCHED_TRIP_END","from":["avl.SCHED_TRIP_END"],"rule":"copy"},{"out":"b_avl.SCHED_TRIP_DURATION","expr":"avl.SCHED_TRIP_DURATION","from":["avl.SCHED_TRIP_DURATION"],"rule":"copy"},{"out":"b_avl.SCHED_TIME_PER_STOP","expr":"avl.SCHED_TIME_PER_STOP","from":["avl.SCHED_TIME_PER_STOP"],"rule":"copy"},{"out":"b_avl.ACTUAL_TRIP_DURATION","expr":"avl.ACTUAL_TRIP_DURATION","from":["avl.ACTUAL_TRIP_DURATION"],"rule":"copy"},{"out":"b_avl.ACTUAL_ARRIVAL_TIME","expr":"avl.ACTUAL_ARRIVAL_TIME","from":["avl.ACTUAL_ARRIVAL_TIME"],"rule":"copy"},{"out":"b_avl.ACTUAL_DEPARTURE_TIME","expr":"avl.ACTUAL_DEPARTURE_TIME","from":["avl.ACTUAL_DEPARTURE_TIME"],"rule":"copy"},{"out":"b_avl.DWELLING_TIME","expr":"avl.DWELLING_TIME","from":["avl.DWELLING_TIME"],"rule":"copy"},{"out":"b_avl.ADHERENCE_IN_SECS","expr":"avl.ADHERENCE_IN_SECS","from":["avl.ADHERENCE_IN_SECS"],"rule":"copy"},{"out":"b_avl.KPI","expr":"avl.KPI","from":["avl.KPI"],"rule":"copy"},{"out":"b_avl._source_file","expr":"the export's file name","from":[],"rule":"generate"},{"out":"b_avl._landed_at","expr":"now()","from":[],"rule":"generate"},{"out":"b_apc.TIME_TABLE_VERSION_NAME","expr":"apc.TIME_TABLE_VERSION_NAME","from":["apc.TIME_TABLE_VERSION_NAME"],"rule":"copy"},{"out":"b_apc.CALENDAR_ID","expr":"apc.CALENDAR_ID","from":["apc.CALENDAR_ID"],"rule":"copy"},{"out":"b_apc.BLOCK_ABBR","expr":"apc.BLOCK_ABBR","from":["apc.BLOCK_ABBR"],"rule":"copy"},{"out":"b_apc.TRIP_ID","expr":"apc.TRIP_ID","from":["apc.TRIP_ID"],"rule":"copy"},{"out":"b_apc.ROUTE_ABBR","expr":"apc.ROUTE_ABBR","from":["apc.ROUTE_ABBR"],"rule":"copy"},{"out":"b_apc.ROUTE_DIRECTION_ABBR","expr":"apc.ROUTE_DIRECTION_ABBR","from":["apc.ROUTE_DIRECTION_ABBR"],"rule":"copy"},{"out":"b_apc.VARIANT","expr":"apc.VARIANT","from":["apc.VARIANT"],"rule":"copy"},{"out":"b_apc.PATTERN_STOP_SEQUENCE","expr":"apc.PATTERN_STOP_SEQUENCE","from":["apc.PATTERN_STOP_SEQUENCE"],"rule":"copy"},{"out":"b_apc.STOP_NUMBER","expr":"apc.STOP_NUMBER","from":["apc.STOP_NUMBER"],"rule":"copy"},{"out":"b_apc.STOP_NAME","expr":"apc.STOP_NAME","from":["apc.STOP_NAME"],"rule":"copy"},{"out":"b_apc.TOTAL_CAPACITY","expr":"apc.TOTAL_CAPACITY","from":["apc.TOTAL_CAPACITY"],"rule":"copy"},{"out":"b_apc.SEATING_CAPACITY","expr":"apc.SEATING_CAPACITY","from":["apc.SEATING_CAPACITY"],"rule":"copy"},{"out":"b_apc.BOARD","expr":"apc.BOARD","from":["apc.BOARD"],"rule":"copy"},{"out":"b_apc.ALIGHT","expr":"apc.ALIGHT","from":["apc.ALIGHT"],"rule":"copy"},{"out":"b_apc.DEPARTURE_LOAD","expr":"apc.DEPARTURE_LOAD","from":["apc.DEPARTURE_LOAD"],"rule":"copy"},{"out":"b_apc.SERVICE_ABBR","expr":"apc.SERVICE_ABBR","from":["apc.SERVICE_ABBR"],"rule":"copy"},{"out":"b_apc.TRIP_BEGIN_TIME","expr":"apc.TRIP_BEGIN_TIME","from":["apc.TRIP_BEGIN_TIME"],"rule":"copy"},{"out":"b_apc.TRIP_END_TIME","expr":"apc.TRIP_END_TIME","from":["apc.TRIP_END_TIME"],"rule":"copy"},{"out":"b_apc._source_file","expr":"the export's file name","from":[],"rule":"generate"},{"out":"b_apc._landed_at","expr":"now()","from":[],"rule":"generate"}],"drops":[]},{"id":"T2","name":"Conform the exports to TIDES stop_visits and trips_performed","short":"Conform to TIDES","lane":"agency","col":1.5,"row":0.5,"service":"the adapter (Glue ETL or Lambda)","when":"per service day","inputs":["b_avl","b_apc","gtfs"],"outputs":["a_silver","a_trips"],"detail":{"grain":"AVL row per trip per stop → one stop visit; the APC records of one visit collapsed into it; one trips_performed row per trip","joins":["AVL ⟕ APC on CALENDAR_ID, TRIP_ID, ROUTE_ABBR, GEO_NODE_ABBR = STOP_NUMBER, int(GEO_NAME prefix) = PATTERN_STOP_SEQUENCE (the four-column key alone collides on loop routes)","stop_id must exist in the party's GTFS stops (100% in the sample)","trip map: (TRIP_ID, service day) → GTFS trips.trip_id by matching the day's scheduled stop times; 99.78% of 136,684 trip-days match one trip exactly, 99.97% within 60 s","routes.route_short_name = ROUTE_ABBR → route_id"],"filters":["an APC record with no AVL skeleton row cannot be placed and is counted, not written (none in the sample)"],"dedup":["several APC records of one visit are summed for counts and take the max load (20,077 visits in the sample)","primary key service_date, trip_id_performed, trip_stop_sequence checked unique; sequence must run 1, 2, 3"],"nulls":["the string NULL → null","vehicle_id null: the export has no vehicle id","scheduled_stop_sequence null until the trip map fills it"],"units":["seconds past midnight → timestamps on the service day; 809,097 values at or past 86,400 roll to the next calendar day"],"privacy":["no rider data in these files"],"key":"the agency's; the region never reads these tables"},"columns":[{"out":"a_silver.service_date","expr":"date(CALENDAR_ID[1:], 'YYYYMMDD')","from":["b_avl.CALENDAR_ID"],"rule":"derive"},{"out":"a_silver.trip_id_performed","expr":"TRIP_ID","from":["b_avl.TRIP_ID"],"rule":"copy"},{"out":"a_silver.trip_stop_sequence","expr":"int(GEO_NAME before ' - ')","from":["b_avl.GEO_NAME"],"rule":"derive"},{"out":"a_silver.scheduled_stop_sequence","expr":"null; planned: stop_times.stop_sequence of trip_id_scheduled at this stop","from":["gtfs.stop_times.stop_sequence"],"rule":"null"},{"out":"a_silver.pattern_id","expr":"ROUTE_ABBR || '-' || ROUTE_DIRECTION_ABBR || '-' || VARIANT","from":["b_avl.ROUTE_ABBR","b_avl.ROUTE_DIRECTION_ABBR","b_avl.VARIANT"],"rule":"derive"},{"out":"a_silver.vehicle_id","expr":"null (BLOCK_ABBR is a block, not a vehicle)","from":["b_avl.BLOCK_ABBR"],"rule":"null"},{"out":"a_silver.dwell","expr":"int(DWELLING_TIME)","from":["b_avl.DWELLING_TIME"],"rule":"copy"},{"out":"a_silver.stop_id","expr":"GEO_NODE_ABBR, checked against stops.stop_id","from":["b_avl.GEO_NODE_ABBR","gtfs.stops.stop_id"],"rule":"join"},{"out":"a_silver.timepoint","expr":"TIME_POINT_ID is not null","from":["b_avl.TIME_POINT_ID"],"rule":"derive"},{"out":"a_silver.schedule_arrival_time","expr":"service_date + SCHED_TIME_PER_STOP seconds","from":["b_avl.CALENDAR_ID","b_avl.SCHED_TIME_PER_STOP"],"rule":"derive"},{"out":"a_silver.schedule_departure_time","expr":"service_date + SCHED_TIME_PER_STOP seconds (one scheduled time per stop)","from":["b_avl.CALENDAR_ID","b_avl.SCHED_TIME_PER_STOP"],"rule":"derive"},{"out":"a_silver.actual_arrival_time","expr":"service_date + ACTUAL_ARRIVAL_TIME seconds","from":["b_avl.CALENDAR_ID","b_avl.ACTUAL_ARRIVAL_TIME"],"rule":"derive"},{"out":"a_silver.actual_departure_time","expr":"service_date + ACTUAL_DEPARTURE_TIME seconds","from":["b_avl.CALENDAR_ID","b_avl.ACTUAL_DEPARTURE_TIME"],"rule":"derive"},{"out":"a_silver.boarding_1","expr":"Σ BOARD over the visit's APC records","from":["b_apc.BOARD"],"rule":"aggregate"},{"out":"a_silver.alighting_1","expr":"Σ ALIGHT over the visit's APC records","from":["b_apc.ALIGHT"],"rule":"aggregate"},{"out":"a_silver.departure_load","expr":"max(DEPARTURE_LOAD) over the visit's APC records","from":["b_apc.DEPARTURE_LOAD"],"rule":"aggregate"},{"out":"a_silver.schedule_relationship","expr":"'Scheduled' if a time or a count was observed, else 'Missing'","from":["b_avl.ACTUAL_ARRIVAL_TIME","b_avl.ACTUAL_DEPARTURE_TIME","b_apc.BOARD"],"rule":"derive"},{"out":"a_trips.service_date","expr":"date(CALENDAR_ID[1:], 'YYYYMMDD')","from":["b_avl.CALENDAR_ID"],"rule":"derive"},{"out":"a_trips.trip_id_performed","expr":"TRIP_ID","from":["b_avl.TRIP_ID"],"rule":"copy"},{"out":"a_trips.vehicle_id","expr":"null: not exported; required by TIDES","from":[],"rule":"null"},{"out":"a_trips.trip_id_scheduled","expr":"trip map: the GTFS trip whose stop_times match the day's SCHED_TIME_PER_STOP at each GEO_NODE_ABBR","from":["b_avl.TRIP_ID","b_avl.SCHED_TIME_PER_STOP","b_avl.GEO_NODE_ABBR","gtfs.stop_times.trip_id","gtfs.stop_times.arrival_time","gtfs.stop_times.stop_id"],"rule":"join"},{"out":"a_trips.route_id","expr":"routes.route_id where routes.route_short_name = ROUTE_ABBR","from":["b_avl.ROUTE_ABBR","gtfs.routes.route_id","gtfs.routes.route_short_name"],"rule":"join"},{"out":"a_trips.route_type","expr":"routes.route_type","from":["gtfs.routes.route_type"],"rule":"join"},{"out":"a_trips.direction_id","expr":"trips.direction_id of trip_id_scheduled","from":["gtfs.trips.trip_id","gtfs.trips.direction_id"],"rule":"join"},{"out":"a_trips.block_id","expr":"BLOCK_ABBR","from":["b_avl.BLOCK_ABBR"],"rule":"copy"},{"out":"a_trips.shape_id","expr":"trips.shape_id of trip_id_scheduled","from":["gtfs.trips.shape_id"],"rule":"join"},{"out":"a_trips.pattern_id","expr":"ROUTE_ABBR || '-' || ROUTE_DIRECTION_ABBR || '-' || VARIANT","from":["b_avl.ROUTE_ABBR","b_avl.ROUTE_DIRECTION_ABBR","b_avl.VARIANT"],"rule":"derive"},{"out":"a_trips.trip_start_stop_id","expr":"GEO_NODE_ABBR where TRIP_EDGE is first","from":["b_avl.GEO_NODE_ABBR","b_avl.TRIP_EDGE"],"rule":"derive"},{"out":"a_trips.trip_end_stop_id","expr":"GEO_NODE_ABBR where TRIP_EDGE is last","from":["b_avl.GEO_NODE_ABBR","b_avl.TRIP_EDGE"],"rule":"derive"},{"out":"a_trips.schedule_trip_start","expr":"service_date + SCHED_TRIP_START seconds","from":["b_avl.CALENDAR_ID","b_avl.SCHED_TRIP_START"],"rule":"derive"},{"out":"a_trips.schedule_trip_end","expr":"service_date + SCHED_TRIP_END seconds","from":["b_avl.CALENDAR_ID","b_avl.SCHED_TRIP_END"],"rule":"derive"},{"out":"a_trips.actual_trip_start","expr":"service_date + ACTUAL_DEPARTURE_TIME at the first stop","from":["b_avl.CALENDAR_ID","b_avl.ACTUAL_DEPARTURE_TIME","b_avl.TRIP_EDGE"],"rule":"derive"},{"out":"a_trips.actual_trip_end","expr":"service_date + ACTUAL_ARRIVAL_TIME at the last stop","from":["b_avl.CALENDAR_ID","b_avl.ACTUAL_ARRIVAL_TIME","b_avl.TRIP_EDGE"],"rule":"derive"},{"out":"a_trips.schedule_relationship","expr":"'Scheduled' if any stop was observed, else 'Canceled'","from":["b_avl.ACTUAL_ARRIVAL_TIME"],"rule":"derive"}],"drops":[{"col":"b_avl.ADHERENCE_IN_SECS","why":"recomputable from scheduled and actual; the file's sign is reversed"},{"col":"b_avl.KPI","why":"the vendor's label with agency thresholds; never shared as-is"},{"col":"b_avl.SCHED_TRIP_DURATION","why":"recomputable"},{"col":"b_avl.ACTUAL_TRIP_DURATION","why":"recomputable"},{"col":"b_avl.TIME_POINT_ABBR","why":"display"},{"col":"b_avl.TIME_POINT_NAME","why":"display"},{"col":"b_avl.START_TERMINAL","why":"display"},{"col":"b_avl.END_TERMINAL","why":"display"},{"col":"b_avl.SERVICE_ABBR","why":"derivable from calendar_dates"},{"col":"b_avl.TIME_TABLE_VERSION_NAME","why":"carried by trip_id_scheduled's service_id"},{"col":"b_apc.TOTAL_CAPACITY","why":"no TIDES home without a vehicle id; the load-over-capacity flag (2,251 visits) is raised before it is dropped"},{"col":"b_apc.SEATING_CAPACITY","why":"no TIDES home without a vehicle id"},{"col":"b_apc.STOP_NAME","why":"display"},{"col":"b_apc.TRIP_BEGIN_TIME","why":"the AVL times are kept instead"},{"col":"b_apc.TRIP_END_TIME","why":"the AVL times are kept instead"}]},{"id":"T3","name":"Sum the visits into 5-minute loads","short":"Sum per 5 min","lane":"agency","col":2.5,"row":0,"service":"the adapter (Lambda)","when":"every 5 minutes, for the window just closed","inputs":["a_silver","a_trips"],"outputs":["a_gold"],"detail":{"grain":"stop visit → route × direction × stop × 5-minute window","joins":["stop_visits ⋈ trips_performed on service_date, trip_id_performed, for route_id and direction_id"],"filters":["actual_departure_time not null","schedule_relationship = Scheduled"],"dedup":["none needed: Silver's key is unique"],"nulls":["a window with no visit has no row; the region shows unknown, never zero"],"units":["counts of people; the window is the departure time floored to 5 minutes"],"privacy":["counts only, no minimum group size (decision 21); nothing about a rider or a card"],"key":"the agency's, until the push"},"columns":[{"out":"a_gold.service_date","expr":"service_date","from":["a_silver.service_date"],"rule":"copy"},{"out":"a_gold.route_id","expr":"trips_performed.route_id","from":["a_trips.route_id","a_silver.trip_id_performed","a_trips.trip_id_performed"],"rule":"join"},{"out":"a_gold.direction_id","expr":"trips_performed.direction_id","from":["a_trips.direction_id"],"rule":"join"},{"out":"a_gold.stop_id","expr":"stop_id","from":["a_silver.stop_id"],"rule":"copy"},{"out":"a_gold.window_start","expr":"floor(actual_departure_time, 5 min)","from":["a_silver.actual_departure_time"],"rule":"derive"},{"out":"a_gold.boardings","expr":"Σ boarding_1","from":["a_silver.boarding_1"],"rule":"aggregate"},{"out":"a_gold.alightings","expr":"Σ alighting_1","from":["a_silver.alighting_1"],"rule":"aggregate"},{"out":"a_gold.on_board","expr":"mean(departure_load) over the window's visits (decision 60: a mean, as the replay took it)","from":["a_silver.departure_load"],"rule":"aggregate"},{"out":"a_gold.visits","expr":"count(*)","from":["a_silver.trip_id_performed"],"rule":"aggregate"}],"drops":[]},{"id":"T4","name":"Push the loads to the live lane","short":"Push loads","lane":"agency","col":3.5,"row":0,"service":"the adapter (Lambda), in the agency's account","when":"every 5 minutes, within 2 of the window closing","inputs":["a_gold"],"outputs":["lane"],"detail":{"grain":"unchanged: one lane record per load row","joins":["the adapter's credentials name the party; the registry must hold an active live-loads contract"],"filters":["only closed windows","a row late by more than 2 minutes still goes, flagged by the rules on arrival as late"],"dedup":["the lane keeps every record; the same window sent twice is two records, collapsed by the readers on window_start"],"nulls":["none introduced"],"units":["unchanged"],"privacy":["counts only; the contract's privacy clause"],"key":"TLS in flight; the region's key on arrival (decision 54), 24 hours"},"columns":[{"out":"lane.party_id","expr":"the adapter's party, from its credentials and the registry","from":[],"rule":"generate"},{"out":"lane.record_kind","expr":"'load'","from":[],"rule":"constant"},{"out":"lane.sequence_number","expr":"assigned by the stream","from":[],"rule":"generate"},{"out":"lane.arrived_at","expr":"now()","from":[],"rule":"generate"},{"out":"lane.load.service_date","expr":"service_date","from":["a_gold.service_date"],"rule":"copy"},{"out":"lane.load.route_id","expr":"route_id","from":["a_gold.route_id"],"rule":"copy"},{"out":"lane.load.direction_id","expr":"direction_id","from":["a_gold.direction_id"],"rule":"copy"},{"out":"lane.load.stop_id","expr":"stop_id","from":["a_gold.stop_id"],"rule":"copy"},{"out":"lane.load.window_start","expr":"window_start","from":["a_gold.window_start"],"rule":"copy"},{"out":"lane.load.boardings","expr":"boardings","from":["a_gold.boardings"],"rule":"copy"},{"out":"lane.load.alightings","expr":"alightings","from":["a_gold.alightings"],"rule":"copy"},{"out":"lane.load.on_board","expr":"on_board","from":["a_gold.on_board"],"rule":"copy"},{"out":"lane.load.visits","expr":"visits","from":["a_gold.visits"],"rule":"copy"}],"drops":[]},{"id":"T5","name":"Poll every registered party's live feed","short":"Poll feeds","lane":"region","col":0.5,"row":"gap","service":"ECS on Fargate · poller","when":"every 10 s","inputs":["rt","registry"],"outputs":["lane"],"detail":{"grain":"one VehiclePosition entity → one lane record","joins":["registry.parties.feed_url_rt names the feed; the party id comes with it"],"filters":["only parties with status joined; a leaver is not watched (decision 54)","TripUpdate and Alert entities are read for the archive's deviation and the alert label, not written to the lane in v1"],"dedup":["a position with the same vehicle and timestamp as the last one polled is dropped (a repeated feed), so a frozen vehicle is one that moves in time but not in place"],"nulls":["fields a party does not publish stay null; occupancy is optional"],"units":["GTFS-Realtime's: WGS-84 degrees, m/s, metres, epoch seconds"],"privacy":["public data"],"key":"the region's"},"columns":[{"out":"lane.party_id","expr":"parties.party_id of the feed polled","from":["registry.parties.party_id","registry.parties.feed_url_rt"],"rule":"join"},{"out":"lane.record_kind","expr":"'position'","from":[],"rule":"constant"},{"out":"lane.sequence_number","expr":"assigned by the stream","from":[],"rule":"generate"},{"out":"lane.arrived_at","expr":"now()","from":[],"rule":"generate"},{"out":"lane.pos.vehicle_id","expr":"vp.vehicle.id","from":["rt.vp.vehicle.id"],"rule":"copy"},{"out":"lane.pos.trip_id","expr":"vp.trip.trip_id","from":["rt.vp.trip.trip_id"],"rule":"copy"},{"out":"lane.pos.route_id","expr":"vp.trip.route_id","from":["rt.vp.trip.route_id"],"rule":"copy"},{"out":"lane.pos.direction_id","expr":"vp.trip.direction_id","from":["rt.vp.trip.direction_id"],"rule":"copy"},{"out":"lane.pos.start_date","expr":"vp.trip.start_date","from":["rt.vp.trip.start_date"],"rule":"copy"},{"out":"lane.pos.schedule_relationship","expr":"vp.trip.schedule_relationship","from":["rt.vp.trip.schedule_relationship"],"rule":"copy"},{"out":"lane.pos.latitude","expr":"vp.position.latitude","from":["rt.vp.position.latitude"],"rule":"copy"},{"out":"lane.pos.longitude","expr":"vp.position.longitude","from":["rt.vp.position.longitude"],"rule":"copy"},{"out":"lane.pos.bearing","expr":"vp.position.bearing","from":["rt.vp.position.bearing"],"rule":"copy"},{"out":"lane.pos.speed","expr":"vp.position.speed","from":["rt.vp.position.speed"],"rule":"copy"},{"out":"lane.pos.odometer","expr":"vp.position.odometer","from":["rt.vp.position.odometer"],"rule":"copy"},{"out":"lane.pos.stop_id","expr":"vp.stop_id","from":["rt.vp.stop_id"],"rule":"copy"},{"out":"lane.pos.current_stop_sequence","expr":"vp.current_stop_sequence","from":["rt.vp.current_stop_sequence"],"rule":"copy"},{"out":"lane.pos.current_status","expr":"vp.current_status","from":["rt.vp.current_status"],"rule":"copy"},{"out":"lane.pos.occupancy_status","expr":"vp.occupancy_status","from":["rt.vp.occupancy_status"],"rule":"copy"},{"out":"lane.pos.timestamp","expr":"vp.timestamp, else header.timestamp","from":["rt.vp.timestamp","rt.header.timestamp"],"rule":"derive"}],"drops":[]},{"id":"T6","name":"Fetch each party's timetable when it changes","short":"Fetch timetables","lane":"region","col":1.5,"row":"gap","service":"ECS on Fargate · poller","when":"when the published zip changes (its hash)","inputs":["gtfs","registry"],"outputs":["timetables"],"detail":{"grain":"unchanged: GTFS file by file","joins":["registry.parties.feed_url_gtfs names the zip; the party id comes with it"],"filters":["only parties with status joined"],"dedup":["a zip with a hash already stored is not stored again"],"nulls":["optional GTFS columns stay empty as published"],"units":["GTFS's: HH:MM:SS past 24:00 after midnight; YYYYMMDD"],"privacy":["public data"],"key":"the region's"},"columns":[{"out":"timetables.party_id","expr":"parties.party_id of the feed fetched","from":["registry.parties.party_id","registry.parties.feed_url_gtfs"],"rule":"join"},{"out":"timetables.feed_version","expr":"feed_info.feed_version, else sha256(zip)","from":["gtfs.feed_info.feed_version"],"rule":"derive"},{"out":"timetables.fetched_at","expr":"now()","from":[],"rule":"generate"},{"out":"timetables.agency.agency_id","expr":"agency.agency_id","from":["gtfs.agency.agency_id"],"rule":"copy"},{"out":"timetables.agency.agency_name","expr":"agency.agency_name","from":["gtfs.agency.agency_name"],"rule":"copy"},{"out":"timetables.agency.agency_timezone","expr":"agency.agency_timezone","from":["gtfs.agency.agency_timezone"],"rule":"copy"},{"out":"timetables.stops.stop_id","expr":"stops.stop_id","from":["gtfs.stops.stop_id"],"rule":"copy"},{"out":"timetables.stops.stop_code","expr":"stops.stop_code","from":["gtfs.stops.stop_code"],"rule":"copy"},{"out":"timetables.stops.stop_name","expr":"stops.stop_name","from":["gtfs.stops.stop_name"],"rule":"copy"},{"out":"timetables.stops.stop_lat","expr":"stops.stop_lat","from":["gtfs.stops.stop_lat"],"rule":"copy"},{"out":"timetables.stops.stop_lon","expr":"stops.stop_lon","from":["gtfs.stops.stop_lon"],"rule":"copy"},{"out":"timetables.stops.location_type","expr":"stops.location_type","from":["gtfs.stops.location_type"],"rule":"copy"},{"out":"timetables.stops.parent_station","expr":"stops.parent_station","from":["gtfs.stops.parent_station"],"rule":"copy"},{"out":"timetables.routes.route_id","expr":"routes.route_id","from":["gtfs.routes.route_id"],"rule":"copy"},{"out":"timetables.routes.agency_id","expr":"routes.agency_id","from":["gtfs.routes.agency_id"],"rule":"copy"},{"out":"timetables.routes.route_short_name","expr":"routes.route_short_name","from":["gtfs.routes.route_short_name"],"rule":"copy"},{"out":"timetables.routes.route_long_name","expr":"routes.route_long_name","from":["gtfs.routes.route_long_name"],"rule":"copy"},{"out":"timetables.routes.route_type","expr":"routes.route_type","from":["gtfs.routes.route_type"],"rule":"copy"},{"out":"timetables.trips.route_id","expr":"trips.route_id","from":["gtfs.trips.route_id"],"rule":"copy"},{"out":"timetables.trips.service_id","expr":"trips.service_id","from":["gtfs.trips.service_id"],"rule":"copy"},{"out":"timetables.trips.trip_id","expr":"trips.trip_id","from":["gtfs.trips.trip_id"],"rule":"copy"},{"out":"timetables.trips.trip_headsign","expr":"trips.trip_headsign","from":["gtfs.trips.trip_headsign"],"rule":"copy"},{"out":"timetables.trips.direction_id","expr":"trips.direction_id","from":["gtfs.trips.direction_id"],"rule":"copy"},{"out":"timetables.trips.block_id","expr":"trips.block_id","from":["gtfs.trips.block_id"],"rule":"copy"},{"out":"timetables.trips.shape_id","expr":"trips.shape_id","from":["gtfs.trips.shape_id"],"rule":"copy"},{"out":"timetables.stop_times.trip_id","expr":"stop_times.trip_id","from":["gtfs.stop_times.trip_id"],"rule":"copy"},{"out":"timetables.stop_times.arrival_time","expr":"stop_times.arrival_time","from":["gtfs.stop_times.arrival_time"],"rule":"copy"},{"out":"timetables.stop_times.departure_time","expr":"stop_times.departure_time","from":["gtfs.stop_times.departure_time"],"rule":"copy"},{"out":"timetables.stop_times.stop_id","expr":"stop_times.stop_id","from":["gtfs.stop_times.stop_id"],"rule":"copy"},{"out":"timetables.stop_times.stop_sequence","expr":"stop_times.stop_sequence","from":["gtfs.stop_times.stop_sequence"],"rule":"copy"},{"out":"timetables.stop_times.timepoint","expr":"stop_times.timepoint","from":["gtfs.stop_times.timepoint"],"rule":"copy"},{"out":"timetables.calendar_dates.service_id","expr":"calendar_dates.service_id","from":["gtfs.calendar_dates.service_id"],"rule":"copy"},{"out":"timetables.calendar_dates.date","expr":"calendar_dates.date","from":["gtfs.calendar_dates.date"],"rule":"copy"},{"out":"timetables.calendar_dates.exception_type","expr":"calendar_dates.exception_type","from":["gtfs.calendar_dates.exception_type"],"rule":"copy"},{"out":"timetables.shapes.shape_id","expr":"shapes.shape_id","from":["gtfs.shapes.shape_id"],"rule":"copy"},{"out":"timetables.shapes.shape_pt_lat","expr":"shapes.shape_pt_lat","from":["gtfs.shapes.shape_pt_lat"],"rule":"copy"},{"out":"timetables.shapes.shape_pt_lon","expr":"shapes.shape_pt_lon","from":["gtfs.shapes.shape_pt_lon"],"rule":"copy"},{"out":"timetables.shapes.shape_pt_sequence","expr":"shapes.shape_pt_sequence","from":["gtfs.shapes.shape_pt_sequence"],"rule":"copy"},{"out":"timetables.feed_info.feed_publisher_name","expr":"feed_info.feed_publisher_name","from":["gtfs.feed_info.feed_publisher_name"],"rule":"copy"},{"out":"timetables.feed_info.feed_version","expr":"feed_info.feed_version","from":["gtfs.feed_info.feed_version"],"rule":"copy"},{"out":"timetables.feed_info.feed_start_date","expr":"feed_info.feed_start_date","from":["gtfs.feed_info.feed_start_date"],"rule":"copy"},{"out":"timetables.feed_info.feed_end_date","expr":"feed_info.feed_end_date","from":["gtfs.feed_info.feed_end_date"],"rule":"copy"}],"drops":[]},{"id":"T7","name":"Archive the lane as TIDES vehicle_locations","short":"Archive lane","lane":"region","col":1.5,"row":1,"service":"Data Firehose → S3 + Iceberg","when":"batched, within 5 minutes","inputs":["lane"],"outputs":["archive"],"detail":{"grain":"one position record → one row","joins":["none"],"filters":["record_kind = position; whether loads are archived too is open (decision 56)"],"dedup":["location_ping_id unique: a replayed shard writes no second row"],"nulls":["a missing start_date takes the service day of the timestamp, 04:00 rule"],"units":["epoch seconds → UTC timestamps; bearing → heading in degrees; speed stays m/s"],"privacy":["public positions; no rider"],"key":"the region's; split by party so a leaver's part is one prefix delete"},"columns":[{"out":"archive.location_ping_id","expr":"sha1(party_id, pos.vehicle_id, pos.timestamp)","from":["lane.party_id","lane.pos.vehicle_id","lane.pos.timestamp"],"rule":"generate"},{"out":"archive.service_date","expr":"pos.start_date, else the service day of pos.timestamp","from":["lane.pos.start_date","lane.pos.timestamp"],"rule":"derive"},{"out":"archive.event_timestamp","expr":"to_timestamp(pos.timestamp)","from":["lane.pos.timestamp"],"rule":"derive"},{"out":"archive.trip_id_performed","expr":"pos.trip_id","from":["lane.pos.trip_id"],"rule":"copy"},{"out":"archive.trip_id_scheduled","expr":"pos.trip_id (the feed names the timetable trip)","from":["lane.pos.trip_id"],"rule":"copy"},{"out":"archive.scheduled_stop_sequence","expr":"pos.current_stop_sequence","from":["lane.pos.current_stop_sequence"],"rule":"copy"},{"out":"archive.vehicle_id","expr":"pos.vehicle_id","from":["lane.pos.vehicle_id"],"rule":"copy"},{"out":"archive.stop_id","expr":"pos.stop_id","from":["lane.pos.stop_id"],"rule":"copy"},{"out":"archive.current_status","expr":"pos.current_status","from":["lane.pos.current_status"],"rule":"copy"},{"out":"archive.latitude","expr":"pos.latitude","from":["lane.pos.latitude"],"rule":"copy"},{"out":"archive.longitude","expr":"pos.longitude","from":["lane.pos.longitude"],"rule":"copy"},{"out":"archive.heading","expr":"pos.bearing","from":["lane.pos.bearing"],"rule":"copy"},{"out":"archive.speed","expr":"pos.speed","from":["lane.pos.speed"],"rule":"copy"},{"out":"archive.odometer","expr":"pos.odometer","from":["lane.pos.odometer"],"rule":"copy"},{"out":"archive.schedule_relationship","expr":"pos.schedule_relationship","from":["lane.pos.schedule_relationship"],"rule":"copy"},{"out":"archive.party_id","expr":"party_id","from":["lane.party_id"],"rule":"copy"},{"out":"archive.route_id","expr":"pos.route_id","from":["lane.pos.route_id"],"rule":"copy"},{"out":"archive.direction_id","expr":"pos.direction_id","from":["lane.pos.direction_id"],"rule":"copy"},{"out":"archive.occupancy_status","expr":"pos.occupancy_status","from":["lane.pos.occupancy_status"],"rule":"copy"}],"drops":[]},{"id":"T8","name":"Keep the last state per vehicle and counter; run the rules","short":"Rules → last state","lane":"region","col":2.5,"row":0,"service":"Lambda · rules","when":"on every record; rules checked each minute","inputs":["lane"],"outputs":["state"],"detail":{"grain":"one record → one item overwritten: per vehicle for positions, per route and stop for loads","joins":["the item read before it is written: the rules compare new against last"],"filters":["feed gap: no record from a party for 60 s while the heartbeat says the poller is alive","frozen: a vehicle on a trip whose moved_at is older than a threshold (proposed 10 minutes)","jump: the last move faster than a bus can go (proposed 40 m/s)","dead counter: a route and stop with nobody counted for a run of windows (proposed 36, three hours) while vehicles passed","loads late or off-contract: last_window older than 2 windows for a party under contract"],"dedup":["a record older than the item's last_seen is ignored"],"nulls":["a party not sharing loads has no counter items: crowding shows unknown"],"units":["metres and seconds for the thresholds; the thresholds are parameters to tune, not decided"],"privacy":["a vehicle as its own feed names it; no rider"],"key":"the region's; expires a day after the last sighting"},"columns":[{"out":"state.pk","expr":"party_id","from":["lane.party_id"],"rule":"copy"},{"out":"state.sk","expr":"'V#' || pos.vehicle_id, or 'C#' || load.route_id || '#' || load.stop_id","from":["lane.pos.vehicle_id","lane.load.route_id","lane.load.stop_id"],"rule":"derive"},{"out":"state.kind","expr":"'vehicle' for a position record, 'counter' for a load record","from":["lane.record_kind"],"rule":"derive"},{"out":"state.last_seen","expr":"to_timestamp(pos.timestamp)","from":["lane.pos.timestamp"],"rule":"derive"},{"out":"state.latitude","expr":"pos.latitude","from":["lane.pos.latitude"],"rule":"copy"},{"out":"state.longitude","expr":"pos.longitude","from":["lane.pos.longitude"],"rule":"copy"},{"out":"state.stop_id","expr":"pos.stop_id","from":["lane.pos.stop_id"],"rule":"copy"},{"out":"state.trip_id","expr":"pos.trip_id","from":["lane.pos.trip_id"],"rule":"copy"},{"out":"state.route_id","expr":"pos.route_id","from":["lane.pos.route_id"],"rule":"copy"},{"out":"state.direction_id","expr":"pos.direction_id","from":["lane.pos.direction_id"],"rule":"copy"},{"out":"state.moved_at","expr":"last_seen if distance(new position, last position) > 25 m, else the previous moved_at","from":["lane.pos.latitude","lane.pos.longitude","lane.pos.timestamp"],"rule":"derive"},{"out":"state.jump","expr":"distance(new, last) / (new timestamp − last_seen) > 40 m/s","from":["lane.pos.latitude","lane.pos.longitude","lane.pos.timestamp"],"rule":"derive"},{"out":"state.last_window","expr":"load.window_start","from":["lane.load.window_start"],"rule":"copy"},{"out":"state.last_nonzero_window","expr":"load.window_start if load.boardings + load.alightings > 0, else the previous value","from":["lane.load.window_start","lane.load.boardings","lane.load.alightings"],"rule":"derive"},{"out":"state.zero_windows","expr":"previous + 1 if load.boardings + load.alightings = 0, else 0","from":["lane.load.boardings","lane.load.alightings"],"rule":"derive"},{"out":"state.expires_at","expr":"last_seen + 24 h (the table's time-to-live)","from":["lane.pos.timestamp"],"rule":"derive"}],"drops":[]},{"id":"T9","name":"Match each position to its timetable; one delay and load value per route per window","short":"Match to timetable","lane":"region","col":2.5,"row":1,"service":"Lambda · delay and load","when":"every 5 minutes","inputs":["lane","timetables"],"outputs":["metrics"],"detail":{"grain":"positions and load rows → route × direction × 5-minute window, one value per metric","joins":["lane.pos.trip_id = timetables.trips.trip_id and pos.current_stop_sequence = stop_times.stop_sequence, in the party's feed version in force on service_date","the scheduled time is stop_times.arrival_time on pos.start_date (past 24:00 rolls over)"],"filters":["a window with fewer than 3 vehicles or stops gets no value, so the detector shows unknown, never normal (96% of 247,241 route-windows hold three or more visits in the sample)","a party not sharing loads gets no on_board series"],"dedup":["one value per series per window; a late record for a closed window is dropped"],"nulls":["no value is written for an empty window"],"units":["delay in minutes, late positive; on_board in people"],"privacy":["route-level values; no vehicle, no rider"],"key":"the region's; CloudWatch keeps 63 days"},"columns":[{"out":"metrics.namespace","expr":"'Region/Service'","from":[],"rule":"constant"},{"out":"metrics.metric_name","expr":"'delay_min' for positions, 'on_board' for load rows","from":["lane.record_kind"],"rule":"derive"},{"out":"metrics.party_id","expr":"party_id","from":["lane.party_id"],"rule":"copy"},{"out":"metrics.route_id","expr":"pos.route_id, or load.route_id","from":["lane.pos.route_id","lane.load.route_id"],"rule":"derive"},{"out":"metrics.direction_id","expr":"pos.direction_id, or load.direction_id","from":["lane.pos.direction_id","lane.load.direction_id"],"rule":"derive"},{"out":"metrics.timestamp","expr":"floor(pos.timestamp, 5 min), or load.window_start","from":["lane.pos.timestamp","lane.load.window_start"],"rule":"derive"},{"out":"metrics.value","expr":"median over the window's vehicles of (pos.timestamp − (start_date + stop_times.arrival_time at current_stop_sequence)) / 60; or mean(load.on_board) over the window's stops","from":["lane.pos.timestamp","lane.pos.start_date","lane.pos.trip_id","lane.pos.current_stop_sequence","timetables.trips.trip_id","timetables.stop_times.trip_id","timetables.stop_times.stop_sequence","timetables.stop_times.arrival_time","lane.load.on_board"],"rule":"aggregate"},{"out":"metrics.sample_count","expr":"count of vehicles, or of stops, in the window","from":["lane.pos.vehicle_id","lane.load.stop_id"],"rule":"aggregate"},{"out":"metrics.unit","expr":"'Count'","from":[],"rule":"constant"},{"out":"metrics.expected_low","expr":"CloudWatch anomaly detection, from two weeks of this series","from":[],"rule":"generate"},{"out":"metrics.expected_high","expr":"CloudWatch anomaly detection, from two weeks of this series","from":[],"rule":"generate"}],"drops":[]},{"id":"T10","name":"Build who is affected from shared stops and transfer totals","short":"Who is affected","lane":"region","col":2.5,"row":3,"service":"Athena, nightly → DynamoDB","when":"nightly, after the transfer totals land","inputs":["totals","registry","timetables"],"outputs":["affects"],"detail":{"grain":"shared stop pair × neighbour's route × band → one item per party, route and stop, with a list of neighbours","joins":["registry.shared_stops gives (party, stop) ↔ (neighbour, neighbour_stop)","regional transfer rows where totals.party_id = neighbour and totals.from_party = party give who changes there, by the neighbour's route and band","the neighbour's timetables (stop_times, trips) say which of its routes serve neighbour_stop_id; the party's say which of its routes serve the stop"],"filters":["totals of the last four weeks, status reported only: an unknown row (file late or missing) is not a zero","a neighbour with no totals is not named: no transfer totals, no neighbour named"],"dedup":["one item per party, route and stop; replaced whole each night"],"nulls":["an empty neighbours list means unknown, not nobody"],"units":["transfers a day per band; share as a fraction"],"privacy":["the totals are already suppressed under 5 cards at home (decision 26); the item names parties and routes, never a rider"],"key":"built under each agency's key by grant: revoke it and that agency drops out at the next rebuild"},"columns":[{"out":"affects.pk","expr":"shared_stops.party_id","from":["registry.shared_stops.party_id"],"rule":"copy"},{"out":"affects.sk","expr":"route_id || '#' || shared_stops.stop_id, for each of the party's routes serving the stop","from":["registry.shared_stops.stop_id","timetables.stop_times.stop_id","timetables.stop_times.trip_id","timetables.trips.trip_id","timetables.trips.route_id"],"rule":"join"},{"out":"affects.neighbours","expr":"one entry per (neighbour, to_route, band) with totals","from":["registry.shared_stops.neighbour_party"],"rule":"aggregate"},{"out":"affects.neighbours[].party","expr":"shared_stops.neighbour_party","from":["registry.shared_stops.neighbour_party"],"rule":"copy"},{"out":"affects.neighbours[].stop_id","expr":"shared_stops.neighbour_stop_id","from":["registry.shared_stops.neighbour_stop_id"],"rule":"copy"},{"out":"affects.neighbours[].to_route","expr":"totals.to_route where it serves neighbour_stop_id","from":["totals.to_route","totals.party_id","totals.from_party","timetables.stop_times.stop_id","timetables.trips.route_id"],"rule":"join"},{"out":"affects.neighbours[].time_band","expr":"totals.time_band","from":["totals.time_band"],"rule":"copy"},{"out":"affects.neighbours[].transfers_typical","expr":"median(totals.transfers) over the last 28 service dates with status reported","from":["totals.transfers","totals.service_date","totals.status"],"rule":"aggregate"},{"out":"affects.neighbours[].share","expr":"transfers_typical / Σ transfers_typical over the item's neighbours","from":["totals.transfers"],"rule":"derive"},{"out":"affects.built_at","expr":"now()","from":[],"rule":"generate"}],"drops":[]},{"id":"T11","name":"Build the alert: kind, where, since, expected and seen, who is affected","short":"Build the alert","lane":"region","col":3.5,"row":0,"service":"Lambda · build the alert","when":"when a rule fires or a band breaks","inputs":["state","metrics","affects","weather"],"outputs":["alerts"],"detail":{"grain":"a rule firing, or a series outside its band, → one alert row, updated while open","joins":["affects on (party_id, route_id) for the route's shared stops","weather and events by place and time: planned, dashed, not sourced (decision 52)"],"filters":["a detector alert only after 2 consecutive windows outside the band (decision 54; about 48 delay and 46 crowding alerts a weekday at one agency in the replay)","late side and crowded side only"],"dedup":["one open alert per party, kind and route or vehicle; a further window updates seen and keeps since"],"nulls":["affects empty when unknown; label null until weather is sourced"],"units":["minutes late; people on board"],"privacy":["names a party, a route, a vehicle as its own feed names it, and a neighbour; never a rider"],"key":"the region's; 13 months; each receiver keeps its own copy"},"columns":[{"out":"alerts.alert_id","expr":"ULID: time-ordered, generated","from":[],"rule":"generate"},{"out":"alerts.party_id","expr":"state.pk, or metrics.party_id","from":["state.pk","metrics.party_id"],"rule":"derive"},{"out":"alerts.month","expr":"to_char(since, 'YYYY-MM')","from":["metrics.timestamp","state.last_seen"],"rule":"derive"},{"out":"alerts.kind","expr":"the rule that fired (feed_gap, frozen_vehicle, position_jump, dead_counter), or delay_anomaly / load_anomaly by metric_name","from":["state.kind","state.moved_at","state.jump","state.zero_windows","state.last_seen","metrics.metric_name"],"rule":"derive"},{"out":"alerts.route_id","expr":"state.route_id, or metrics.route_id","from":["state.route_id","metrics.route_id"],"rule":"derive"},{"out":"alerts.direction_id","expr":"state.direction_id, or metrics.direction_id","from":["state.direction_id","metrics.direction_id"],"rule":"derive"},{"out":"alerts.vehicle_id","expr":"state.sk after 'V#', for a vehicle rule; else null","from":["state.sk","state.kind"],"rule":"derive"},{"out":"alerts.stop_id","expr":"state.sk after the last '#', for a counter rule; else null","from":["state.sk","state.kind"],"rule":"derive"},{"out":"alerts.since","expr":"the first window's metrics.timestamp outside the band, or the rule's firing time","from":["metrics.timestamp","state.last_seen"],"rule":"derive"},{"out":"alerts.until","expr":"the first window back inside, or when the rule clears; null while open","from":["metrics.timestamp","metrics.value","metrics.expected_high"],"rule":"derive"},{"out":"alerts.expected_low","expr":"metrics.expected_low","from":["metrics.expected_low"],"rule":"copy"},{"out":"alerts.expected_high","expr":"metrics.expected_high","from":["metrics.expected_high"],"rule":"copy"},{"out":"alerts.seen","expr":"metrics.value","from":["metrics.value"],"rule":"copy"},{"out":"alerts.unit","expr":"'min late' for delay_min, 'on board' for on_board","from":["metrics.metric_name"],"rule":"derive"},{"out":"alerts.affects","expr":"affects.neighbours for (party_id, route_id, each shared stop of the route), by the band in force","from":["affects.pk","affects.sk","affects.neighbours"],"rule":"join"},{"out":"alerts.label","expr":"planned: condition or event_name near the route at since","from":["weather.condition","weather.event_name","weather.place","weather.observed_at"],"rule":"null"},{"out":"alerts.status","expr":"'open', then 'cleared' when until is set","from":["metrics.timestamp","metrics.value","metrics.expected_high"],"rule":"derive"},{"out":"alerts.created_at","expr":"now()","from":[],"rule":"generate"}],"drops":[]},{"id":"T12","name":"Serve the open alerts a reader may see","short":"Serve the feed","lane":"region","col":4,"row":1,"service":"API Gateway + Lambda; Verified Permissions","when":"on request","inputs":["alerts"],"outputs":["feed"],"detail":{"grain":"unchanged: one alert per row, filtered per reader","joins":["the sign-in token names the reader's party; Verified Permissions decides from the compiled agreements"],"filters":["status = open","the reader is the alert's party, a party named in affects, or the region","every read is an audit event"],"dedup":["none"],"nulls":["affects and label pass through as they are"],"units":["unchanged"],"privacy":["allow-or-deny per reader; nothing about a rider exists to leak"],"key":"the region's; TLS to the reader; not stored"},"columns":[{"out":"feed.alert_id","expr":"alerts.alert_id","from":["alerts.alert_id"],"rule":"copy"},{"out":"feed.party_id","expr":"alerts.party_id","from":["alerts.party_id"],"rule":"copy"},{"out":"feed.kind","expr":"alerts.kind","from":["alerts.kind"],"rule":"copy"},{"out":"feed.route_id","expr":"alerts.route_id","from":["alerts.route_id"],"rule":"copy"},{"out":"feed.direction_id","expr":"alerts.direction_id","from":["alerts.direction_id"],"rule":"copy"},{"out":"feed.vehicle_id","expr":"alerts.vehicle_id","from":["alerts.vehicle_id"],"rule":"copy"},{"out":"feed.stop_id","expr":"alerts.stop_id","from":["alerts.stop_id"],"rule":"copy"},{"out":"feed.since","expr":"alerts.since","from":["alerts.since"],"rule":"copy"},{"out":"feed.seen","expr":"alerts.seen","from":["alerts.seen"],"rule":"copy"},{"out":"feed.unit","expr":"alerts.unit","from":["alerts.unit"],"rule":"copy"},{"out":"feed.affects","expr":"alerts.affects","from":["alerts.affects"],"rule":"copy"},{"out":"feed.label","expr":"alerts.label","from":["alerts.label"],"rule":"copy"},{"out":"feed.expected","expr":"expected_low || ' to ' || expected_high","from":["alerts.expected_low","alerts.expected_high"],"rule":"derive"},{"out":"feed.served_at","expr":"now()","from":[],"rule":"generate"}],"drops":[]}],"edges":[{"from":"avl","to":"T1","kind":"data"},{"from":"apc","to":"T1","kind":"data"},{"from":"T1","to":"b_avl","kind":"data"},{"from":"T1","to":"b_apc","kind":"data"},{"from":"b_avl","to":"T2","kind":"data"},{"from":"b_apc","to":"T2","kind":"data"},{"from":"gtfs","to":"T2","kind":"cross","fs":"t","fo":-40,"ts":"b","via":[["y","gap:public:-30"]],"label":"fetched when they change"},{"from":"T2","to":"a_silver","kind":"data"},{"from":"T2","to":"a_trips","kind":"data"},{"from":"a_silver","to":"T3","kind":"data"},{"from":"a_trips","to":"T3","kind":"data","fs":"r","ts":"l","tof":14,"via":[["x","colR:2:20"]]},{"from":"T3","to":"a_gold","kind":"data"},{"from":"a_gold","to":"T4","kind":"data"},{"from":"T4","to":"lane","kind":"cross","fs":"b","fo":-20,"ts":"t","via":[["y","top:region:1"]],"label":"5-minute loads, every 5 min, within 2"},{"from":"rt","to":"T5","kind":"cross","fs":"r","ts":"t","via":[["x","x:T5"]],"label":"every 10 s"},{"from":"registry","to":"T5","kind":"ctl","fs":"t","fo":40,"ts":"b","tof":30,"via":[["y","row:region:0.5"],["x","x:T5:30"]],"label":"which feeds"},{"from":"T5","to":"lane","kind":"data","fs":"b","ts":"l","via":[["y","row:region:0"]]},{"from":"gtfs","to":"T6","kind":"cross","fs":"r","ts":"t","via":[["x","x:T6"]],"label":"when they change"},{"from":"registry","to":"T6","kind":"ctl","fs":"t","fo":70,"ts":"b","tof":-20,"via":[["y","row:region:1.5"],["x","x:T6:-20"]],"label":"which timetables"},{"from":"T6","to":"timetables","kind":"data","fs":"b","ts":"l","via":[["y","row:region:2"]]},{"from":"lane","to":"T7","kind":"data","fs":"b","ts":"l","via":[["y","row:region:1"]]},{"from":"T7","to":"archive","kind":"data"},{"from":"lane","to":"T8","kind":"data"},{"from":"T8","to":"state","kind":"data"},{"from":"lane","to":"T9","kind":"data","fs":"r","fo":14,"ts":"l","tof":-12,"via":[["x","colR:2:14"]]},{"from":"timetables","to":"T9","kind":"data","fs":"r","fo":-14,"ts":"l","tof":12,"via":[["x","colR:2:28"]]},{"from":"T9","to":"metrics","kind":"data"},{"from":"totals","to":"T10","kind":"plan"},{"from":"registry","to":"T10","kind":"plan","fs":"r","fo":-14,"ts":"l","tof":-14,"via":[["x","colR:0:20"]]},{"from":"timetables","to":"T10","kind":"data","fs":"r","fo":14,"ts":"l","tof":14,"via":[["x","colR:2:28"]]},{"from":"T10","to":"affects","kind":"data"},{"from":"state","to":"T11","kind":"data"},{"from":"metrics","to":"T11","kind":"data","fs":"r","ts":"l","tof":12,"via":[["x","colR:3:28"]]},{"from":"affects","to":"T11","kind":"data","fs":"r","ts":"b","tof":-30,"via":[["x","colR:3:14"]]},{"from":"weather","to":"T11","kind":"plan","fs":"r","ts":"t","tof":24,"via":[["x","colR:0:16"],["y","gap:region:32"],["x","x:T11:24"]],"label":"a label, planned"},{"from":"T11","to":"alerts","kind":"data","fs":"r","ts":"l"},{"from":"alerts","to":"T12","kind":"data","fs":"b","ts":"t"},{"from":"T12","to":"feed","kind":"data","fs":"b","ts":"t"}],"notes":{"planned":"Columns of the regional tables are a proposal (decision 57). Nothing is deployed.","pages":{"tables":"@/digital-twin/anomaly-tables"}}}
