TransitAI Core

Digital twin · merged platform · data architecture · proposed

Tables, keys and rules, for both paths.

Every table on the merged lineage picture, with the path it serves, what one row stands for, how it is keyed, how many columns it has, how its files are split, how long it is kept and under whose key. Then the keys that hold both paths together and the rules that keep them clean. The column lists live on the picture: hover a table, or hold Shift for the entity-relationship view.

The tablesKeys and joinsQuality and privacy

Every table, once.

3 serve both paths, 17 the online path only, 9 the offline path only. Grain, partitioning and retention are decisions 56 and 58, proposed; the columns of the regional tables decisions 57 and 58, proposed; the merge decision 62, proposed. Retention figures already in a contract or a cost model are kept as they stand.

TablePathLayerShapeGrain: one row isKeysColumnsSplit byKeptWhose key
AVL stop times
the sample files
onlineSourcevendor CSV, ;-delimited, UTF-8 BOMone row per trip per stopCALENDAR_ID, TRIP_ID, ROUTE_ABBR, GEO_NODE_ABBR, GEO_NAME prefix26one file a monththe agency's ruleagency
APC counters
the sample files
onlineSourcevendor CSV, ;-delimited, UTF-8 BOM; first two columns in the opposite order to AVLone row per trip per stop; a visit may have severalCALENDAR_ID, TRIP_ID, ROUTE_ABBR, STOP_NUMBER, PATTERN_STOP_SEQUENCE18one file a monththe agency's ruleagency
PRESTO fare export
the sample files
offlineSourcevendor CSV, ,-delimited, with a headerone row per tapTransactionID18one file a month in the sample; nightly in a live agencythe agency's ruleagency
Raw AVL export
the sample files
onlineBronzeas received, plus file and landing timeas receivednone imposed28by file and service daythe agency's rule; never leavesagency
Raw APC export
the sample files
onlineBronzeas received, plus file and landing timeas receivednone imposed20by file and service daythe agency's rule; never leavesagency
Raw fare export
the sample files
offlineBronzeas received, plus file and landing timeas receivednone imposed20by file and calendar datethree years (the raw landing); never leavesagency
TIDES stop_visits
tested on the sample
onlineSilverTIDES stop_visits (AVL skeleton, APC counts merged)service day × trip × stop sequenceservice_date, trip_id_performed, trip_stop_sequence; stop_id = GTFS stop17by service daythe agency's rule; the region never reads itagency
TIDES trips_performed
planned
onlineSilverTIDES trips_performedservice day × tripservice_date, trip_id_performed; trip_id_scheduled = GTFS trip_id through the trip map17by service daythe agency's rule; never leavesagency
TIDES fare_transactions
tested on the sample
offlineSilverTIDES fare_transactions plus named extras: the transfer operator, the route, the hashed cardone row per taptransaction_id; stop_id = GTFS stop17by service daythe agency's rule; the region never reads itagency
5-minute loads
replayed on the sample
onlineGoldTIDES passenger_events, summed; five extras named in the contract (decision 60)route × direction × stop × 5-minute windowservice_date, route_id, direction_id, stop_id, window_start9sent every 5 minutes, within 224 hours on the laneregion, on arrival
Nightly transfer totals
replayed on the sample
offlineGoldTIDES station_activities plus extras: the contract's rowfrom-operator × route × date × 3-hour bandparty_id, service_date, from_operator, to_route, time_band8one file per service daykept at home; the copy at the region 3 years under the agency's keyagency
GTFS timetables
already standard
onlineSourceGTFS zip, as publishedone row per trip per stop (stop_times)trip_id, stop_id, stop_sequence; service_id carries the board period39by party and feed versionevery version the archive still coversnone, open
GTFS-Realtime feeds
already standard
both pathsSourceGTFS-Realtime protobuf, as each party publishes itone position per vehicle every 10 s; one trip update per tripparty, vehicle id, trip id, timestamp39polled every 10 snot stored as such; see the live lanenone, open
Weather and events
planned
onlineSourcenot chosennot chosenplace and time6not chosennot chosennone, open
Live lane
planned
onlineBronzerecords as received (Kinesis Data Streams), two record kindsone record per position or per load rowparty_id, sequence_number29one shard per party24 hoursregion
Feed archive
planned
offlineBronzerecords as polled, two kinds (Parquet in Iceberg)one row per position; one per trip update stopparty_id, record_kind, polled_at, then the feed's own ids24by party and service day3 years, as costed; a leaver's part deleted at once, snapshots expiredregion
TIDES vehicle_locations
planned
onlineSilverTIDES vehicle_locations plus extrasone row per positionlocation_ping_id; party_id, service_date, vehicle_id, event_timestamp19by party and service day3 years, as costed; a leaver's part deleted at once, snapshots expiredregion
Inbox: nightly files
planned
offlineBronzeS3 objects, the contract's rows as sent, SSE-KMS with the agency's keyone file per party per service day; its rows as sentparty_id, service_date14by party and service day3 years, under the agency's key; deleted when it leavesagency, granted
Timetables
already standard
onlineSilverGTFS, unchanged, plus party and versionas GTFSparty_id, feed_version, then each file's own key42by party and feed versionwhile the archive covers itregion
Public arrivals
planned
offlineSilverTIDES stop_visits, times only, plus the crosswalkparty × service day × trip × stopparty_id, service_date, trip_id_performed, trip_stop_sequence14by party and service day3 years, with the archiveregion; read in place by each agency through a grant
Last state per vehicle
planned
onlineGoldDynamoDB items of two kinds: a vehicle, a counterone item per vehicle, overwritten; one per route and stop for the counterspk = party_id; sk = vehicle_id, or route_id and stop_id16by partyuntil overwritten; expires a day after the last sightingregion
Delay and load per route
replayed on the sample
onlineGoldCloudWatch metrics; the band is the detector'sroute × direction × 5-minute window, one value per metricparty_id, route_id, direction_id, metric_name, timestamp11one series per route and direction63 days; cannot be deleted soonerregion
Regional transfer table
planned
both pathsGoldIceberg table; the contract's row, with the party ids resolvedto-agency × from-party × route × date × 3-hour bandparty_id, from_party, service_date, to_route, time_band11by party (the to-agency) and service date3 years; a leaver's rows deleted, snapshots expired, reports rebuilteach agency's, by revocable grant
Who is affected
planned
onlineGoldDynamoDB item, built with Athenaparty × route × stop → neighbours and their sharepk = party_id; sk = route_id#stop_id10by partyreplaced nightlybuilt under each agency's key, by grant
Registry
planned
both pathsSourceAurora tables: parties, contracts, shared_stopsone party; one contract version; one shared stop pairparty_id; contract_id; party_id, stop_id, neighbour_party22not partitionedwhile the region runs; a leaver's row marked left, kept for auditregion
Alerts
replayed on the sample
onlineOutno TIDES home; the shape the contract names (DynamoDB alert log)one row per alert, open or clearedalert_id; party_id and month for the partition18by party and month13 months at the region; copies stay with receiversregion; each receiver's own
Live alert feed
planned
onlineOutJSON over the APIthe open alerts a reader may seereader's party; allow-or-deny rules14per requestnot storedregion
Report API
planned
offlineOutJSON over the API; four reportsone report per request, filtered per readerreader's party; allow-or-deny rules20per request; cachedcached briefly; purged when a party leavesregion
Rejected files
planned
offlineOutSQS message per fileone message per rejected fileparty_id, service_date, object_key7not partitioned14 days, replayableregion

