{"id":"transfer","title":"Transfer analysis: 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  ·  the tap we follow"},{"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":"PRESTO fare export","role":["nightly CSV of taps; 18 columns,","with a header; the card serial in it"],"status":"sample","shape":"vendor CSV, `,`-delimited, with a header","grain":"one row per tap","keys":"TransactionID","part":"one file a month in the sample; nightly in a live agency","keep":"the agency's rule","key":"agency","standard":"","columns":[{"name":"GSN","type":"text","key":"","desc":"RESTRICTED · card serial: links taps into a person's trail; hashed at home, never written out"},{"name":"Date","type":"date","key":"","desc":"the calendar date of the tap"},{"name":"Time","type":"time","key":"","desc":"HH:MM:SS"},{"name":"TransactionID","type":"text","key":"PK","desc":"unique per tap"},{"name":"UniversalClass","type":"int","key":"","desc":"RESTRICTED · fare class: can reveal a concession"},{"name":"SpecificClass","type":"int","key":"","desc":"RESTRICTED · fare class detail"},{"name":"TrxTypeID","type":"int","key":"","desc":"14 e-purse ride, 15 period pass, 16 transfer"},{"name":"TransitAuthority_ID","type":"int","key":"","desc":"the authority"},{"name":"CashFare","type":"number","key":"","desc":"the fare charged"},{"name":"oppaymentamount","type":"number","key":"","desc":"the amount paid; differs from CashFare in 5,631 rows"},{"name":"ServiceProvider","type":"int","key":"","desc":"the operator of this tap"},{"name":"TransferServiceProviderID","type":"int","key":"","desc":"the operator transferred from; 0 when none: the one field that links two parties' legs"},{"name":"TransferServiceProviderName","type":"text","key":"","desc":"that operator's name"},{"name":"ProductOwnerID","type":"int","key":"","desc":"who sold the product"},{"name":"TrxStatus","type":"int","key":"","desc":"accepted or declined"},{"name":"ProductID","type":"int","key":"","desc":"RESTRICTED · the product: can reveal a concession"},{"name":"TrxLocationID","type":"text","key":"","desc":"device or stop; the stop number without its leading zeros (398,199 padded)"},{"name":"LineID","type":"text","key":"","desc":"the route"}],"id":"afc","status_label":"the sample files"},{"lane":"agency","layer":"bronze","row":0,"name":"Raw fare export","role":["as received, under the agency's key;","never leaves; the serial still in it"],"status":"sample","shape":"as received, plus file and landing time","grain":"as received","keys":"none imposed","part":"by file and calendar date","keep":"three years (the raw landing); never leaves","key":"agency","standard":"","columns":[{"name":"GSN","type":"text","key":"","desc":"RESTRICTED · card serial: links taps into a person's trail; hashed at home, never written out"},{"name":"Date","type":"date","key":"","desc":"the calendar date of the tap"},{"name":"Time","type":"time","key":"","desc":"HH:MM:SS"},{"name":"TransactionID","type":"text","key":"PK","desc":"unique per tap"},{"name":"UniversalClass","type":"int","key":"","desc":"RESTRICTED · fare class: can reveal a concession"},{"name":"SpecificClass","type":"int","key":"","desc":"RESTRICTED · fare class detail"},{"name":"TrxTypeID","type":"int","key":"","desc":"14 e-purse ride, 15 period pass, 16 transfer"},{"name":"TransitAuthority_ID","type":"int","key":"","desc":"the authority"},{"name":"CashFare","type":"number","key":"","desc":"the fare charged"},{"name":"oppaymentamount","type":"number","key":"","desc":"the amount paid; differs from CashFare in 5,631 rows"},{"name":"ServiceProvider","type":"int","key":"","desc":"the operator of this tap"},{"name":"TransferServiceProviderID","type":"int","key":"","desc":"the operator transferred from; 0 when none: the one field that links two parties' legs"},{"name":"TransferServiceProviderName","type":"text","key":"","desc":"that operator's name"},{"name":"ProductOwnerID","type":"int","key":"","desc":"who sold the product"},{"name":"TrxStatus","type":"int","key":"","desc":"accepted or declined"},{"name":"ProductID","type":"int","key":"","desc":"RESTRICTED · the product: can reveal a concession"},{"name":"TrxLocationID","type":"text","key":"","desc":"device or stop; the stop number without its leading zeros (398,199 padded)"},{"name":"LineID","type":"text","key":"","desc":"the route"},{"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_afc","status_label":"the sample files"},{"lane":"agency","layer":"silver","row":0,"name":"TIDES fare_transactions","role":["1.69 M taps from the month, 100%","pass the schema; the card hashed, gone"],"status":"tested","shape":"TIDES `fare_transactions` plus named extras: the transfer operator, the route, the hashed card","grain":"one row per tap","keys":"transaction_id; stop_id = GTFS stop","part":"by service day","keep":"the agency's rule; the region never reads it","key":"agency","standard":"TIDES fare_transactions plus extras","columns":[{"name":"transaction_id","type":"text","key":"PK","desc":"TIDES"},{"name":"service_date","type":"date","key":"","desc":"TIDES; the calendar date (taps before 04:00 stay on it: open)"},{"name":"event_timestamp","type":"datetime","key":"","desc":"TIDES"},{"name":"amount","type":"number","key":"","desc":"TIDES"},{"name":"currency_type","type":"text","key":"","desc":"TIDES; CAD"},{"name":"fare_action","type":"enum","key":"","desc":"TIDES; Enter or Transfer entrance"},{"name":"stop_id","type":"text","key":"FK","desc":"TIDES; GTFS stop (99.1% of taps find theirs)"},{"name":"fare_media_id","type":"text","key":"","desc":"TIDES"},{"name":"fare_product","type":"text","key":"","desc":"TIDES; from the tap type, not the restricted product"},{"name":"fare_capped","type":"bool","key":"","desc":"TIDES; assumed false"},{"name":"token_id","type":"text","key":"","desc":"TIDES; null: never the card"},{"name":"rider_category","type":"text","key":"","desc":"TIDES; null: the fare class is restricted"},{"name":"route_id","type":"text","key":"","desc":"extra: the agency's route the tap was on"},{"name":"from_operator_id","type":"int","key":"","desc":"extra: PRESTO's transfer-from operator; null when none"},{"name":"from_operator_name","type":"text","key":"","desc":"extra: that operator's name"},{"name":"card_hash","type":"text","key":"","desc":"extra: HMAC of the card serial with a secret the agency keeps; counts distinct riders, never leaves (decision 48)"},{"name":"trx_status","type":"enum","key":"","desc":"extra: accepted or declined"}],"id":"a_fares","status_label":"tested on the sample"},{"lane":"agency","layer":"gold","row":0,"name":"Nightly transfer totals","role":["from-operator × route × 3-hour band;","rows under 5 cards dropped; nightly"],"status":"replayed","shape":"TIDES `station_activities` plus extras: the contract's row","grain":"from-operator × route × date × 3-hour band","keys":"party_id, service_date, from_operator, to_route, time_band","part":"one file per service day","keep":"kept at home; the copy at the region 3 years under the agency's key","key":"agency","standard":"TIDES station_activities plus extras","columns":[{"name":"party_id","type":"text","key":"PK","desc":"the agency that counted: transfers into it"},{"name":"service_date","type":"date","key":"PK","desc":"the calendar day of the taps"},{"name":"from_operator","type":"text","key":"PK","desc":"the operator the rider came from, as PRESTO names it"},{"name":"to_route","type":"text","key":"PK","desc":"the counting agency's route, with its prefix"},{"name":"time_band","type":"text","key":"PK","desc":"3-hour band, such as 06:00–09:00"},{"name":"transfers","type":"int","key":"","desc":"distinct cards; rows under 5 already dropped"},{"name":"median_wait_min","type":"number","key":"","desc":"tap time minus the last from-operator arrival at that stop"},{"name":"share_wait_over_15","type":"number","key":"","desc":"share who waited more than 15 minutes"}],"id":"a_gold","status_label":"replayed on the sample"},{"lane":"public","layer":"source","row":0,"name":"GTFS-Realtime feeds","role":["positions and trip updates;","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 feed archive","key":"none, open","standard":"GTFS-Realtime","columns":[{"name":"header.timestamp","type":"epoch s","key":"","desc":"when the feed was built","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.vehicle.id","type":"text","key":"","desc":"the vehicle as the party names it","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.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":"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.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"}],"id":"rt","status_label":"already standard"},{"lane":"region","layer":"source","row":3,"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":"bronze","row":0,"name":"Feed archive","role":["positions and trip updates as","polled; Parquet, Iceberg; 3 years"],"status":"planned","shape":"records as polled, two kinds (Parquet in Iceberg)","grain":"one row per position; one per trip update stop","keys":"party_id, record_kind, polled_at, then the feed's own ids","part":"by party and service day","keep":"3 years, as costed; a leaver's part deleted at once, snapshots expired","key":"region","standard":"","columns":[{"name":"party_id","type":"text","key":"PK","desc":"from the registry: whose feed","group":"envelope"},{"name":"record_kind","type":"enum","key":"","desc":"position or trip_update","group":"envelope"},{"name":"polled_at","type":"datetime","key":"PK","desc":"","group":"envelope"},{"name":"pos.vehicle_id","type":"text","key":"","desc":"","group":"position"},{"name":"pos.trip_id","type":"text","key":"","desc":"","group":"position"},{"name":"pos.route_id","type":"text","key":"","desc":"","group":"position"},{"name":"pos.direction_id","type":"int","key":"","desc":"","group":"position"},{"name":"pos.start_date","type":"date","key":"","desc":"the service day","group":"position"},{"name":"pos.latitude","type":"number","key":"","desc":"","group":"position"},{"name":"pos.longitude","type":"number","key":"","desc":"","group":"position"},{"name":"pos.current_stop_sequence","type":"int","key":"","desc":"","group":"position"},{"name":"pos.stop_id","type":"text","key":"","desc":"","group":"position"},{"name":"pos.current_status","type":"enum","key":"","desc":"","group":"position"},{"name":"pos.timestamp","type":"epoch s","key":"","desc":"when measured","group":"position"},{"name":"tu.trip_id","type":"text","key":"","desc":"","group":"trip update"},{"name":"tu.route_id","type":"text","key":"","desc":"","group":"trip update"},{"name":"tu.start_date","type":"date","key":"","desc":"","group":"trip update"},{"name":"tu.vehicle_id","type":"text","key":"","desc":"","group":"trip update"},{"name":"tu.stop_sequence","type":"int","key":"","desc":"","group":"trip update"},{"name":"tu.stop_id","type":"text","key":"","desc":"","group":"trip update"},{"name":"tu.arrival_time","type":"epoch s","key":"","desc":"","group":"trip update"},{"name":"tu.departure_time","type":"epoch s","key":"","desc":"","group":"trip update"},{"name":"tu.schedule_relationship","type":"enum","key":"","desc":"","group":"trip update"},{"name":"tu.timestamp","type":"epoch s","key":"","desc":"","group":"trip update"}],"id":"archive","status_label":"planned"},{"lane":"region","layer":"bronze","row":2,"name":"Inbox: nightly files","role":["one folder per agency; each file","under that agency's key, as sent"],"status":"planned","shape":"S3 objects, the contract's rows as sent, SSE-KMS with the agency's key","grain":"one file per party per service day; its rows as sent","keys":"party_id, service_date","part":"by party and service day","keep":"3 years, under the agency's key; deleted when it leaves","key":"agency, granted","standard":"TIDES station_activities plus extras","columns":[{"name":"party_id","type":"text","key":"PK","desc":"from the folder and the signing key","group":"file"},{"name":"service_date","type":"date","key":"PK","desc":"from the file name","group":"file"},{"name":"object_key","type":"text","key":"","desc":"","group":"file"},{"name":"received_at","type":"datetime","key":"","desc":"against the 06:00 deadline","group":"file"},{"name":"key_arn","type":"text","key":"","desc":"the KMS key the object is encrypted with","group":"file"},{"name":"rows","type":"int","key":"","desc":"","group":"file"},{"name":"row.party_id","type":"text","key":"","desc":"the agency that counted: transfers into it","group":"row"},{"name":"row.service_date","type":"date","key":"","desc":"the calendar day of the taps","group":"row"},{"name":"row.from_operator","type":"text","key":"","desc":"the operator the rider came from, as PRESTO names it","group":"row"},{"name":"row.to_route","type":"text","key":"","desc":"the counting agency's route, with its prefix","group":"row"},{"name":"row.time_band","type":"text","key":"","desc":"3-hour band, such as 06:00–09:00","group":"row"},{"name":"row.transfers","type":"int","key":"","desc":"distinct cards; rows under 5 already dropped","group":"row"},{"name":"row.median_wait_min","type":"number","key":"","desc":"tap time minus the last from-operator arrival at that stop","group":"row"},{"name":"row.share_wait_over_15","type":"number","key":"","desc":"share who waited more than 15 minutes","group":"row"}],"id":"inbox","status_label":"planned"},{"lane":"region","layer":"silver","row":1,"name":"Public arrivals","role":["one row per bus per stop, from the","feeds; with the stop crosswalk; by grant"],"status":"planned","shape":"TIDES `stop_visits`, times only, plus the crosswalk","grain":"party × service day × trip × stop","keys":"party_id, service_date, trip_id_performed, trip_stop_sequence","part":"by party and service day","keep":"3 years, with the archive","key":"region; read in place by each agency through a grant","standard":"TIDES stop_visits, times only","columns":[{"name":"party_id","type":"text","key":"PK","desc":"whose bus"},{"name":"operator_name","type":"text","key":"","desc":"the party's PRESTO name, so an agency can match a tap's transfer-from field"},{"name":"service_date","type":"date","key":"PK","desc":"TIDES"},{"name":"trip_id_performed","type":"text","key":"PK","desc":"TIDES; the feed's trip id"},{"name":"trip_stop_sequence","type":"int","key":"PK","desc":"TIDES"},{"name":"stop_id","type":"text","key":"FK","desc":"TIDES; the party's stop id"},{"name":"route_id","type":"text","key":"","desc":"extra"},{"name":"vehicle_id","type":"text","key":"","desc":"TIDES"},{"name":"actual_arrival_time","type":"datetime","key":"","desc":"TIDES"},{"name":"actual_departure_time","type":"datetime","key":"","desc":"TIDES"},{"name":"source","type":"enum","key":"","desc":"extra: stopped_at (a position at the stop), trip_update (the feed's own arrival), or interpolated"},{"name":"shared_with","type":"list","key":"","desc":"extra: the crosswalk, one entry per neighbour that shares this stop"},{"name":"shared_with[].party","type":"text","key":"FK","desc":"","group":"shared_with"},{"name":"shared_with[].stop_id","type":"text","key":"","desc":"the same place in that party's feed","group":"shared_with"}],"id":"arrivals","status_label":"planned"},{"lane":"region","layer":"gold","row":2,"name":"Regional transfer table","role":["six files a night become one table;","each agency's rows under its own 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":"regional","status_label":"planned"},{"lane":"region","layer":"out","row":2,"name":"Report API","role":["matrix, waits, crossing points,","connection times; JSON, behind sign-in"],"status":"planned","shape":"JSON over the API; four reports","grain":"one report per request, filtered per reader","keys":"reader's party; allow-or-deny rules","part":"per request; cached","keep":"cached briefly; purged when a party leaves","key":"region","standard":"","columns":[{"name":"matrix.from_party","type":"text","key":"","desc":"","group":"matrix"},{"name":"matrix.to_party","type":"text","key":"","desc":"","group":"matrix"},{"name":"matrix.time_band","type":"text","key":"","desc":"","group":"matrix"},{"name":"matrix.transfers","type":"int","key":"","desc":"a typical weekday, summed over routes","group":"matrix"},{"name":"matrix.status","type":"enum","key":"","desc":"reported or unknown","group":"matrix"},{"name":"waits.to_party","type":"text","key":"","desc":"","group":"waits"},{"name":"waits.to_route","type":"text","key":"","desc":"","group":"waits"},{"name":"waits.time_band","type":"text","key":"","desc":"","group":"waits"},{"name":"waits.median_wait_min","type":"number","key":"","desc":"","group":"waits"},{"name":"waits.share_wait_over_15","type":"number","key":"","desc":"","group":"waits"},{"name":"crossing.to_party","type":"text","key":"","desc":"","group":"crossing points"},{"name":"crossing.to_route","type":"text","key":"","desc":"by route in v1; by stop would need the contract's grain to change","group":"crossing points"},{"name":"crossing.from_party","type":"text","key":"","desc":"","group":"crossing points"},{"name":"crossing.transfers","type":"int","key":"","desc":"ranked","group":"crossing points"},{"name":"connection.from_party","type":"text","key":"","desc":"","group":"connection times"},{"name":"connection.to_party","type":"text","key":"","desc":"","group":"connection times"},{"name":"connection.to_route","type":"text","key":"","desc":"","group":"connection times"},{"name":"connection.time_band","type":"text","key":"","desc":"","group":"connection times"},{"name":"connection.median_wait_min","type":"number","key":"","desc":"for the journey view","group":"connection times"},{"name":"served_at","type":"datetime","key":"","desc":""}],"id":"api","status_label":"planned"},{"lane":"region","layer":"out","row":3,"name":"Rejected files","role":["a file that failed its contract check,","held with the reason; the agency told"],"status":"planned","shape":"SQS message per file","grain":"one message per rejected file","keys":"party_id, service_date, object_key","part":"not partitioned","keep":"14 days, replayable","key":"region","standard":"","columns":[{"name":"party_id","type":"text","key":"PK","desc":""},{"name":"service_date","type":"date","key":"PK","desc":""},{"name":"object_key","type":"text","key":"PK","desc":""},{"name":"reason","type":"enum","key":"","desc":"shape, deadline, privacy_rule, wrong_key, no_contract"},{"name":"detail","type":"text","key":"","desc":"which column, which row count, which key"},{"name":"checked_at","type":"datetime","key":"","desc":""},{"name":"notified_at","type":"datetime","key":"","desc":"when the agency was told; the path back is still open (audit)"}],"id":"rejects","status_label":"planned"}],"transforms":[{"id":"T1","name":"Land the fare export","short":"Land the export","lane":"agency","col":0.5,"row":0,"service":"S3 raw landing","when":"nightly, when the export arrives","inputs":["afc"],"outputs":["b_afc"],"detail":{"grain":"unchanged: one row per tap","joins":["none"],"filters":["none: every byte kept"],"dedup":["none: Bronze is never edited, so Silver can be rebuilt from it"],"nulls":["blank fields stay blank"],"units":["as exported"],"privacy":["the card serial is in this file and this account only; nothing here leaves (decisions 8, 16)"],"key":"the agency's"},"columns":[{"out":"b_afc.GSN","expr":"afc.GSN","from":["afc.GSN"],"rule":"copy"},{"out":"b_afc.Date","expr":"afc.Date","from":["afc.Date"],"rule":"copy"},{"out":"b_afc.Time","expr":"afc.Time","from":["afc.Time"],"rule":"copy"},{"out":"b_afc.TransactionID","expr":"afc.TransactionID","from":["afc.TransactionID"],"rule":"copy"},{"out":"b_afc.UniversalClass","expr":"afc.UniversalClass","from":["afc.UniversalClass"],"rule":"copy"},{"out":"b_afc.SpecificClass","expr":"afc.SpecificClass","from":["afc.SpecificClass"],"rule":"copy"},{"out":"b_afc.TrxTypeID","expr":"afc.TrxTypeID","from":["afc.TrxTypeID"],"rule":"copy"},{"out":"b_afc.TransitAuthority_ID","expr":"afc.TransitAuthority_ID","from":["afc.TransitAuthority_ID"],"rule":"copy"},{"out":"b_afc.CashFare","expr":"afc.CashFare","from":["afc.CashFare"],"rule":"copy"},{"out":"b_afc.oppaymentamount","expr":"afc.oppaymentamount","from":["afc.oppaymentamount"],"rule":"copy"},{"out":"b_afc.ServiceProvider","expr":"afc.ServiceProvider","from":["afc.ServiceProvider"],"rule":"copy"},{"out":"b_afc.TransferServiceProviderID","expr":"afc.TransferServiceProviderID","from":["afc.TransferServiceProviderID"],"rule":"copy"},{"out":"b_afc.TransferServiceProviderName","expr":"afc.TransferServiceProviderName","from":["afc.TransferServiceProviderName"],"rule":"copy"},{"out":"b_afc.ProductOwnerID","expr":"afc.ProductOwnerID","from":["afc.ProductOwnerID"],"rule":"copy"},{"out":"b_afc.TrxStatus","expr":"afc.TrxStatus","from":["afc.TrxStatus"],"rule":"copy"},{"out":"b_afc.ProductID","expr":"afc.ProductID","from":["afc.ProductID"],"rule":"copy"},{"out":"b_afc.TrxLocationID","expr":"afc.TrxLocationID","from":["afc.TrxLocationID"],"rule":"copy"},{"out":"b_afc.LineID","expr":"afc.LineID","from":["afc.LineID"],"rule":"copy"},{"out":"b_afc._source_file","expr":"the export's file name","from":[],"rule":"generate"},{"out":"b_afc._landed_at","expr":"now()","from":[],"rule":"generate"}],"drops":[]},{"id":"T2","name":"Translate the taps to TIDES fare_transactions; hash the card","short":"Translate, hash","lane":"agency","col":1.5,"row":0,"service":"Glue ETL · translate (or Databricks)","when":"02:00, after the export lands","inputs":["b_afc"],"outputs":["a_fares"],"detail":{"grain":"unchanged: one row per tap","joins":["stop_id checked against the agency's GTFS stops (99.1% of taps find theirs; the rest are devices with no stop)"],"filters":["a malformed row (one in the sample) fails every required field and is counted, not written"],"dedup":["transaction_id checked unique"],"nulls":["TrxLocationID 0 or blank → null stop","token_id null: never the card","rider_category null: the fare class is restricted"],"units":["Date and Time → one timestamp; CashFare stays dollars"],"privacy":["the card serial is read here, hashed with a secret the agency keeps, and dropped: the hash counts distinct riders for the 5-card rule and never leaves (decision 48)","fare class and product withheld: they can reveal a concession","the transfer operator has no TIDES field (818,562 taps name one): kept as a named extra"],"key":"the agency's; the region never reads this table"},"columns":[{"out":"a_fares.transaction_id","expr":"TransactionID","from":["b_afc.TransactionID"],"rule":"copy"},{"out":"a_fares.service_date","expr":"Date (the calendar date; 20,356 taps between 00:00 and 04:00 stay on it: a shared definition is still open)","from":["b_afc.Date"],"rule":"copy"},{"out":"a_fares.event_timestamp","expr":"timestamp(Date || ' ' || Time)","from":["b_afc.Date","b_afc.Time"],"rule":"derive"},{"out":"a_fares.amount","expr":"CashFare","from":["b_afc.CashFare"],"rule":"copy"},{"out":"a_fares.currency_type","expr":"'CAD'","from":[],"rule":"constant"},{"out":"a_fares.fare_action","expr":"TrxTypeID 14, 15 → 'Enter'; 16 → 'Transfer entrance'; else 'Unknown action type'","from":["b_afc.TrxTypeID"],"rule":"derive"},{"out":"a_fares.stop_id","expr":"lpad(TrxLocationID, 4, '0'); 0 or blank → null","from":["b_afc.TrxLocationID"],"rule":"derive"},{"out":"a_fares.fare_media_id","expr":"'Smart card or ticket'","from":[],"rule":"constant"},{"out":"a_fares.fare_product","expr":"TrxTypeID 14 → 'E-purse single ride'; 15 → 'Period pass'; 16 → 'Transfer'","from":["b_afc.TrxTypeID"],"rule":"derive"},{"out":"a_fares.fare_capped","expr":"false (assumed; the export does not say)","from":[],"rule":"constant"},{"out":"a_fares.token_id","expr":"null: never the card","from":[],"rule":"null"},{"out":"a_fares.rider_category","expr":"null: UniversalClass is restricted","from":[],"rule":"null"},{"out":"a_fares.route_id","expr":"LineID, with the agency's prefix","from":["b_afc.LineID"],"rule":"derive"},{"out":"a_fares.from_operator_id","expr":"TransferServiceProviderID; 0 → null","from":["b_afc.TransferServiceProviderID"],"rule":"derive"},{"out":"a_fares.from_operator_name","expr":"TransferServiceProviderName; blank → null","from":["b_afc.TransferServiceProviderName"],"rule":"derive"},{"out":"a_fares.card_hash","expr":"HMAC-SHA256(agency secret, GSN)","from":["b_afc.GSN"],"rule":"derive"},{"out":"a_fares.trx_status","expr":"TrxStatus 0 → 'accepted', else 'declined'","from":["b_afc.TrxStatus"],"rule":"derive"}],"drops":[{"col":"b_afc.GSN","why":"the card serial: hashed into card_hash, then dropped; never written to anything that leaves"},{"col":"b_afc.UniversalClass","why":"restricted: a concession class"},{"col":"b_afc.SpecificClass","why":"restricted"},{"col":"b_afc.ProductID","why":"restricted: the product can reveal a concession"},{"col":"b_afc.oppaymentamount","why":"CashFare kept; the two differ in 5,631 rows"},{"col":"b_afc.ServiceProvider","why":"the file is one agency's"},{"col":"b_afc.TransitAuthority_ID","why":"the file is one agency's"},{"col":"b_afc.ProductOwnerID","why":"revenue split, not this use case"}]},{"id":"T3","name":"Count the transfers and time the waits","short":"Count and time","lane":"agency","col":2.5,"row":0,"service":"Glue ETL · count and time (or Databricks); Athena reads the arrivals in place","when":"02:30, nightly","inputs":["a_fares","arrivals"],"outputs":["a_gold"],"detail":{"grain":"tap → from-operator × route × date × 3-hour band","joins":["the region's public arrivals, read in place by grant: arrivals.operator_name = from_operator_name and the tap's stop_id in arrivals.shared_with[] for this party, within the hour before the tap"],"filters":["from_operator_id not null and not the agency's own (within-agency transfers are counted at home, not sent)","trx_status accepted","rows with fewer than 5 distinct card_hash dropped before the file is written (decision 26)"],"dedup":["one card counted once per cell, by card_hash"],"nulls":["a tap with no stop has no wait; the wait columns are null when fewer than half the cell's taps found an arrival","a from-operator with no public arrivals (not on PRESTO, or feed-only) shows unknown waits, never an estimate (decision 37)"],"units":["waits in minutes, median and share over 15; the band is the tap hour floored to 3"],"privacy":["small-cell suppression at 5 distinct cards; in the sample 28% of 1,352 cells but 1.1% of transfers fall under it","no card, no tap, no stop leaves: the row is a count and two statistics"],"key":"the agency's, then its key on the file"},"columns":[{"out":"a_gold.party_id","expr":"the agency's own party id, from its adapter configuration","from":[],"rule":"constant"},{"out":"a_gold.service_date","expr":"service_date","from":["a_fares.service_date"],"rule":"copy"},{"out":"a_gold.from_operator","expr":"from_operator_name","from":["a_fares.from_operator_name"],"rule":"copy"},{"out":"a_gold.to_route","expr":"route_id","from":["a_fares.route_id"],"rule":"copy"},{"out":"a_gold.time_band","expr":"floor(hour(event_timestamp) / 3) × 3, as 'HH:00–HH:00'","from":["a_fares.event_timestamp"],"rule":"derive"},{"out":"a_gold.transfers","expr":"count(distinct card_hash); the row dropped under 5","from":["a_fares.card_hash"],"rule":"aggregate"},{"out":"a_gold.median_wait_min","expr":"median(event_timestamp − max(arrivals.actual_arrival_time) at the crosswalked stop by the from-operator in the hour before) / 60","from":["a_fares.event_timestamp","a_fares.stop_id","a_fares.from_operator_name","arrivals.actual_arrival_time","arrivals.operator_name","arrivals.shared_with[].party","arrivals.shared_with[].stop_id","arrivals.stop_id"],"rule":"aggregate"},{"out":"a_gold.share_wait_over_15","expr":"mean(wait > 15 min) over the cell's taps with a wait","from":["a_fares.event_timestamp","arrivals.actual_arrival_time"],"rule":"aggregate"}],"drops":[]},{"id":"T4","name":"Push the nightly file to the region's inbox","short":"Push the file","lane":"agency","col":3.5,"row":0,"service":"the adapter, in the agency's account; S3 copy with SSE-KMS","when":"by 06:00","inputs":["a_gold"],"outputs":["inbox"],"detail":{"grain":"unchanged: the contract's rows, one file per service day","joins":["the registry must hold an active transfer-totals contract for the party"],"filters":["only the service day just ended","no row under 5 cards is in the file: the check at the region refuses the file otherwise"],"dedup":["a file sent twice replaces the first (same object key)"],"nulls":["unchanged"],"units":["unchanged"],"privacy":["the contract's privacy clause, already applied at home"],"key":"the agency's KMS key on the object (SSE-KMS); the region holds a revocable grant (decision 41)"},"columns":[{"out":"inbox.party_id","expr":"the folder the adapter writes to, which only its party's role may","from":[],"rule":"generate"},{"out":"inbox.service_date","expr":"from the file name","from":["a_gold.service_date"],"rule":"derive"},{"out":"inbox.object_key","expr":"party_id/service_date/transfer-totals-v1.parquet","from":["a_gold.party_id","a_gold.service_date"],"rule":"derive"},{"out":"inbox.received_at","expr":"now(), at the region","from":[],"rule":"generate"},{"out":"inbox.key_arn","expr":"the agency's key, from the object's encryption header","from":[],"rule":"generate"},{"out":"inbox.rows","expr":"count(*)","from":["a_gold.transfers"],"rule":"aggregate"},{"out":"inbox.row.party_id","expr":"party_id","from":["a_gold.party_id"],"rule":"copy"},{"out":"inbox.row.service_date","expr":"service_date","from":["a_gold.service_date"],"rule":"copy"},{"out":"inbox.row.from_operator","expr":"from_operator","from":["a_gold.from_operator"],"rule":"copy"},{"out":"inbox.row.to_route","expr":"to_route","from":["a_gold.to_route"],"rule":"copy"},{"out":"inbox.row.time_band","expr":"time_band","from":["a_gold.time_band"],"rule":"copy"},{"out":"inbox.row.transfers","expr":"transfers","from":["a_gold.transfers"],"rule":"copy"},{"out":"inbox.row.median_wait_min","expr":"median_wait_min","from":["a_gold.median_wait_min"],"rule":"copy"},{"out":"inbox.row.share_wait_over_15","expr":"share_wait_over_15","from":["a_gold.share_wait_over_15"],"rule":"copy"}],"drops":[]},{"id":"T5","name":"Poll every registered party's live feed into the archive","short":"Poll feeds","lane":"region","col":1,"row":"gap","service":"ECS on Fargate · poller; Data Firehose writes Parquet","when":"every 10 s; batched within 5 minutes","inputs":["rt","registry"],"outputs":["archive"],"detail":{"grain":"one VehiclePosition entity, or one stop of a TripUpdate, → one row","joins":["registry.parties.feed_url_rt names the feed; the party id comes with it"],"filters":["only parties with status joined"],"dedup":["a position with the same vehicle and timestamp as the last one polled is dropped"],"nulls":["fields a party does not publish stay null"],"units":["GTFS-Realtime's: WGS-84 degrees, epoch seconds"],"privacy":["public data"],"key":"the region's; split by party so a leaver's part is one prefix delete"},"columns":[{"out":"archive.party_id","expr":"parties.party_id of the feed polled","from":["registry.parties.party_id","registry.parties.feed_url_rt"],"rule":"join"},{"out":"archive.record_kind","expr":"'position' for a VehiclePosition, 'trip_update' for a TripUpdate stop","from":["rt.vp.entity_id","rt.tu.trip.trip_id"],"rule":"derive"},{"out":"archive.polled_at","expr":"now()","from":[],"rule":"generate"},{"out":"archive.pos.vehicle_id","expr":"vp.vehicle.id","from":["rt.vp.vehicle.id"],"rule":"copy"},{"out":"archive.pos.trip_id","expr":"vp.trip.trip_id","from":["rt.vp.trip.trip_id"],"rule":"copy"},{"out":"archive.pos.route_id","expr":"vp.trip.route_id","from":["rt.vp.trip.route_id"],"rule":"copy"},{"out":"archive.pos.direction_id","expr":"vp.trip.direction_id","from":["rt.vp.trip.direction_id"],"rule":"copy"},{"out":"archive.pos.start_date","expr":"vp.trip.start_date","from":["rt.vp.trip.start_date"],"rule":"copy"},{"out":"archive.pos.latitude","expr":"vp.position.latitude","from":["rt.vp.position.latitude"],"rule":"copy"},{"out":"archive.pos.longitude","expr":"vp.position.longitude","from":["rt.vp.position.longitude"],"rule":"copy"},{"out":"archive.pos.current_stop_sequence","expr":"vp.current_stop_sequence","from":["rt.vp.current_stop_sequence"],"rule":"copy"},{"out":"archive.pos.stop_id","expr":"vp.stop_id","from":["rt.vp.stop_id"],"rule":"copy"},{"out":"archive.pos.current_status","expr":"vp.current_status","from":["rt.vp.current_status"],"rule":"copy"},{"out":"archive.pos.timestamp","expr":"vp.timestamp, else header.timestamp","from":["rt.vp.timestamp","rt.header.timestamp"],"rule":"derive"},{"out":"archive.tu.trip_id","expr":"tu.trip.trip_id","from":["rt.tu.trip.trip_id"],"rule":"copy"},{"out":"archive.tu.route_id","expr":"tu.trip.route_id","from":["rt.tu.trip.route_id"],"rule":"copy"},{"out":"archive.tu.start_date","expr":"tu.trip.start_date","from":["rt.tu.trip.start_date"],"rule":"copy"},{"out":"archive.tu.vehicle_id","expr":"tu.vehicle.id","from":["rt.tu.vehicle.id"],"rule":"copy"},{"out":"archive.tu.stop_sequence","expr":"tu.stop_time_update.stop_sequence","from":["rt.tu.stop_time_update.stop_sequence"],"rule":"copy"},{"out":"archive.tu.stop_id","expr":"tu.stop_time_update.stop_id","from":["rt.tu.stop_time_update.stop_id"],"rule":"copy"},{"out":"archive.tu.arrival_time","expr":"tu.stop_time_update.arrival.time","from":["rt.tu.stop_time_update.arrival.time"],"rule":"copy"},{"out":"archive.tu.departure_time","expr":"tu.stop_time_update.departure.time","from":["rt.tu.stop_time_update.departure.time"],"rule":"copy"},{"out":"archive.tu.schedule_relationship","expr":"tu.stop_time_update.schedule_relationship","from":["rt.tu.stop_time_update.schedule_relationship"],"rule":"copy"},{"out":"archive.tu.timestamp","expr":"tu.timestamp","from":["rt.tu.timestamp"],"rule":"copy"}],"drops":[]},{"id":"T6","name":"Derive the arrival at each stop; attach the stop crosswalk","short":"Derive arrivals","lane":"region","col":1.5,"row":1,"service":"Glue ETL · derive arrivals (or Databricks)","when":"nightly, 01:00, for the service day ended","inputs":["archive","registry"],"outputs":["arrivals"],"detail":{"grain":"positions and trip-update stops of one vehicle on one trip → one row per stop it served","joins":["positions and trip updates of the same party, trip and service day","registry.shared_stops on (party_id, stop_id) for the crosswalk","registry.parties for the PRESTO operator name"],"filters":["a stop with no position at it and no trip update for it is not written: no interpolation beyond one stop either side"],"dedup":["one row per party, service day, trip and stop sequence: the earliest STOPPED_AT position wins over the trip update, which wins over interpolation"],"nulls":["departure null when the vehicle was seen at the stop once"],"units":["epoch seconds → UTC timestamps"],"privacy":["public positions; no rider"],"key":"the region's; each agency reads it in place through a Lake Formation grant (decision 49)"},"columns":[{"out":"arrivals.party_id","expr":"party_id","from":["archive.party_id"],"rule":"copy"},{"out":"arrivals.operator_name","expr":"parties.presto_operator_name of party_id","from":["registry.parties.party_id","registry.parties.presto_operator_name"],"rule":"join"},{"out":"arrivals.service_date","expr":"pos.start_date, or tu.start_date","from":["archive.pos.start_date","archive.tu.start_date"],"rule":"derive"},{"out":"arrivals.trip_id_performed","expr":"pos.trip_id, or tu.trip_id","from":["archive.pos.trip_id","archive.tu.trip_id"],"rule":"derive"},{"out":"arrivals.trip_stop_sequence","expr":"rank of the stop within the trip's stops seen (1, 2, 3)","from":["archive.pos.current_stop_sequence","archive.tu.stop_sequence"],"rule":"derive"},{"out":"arrivals.stop_id","expr":"pos.stop_id where current_status = STOPPED_AT, or tu.stop_id","from":["archive.pos.stop_id","archive.pos.current_status","archive.tu.stop_id"],"rule":"derive"},{"out":"arrivals.route_id","expr":"pos.route_id, or tu.route_id","from":["archive.pos.route_id","archive.tu.route_id"],"rule":"derive"},{"out":"arrivals.vehicle_id","expr":"pos.vehicle_id, or tu.vehicle_id","from":["archive.pos.vehicle_id","archive.tu.vehicle_id"],"rule":"derive"},{"out":"arrivals.actual_arrival_time","expr":"min(pos.timestamp) while STOPPED_AT at the stop; else tu.arrival_time once past; else interpolated between the positions either side","from":["archive.pos.timestamp","archive.pos.current_status","archive.tu.arrival_time","archive.pos.latitude","archive.pos.longitude"],"rule":"aggregate"},{"out":"arrivals.actual_departure_time","expr":"max(pos.timestamp) while STOPPED_AT at the stop; else tu.departure_time","from":["archive.pos.timestamp","archive.pos.current_status","archive.tu.departure_time"],"rule":"aggregate"},{"out":"arrivals.source","expr":"'stopped_at', 'trip_update' or 'interpolated' by which rule gave the arrival","from":["archive.pos.current_status","archive.tu.arrival_time"],"rule":"derive"},{"out":"arrivals.shared_with","expr":"one entry per shared_stops row for (party_id, stop_id)","from":["registry.shared_stops.party_id","registry.shared_stops.stop_id"],"rule":"join"},{"out":"arrivals.shared_with[].party","expr":"shared_stops.neighbour_party","from":["registry.shared_stops.neighbour_party"],"rule":"copy"},{"out":"arrivals.shared_with[].stop_id","expr":"shared_stops.neighbour_stop_id","from":["registry.shared_stops.neighbour_stop_id"],"rule":"copy"}],"drops":[]},{"id":"T7","name":"Check each file against its contract","short":"Check the file","lane":"region","col":1.5,"row":3,"service":"Lambda · contract check, on the file-arrived event","when":"as each file lands; the alarm at 06:00","inputs":["inbox","registry"],"outputs":["rejects"],"detail":{"grain":"one file → accepted (nothing written here) or one rejection","joins":["registry.contracts for the party's active transfer-totals contract and its terms","registry.parties.key_arn against the object's key"],"filters":["shape: the columns and types the contract names, nothing more","deadline: received_at before 06:00","privacy rule: no row with transfers under 5","key: the object is encrypted with the party's registered key","an active contract exists"],"dedup":["a file replaced after a rejection is checked again; the earlier message stays until it expires"],"nulls":["a null transfers value is a shape failure: the agency sends counts or nothing"],"units":["none"],"privacy":["the check reads counts; it never sees a tap"],"key":"the region's on the message; the file stays under the agency's"},"columns":[{"out":"rejects.party_id","expr":"inbox.party_id","from":["inbox.party_id"],"rule":"copy"},{"out":"rejects.service_date","expr":"inbox.service_date","from":["inbox.service_date"],"rule":"copy"},{"out":"rejects.object_key","expr":"inbox.object_key","from":["inbox.object_key"],"rule":"copy"},{"out":"rejects.reason","expr":"the first check that failed: shape, deadline, privacy_rule, wrong_key, no_contract","from":["inbox.row.transfers","inbox.received_at","inbox.key_arn","registry.contracts.terms","registry.contracts.deadline","registry.contracts.status","registry.parties.key_arn"],"rule":"derive"},{"out":"rejects.detail","expr":"which column, which row count, which key","from":["inbox.rows","inbox.row.transfers","inbox.key_arn"],"rule":"derive"},{"out":"rejects.checked_at","expr":"now()","from":[],"rule":"generate"},{"out":"rejects.notified_at","expr":"when the agency's bus took the message; the path back is still open","from":[],"rule":"generate"}],"drops":[]},{"id":"T8","name":"Add the accepted files up into the regional table","short":"Add up","lane":"region","col":2.5,"row":2,"service":"Glue ETL · add up (or Databricks)","when":"06:30, with what has landed","inputs":["inbox","registry"],"outputs":["regional"],"detail":{"grain":"unchanged rows, with the from-operator resolved to a party id; one unknown row per missing party and band","joins":["registry.parties.presto_operator_name = row.from_operator → from_party","registry.parties with status joined and an active contract: the parties expected tonight"],"filters":["only files T7 accepted","a party whose file is missing at 06:30 gets rows with status unknown and null counts, never zero (decision 50)"],"dedup":["one row per key; a file re-sent after 06:30 replaces its party's rows at the next run"],"nulls":["from_party 'unknown' for an operator name the registry does not hold (a party not on PRESTO is never named on a tap anyway)"],"units":["unchanged"],"privacy":["rows arrive already suppressed; the region adds, it never disaggregates"],"key":"each agency's rows stay under its own key, read through the grant (decision 41); revoke it and they go dark"},"columns":[{"out":"regional.party_id","expr":"row.party_id (checked against the folder)","from":["inbox.row.party_id","inbox.party_id"],"rule":"copy"},{"out":"regional.from_party","expr":"parties.party_id where presto_operator_name = row.from_operator; else 'unknown'","from":["inbox.row.from_operator","registry.parties.presto_operator_name","registry.parties.party_id"],"rule":"join"},{"out":"regional.service_date","expr":"row.service_date","from":["inbox.row.service_date"],"rule":"copy"},{"out":"regional.to_route","expr":"row.to_route","from":["inbox.row.to_route"],"rule":"copy"},{"out":"regional.time_band","expr":"row.time_band","from":["inbox.row.time_band"],"rule":"copy"},{"out":"regional.transfers","expr":"row.transfers; null for an unknown row","from":["inbox.row.transfers"],"rule":"copy"},{"out":"regional.median_wait_min","expr":"row.median_wait_min","from":["inbox.row.median_wait_min"],"rule":"copy"},{"out":"regional.share_wait_over_15","expr":"row.share_wait_over_15","from":["inbox.row.share_wait_over_15"],"rule":"copy"},{"out":"regional.status","expr":"'reported', or 'unknown' when the party's file was late or missing","from":["inbox.received_at","registry.parties.status"],"rule":"derive"},{"out":"regional.contract_version","expr":"contracts.version the file was checked against","from":["registry.contracts.version"],"rule":"join"},{"out":"regional.loaded_at","expr":"now()","from":[],"rule":"generate"}],"drops":[]},{"id":"T9","name":"Serve the four reports a reader may see","short":"Serve reports","lane":"region","col":3.5,"row":2,"service":"Athena · queries; API Gateway; Verified Permissions","when":"on request; cached","inputs":["regional"],"outputs":["api"],"detail":{"grain":"rows → a matrix by party pair and band; waits and crossing points by route; connection times for the journey view","joins":["the sign-in token names the reader's party; Verified Permissions decides from the compiled agreements"],"filters":["a planner sees the whole matrix; the journey view sees connection times only","every read is an audit event"],"dedup":["none"],"nulls":["an unknown party stays unknown in every report; it is never filled by an average"],"units":["transfers a typical weekday; minutes; shares"],"privacy":["allow-or-deny per reader; nothing finer than a route and a 3-hour band exists to leak"],"key":"the region's; TLS to the reader; the cache purged when a party leaves"},"columns":[{"out":"api.matrix.from_party","expr":"from_party","from":["regional.from_party"],"rule":"copy"},{"out":"api.matrix.to_party","expr":"party_id","from":["regional.party_id"],"rule":"copy"},{"out":"api.matrix.time_band","expr":"time_band","from":["regional.time_band"],"rule":"copy"},{"out":"api.matrix.transfers","expr":"median over the last 12 weekdays of Σ transfers over to_route","from":["regional.transfers","regional.to_route","regional.service_date"],"rule":"aggregate"},{"out":"api.matrix.status","expr":"'unknown' if any row of the pair is unknown","from":["regional.status"],"rule":"derive"},{"out":"api.waits.to_party","expr":"party_id","from":["regional.party_id"],"rule":"copy"},{"out":"api.waits.to_route","expr":"to_route","from":["regional.to_route"],"rule":"copy"},{"out":"api.waits.time_band","expr":"time_band","from":["regional.time_band"],"rule":"copy"},{"out":"api.waits.median_wait_min","expr":"median over days of median_wait_min","from":["regional.median_wait_min","regional.service_date"],"rule":"aggregate"},{"out":"api.waits.share_wait_over_15","expr":"mean over days of share_wait_over_15","from":["regional.share_wait_over_15","regional.service_date"],"rule":"aggregate"},{"out":"api.crossing.to_party","expr":"party_id","from":["regional.party_id"],"rule":"copy"},{"out":"api.crossing.to_route","expr":"to_route","from":["regional.to_route"],"rule":"copy"},{"out":"api.crossing.from_party","expr":"from_party","from":["regional.from_party"],"rule":"copy"},{"out":"api.crossing.transfers","expr":"Σ transfers over bands, ranked across the region","from":["regional.transfers","regional.time_band"],"rule":"aggregate"},{"out":"api.connection.from_party","expr":"from_party","from":["regional.from_party"],"rule":"copy"},{"out":"api.connection.to_party","expr":"party_id","from":["regional.party_id"],"rule":"copy"},{"out":"api.connection.to_route","expr":"to_route","from":["regional.to_route"],"rule":"copy"},{"out":"api.connection.time_band","expr":"time_band","from":["regional.time_band"],"rule":"copy"},{"out":"api.connection.median_wait_min","expr":"median_wait_min of the latest reported day","from":["regional.median_wait_min","regional.status"],"rule":"derive"},{"out":"api.served_at","expr":"now()","from":[],"rule":"generate"}],"drops":[]}],"edges":[{"from":"afc","to":"T1","kind":"data"},{"from":"T1","to":"b_afc","kind":"data"},{"from":"b_afc","to":"T2","kind":"data"},{"from":"T2","to":"a_fares","kind":"data"},{"from":"a_fares","to":"T3","kind":"data"},{"from":"arrivals","to":"T3","kind":"cross","fs":"t","fo":40,"ts":"b","via":[["y","bot:agency:0"],["x","x:T3"]],"label":"read in place, by grant: arrivals on shared stop ids, with the crosswalk"},{"from":"T3","to":"a_gold","kind":"data"},{"from":"a_gold","to":"T4","kind":"data"},{"from":"T4","to":"inbox","kind":"cross","fs":"b","ts":"t","via":[["y","row:region:1.5"],["x","x:inbox"]],"lseg":"v","lp":0.3,"label":"the nightly file: SSE-KMS with the agency's key, by 06:00, rows under 5 cards already dropped"},{"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":60,"ts":"b","tof":-34,"via":[["y","top:region:0"],["x","x:T5:-34"]],"label":"which feeds"},{"from":"T5","to":"archive","kind":"data","fs":"b","ts":"t"},{"from":"archive","to":"T6","kind":"data","fs":"b","ts":"l","via":[["y","row:region:1"]]},{"from":"registry","to":"T6","kind":"plan","fs":"r","fo":-14,"ts":"l","tof":12,"via":[["x","colR:0:34"]],"label":"shared stops, operator names"},{"from":"T6","to":"arrivals","kind":"data"},{"from":"inbox","to":"T7","kind":"data","fs":"b","ts":"l","via":[["y","row:region:3"]]},{"from":"registry","to":"T7","kind":"plan","fs":"r","fo":14,"ts":"l","tof":12,"label":"contract terms, keys"},{"from":"T7","to":"rejects","kind":"data","fs":"r","ts":"l","label":"rejected, with the reason; the agency told"},{"from":"inbox","to":"T8","kind":"data","fs":"r","ts":"l"},{"from":"registry","to":"T8","kind":"plan","fs":"r","fo":0,"ts":"b","tof":-20,"via":[["x","colR:0:48"],["y","row:region:2.5"],["x","x:T8:-20"]],"label":"parties expected"},{"from":"T8","to":"regional","kind":"data"},{"from":"regional","to":"T9","kind":"data"},{"from":"T9","to":"api","kind":"data"}],"notes":{"planned":"Columns of the regional tables are a proposal (decision 58). Nothing is deployed.","pages":{"tables":"@/digital-twin/transfer-tables"}}}