Tested: an exploration built the table from the real month. Replayed: the sample analysis or replay computed its values from the month's files. Standard: the shape is the published one already. Nothing is deployed.

Keys and joins.

The keys of both use cases, together. Four carry every join of the online path, six the offline one; the service day, the stop and the party carry both.

KeyPathIn the vendor filesIn the standardAt the regionChecked
Service dayboth pathsCALENDAR_ID, 1YYYYMMDD, times in seconds past midnight (AVL, APC); Date and Time (fares)service_date; a timestamp per eventstart_date in the GTFS-Realtime trip; the partition of every regional tableone definition across six agencies is still open: taps before 04:00 sit on the calendar date
Stopboth pathsGEO_NODE_ABBR, STOP_NUMBER, TrxLocationID without leading zerosstop_id = GTFS stop_id, which equals stop_code in this feedshared_stops in the registry: the crosswalk the arrivals carry and the who-is-affected lookup joins on100% of visits and 99.1% of taps find their GTFS stop
Partyboth pathsthe file is one agency'sa party id from the registry, on every regional rowthe feed address, the folder, the signing key, the PRESTO operator name: all in one registry rowby contract: no registered party, no row
Triponlinevendor TRIP_ID, never in GTFS trips.txttrip_id_performed → GTFS trip_id through the trip maptrip_id as the feed names it99.78% of 136,684 trip-days match one GTFS trip exactly
Route and directiononlineROUTE_ABBR; direction codesGTFS route_id; direction_id from the timetable triproute_id, direction_id on the lane and the metricsevery route-direction pair maps to one direction_id
Windowonlinenonewindow_start: the departure time rounded down to 5 minutesthe same96% of 247,241 route-windows hold three or more visits
TapofflineTransactionIDtransaction_idnever: no tap leaves1.69 M taps, one malformed row
CardofflineGSN, the serial; restrictedtoken_id null; card_hash extra, HMAC with the agency's secretneverthe real adapter counts distinct hashes; the sample counted taps because the card is never loaded
Transfer operatorofflineTransferServiceProviderID, _Name; 0 when nonefrom_operator_id, from_operator_name: named extrasfrom_party, resolved through the registry's PRESTO operator names818,562 taps name one
BandofflineTimeevent_timestamptime_band: the hour floored to 31,352 from-operator × route × band cells on the reference day

AVL and APC join to each other on service day, trip, route, stop and stop sequence; neither joins to GTFS on the trip id, which is why the trip map exists. The fare export joins to nothing at home but the GTFS stops; its link to another agency is the transfer operator's name, resolved at the region.

Quality and privacy rules.

The rules of both contracts, written against the tables above; each is also written into the step that applies it, on the picture.

On the way into Silver

  • Every row checked against the published TIDES schema: types, required fields, enums, unique keys, non-negative counts.
  • Stop must exist in the party's GTFS; a device with no stop keeps a null, not a guess.
  • Duplicate counter records of one visit summed; the string NULL becomes null; the card hashed and dropped.
  • Extras are named in the contracts, never slipped in.

At the border and while it runs

  • Every nightly file checked against its contract before it counts: shape, 06:00 deadline, no row under 5 cards, the party's own key, an active contract.
  • Loads late or off-contract: crowding alerts pause for that party; delay alerts carry on.
  • A window with fewer than three visits, a party not sharing, or a file late by 06:00 shows unknown, never normal or zero.
  • Feed gap, frozen vehicle, position jump, dead counter: the rules on the live lane.

Never

  • The card serial never leaves the agency's account, raw or hashed; no card is matched across agencies (decisions 8, 25, 48).
  • No card serial or per-card record is written to the repo or the site (decision 16).
  • Rows under 5 distinct cards are dropped before the file is written; the region adds, it never disaggregates.
  • Alerts name a party, a route, a vehicle as its own feed names it, and a neighbour; never a rider.

Decided

  • Standards are the table shapes (4); raw data stays home (5); fare records stay with the agency (8); loads are counts with no minimum group size (21)
  • Each agency's rows at the region rest under its own key by one revocable grant; leaving deletes them and rebuilds (41, 43, 50)
  • Both contracts' grain, cadence, custody and retention stand as written (42, 55, 60)

Open

  • Decision 62, proposed: one platform for both use cases, with every shared part once
  • Decision 63, proposed: one adapter, one Bronze and one Silver at home, read by both paths
  • Decision 64, proposed: one registry, one inbox and check, one catalogue, one feed archive at two layers, one off-boarding job
  • Decision 65, proposed: the speed layer and the batch layer read the same Silver (Lambda architecture); one streaming path for both (Kappa) not taken
  • One Silver with two write cadences; one service-day definition; whether alerts and totals share one regional layout

Caveats

  • Tested means the adapter prototype built stop_visits and fare_transactions from one agency's month; every regional table exists on paper only
  • The merge is a desk exercise on the two specifications; nothing has been run on one stream buffer
  • Vendor ids and formats are one agency's; a second vendor would need its own adapter mapping

↑ ↓ to move · ↵ to open · esc to close