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.
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.
| Table | Path | Layer | Shape | Grain: one row is | Keys | Columns | Split by | Kept | Whose key |
|---|---|---|---|---|---|---|---|---|---|
| AVL stop times the sample files | online | Source | vendor CSV, ;-delimited, UTF-8 BOM | one row per trip per stop | CALENDAR_ID, TRIP_ID, ROUTE_ABBR, GEO_NODE_ABBR, GEO_NAME prefix | 26 | one file a month | the agency's rule | agency |
| APC counters the sample files | online | Source | vendor CSV, ;-delimited, UTF-8 BOM; first two columns in the opposite order to AVL | one row per trip per stop; a visit may have several | CALENDAR_ID, TRIP_ID, ROUTE_ABBR, STOP_NUMBER, PATTERN_STOP_SEQUENCE | 18 | one file a month | the agency's rule | agency |
| PRESTO fare export the sample files | offline | Source | vendor CSV, ,-delimited, with a header | one row per tap | TransactionID | 18 | one file a month in the sample; nightly in a live agency | the agency's rule | agency |
| Raw AVL export the sample files | online | Bronze | as received, plus file and landing time | as received | none imposed | 28 | by file and service day | the agency's rule; never leaves | agency |
| Raw APC export the sample files | online | Bronze | as received, plus file and landing time | as received | none imposed | 20 | by file and service day | the agency's rule; never leaves | agency |
| Raw fare export the sample files | offline | Bronze | as received, plus file and landing time | as received | none imposed | 20 | by file and calendar date | three years (the raw landing); never leaves | agency |
| TIDES stop_visits tested on the sample | online | Silver | TIDES stop_visits (AVL skeleton, APC counts merged) | service day × trip × stop sequence | service_date, trip_id_performed, trip_stop_sequence; stop_id = GTFS stop | 17 | by service day | the agency's rule; the region never reads it | agency |
| TIDES trips_performed planned | online | Silver | TIDES trips_performed | service day × trip | service_date, trip_id_performed; trip_id_scheduled = GTFS trip_id through the trip map | 17 | by service day | the agency's rule; never leaves | agency |
| TIDES fare_transactions tested on the sample | offline | Silver | TIDES fare_transactions plus named extras: the transfer operator, the route, the hashed card | one row per tap | transaction_id; stop_id = GTFS stop | 17 | by service day | the agency's rule; the region never reads it | agency |
| 5-minute loads replayed on the sample | online | Gold | TIDES passenger_events, summed; five extras named in the contract (decision 60) | route × direction × stop × 5-minute window | service_date, route_id, direction_id, stop_id, window_start | 9 | sent every 5 minutes, within 2 | 24 hours on the lane | region, on arrival |
| Nightly transfer totals replayed on the sample | offline | Gold | TIDES station_activities plus extras: the contract's row | from-operator × route × date × 3-hour band | party_id, service_date, from_operator, to_route, time_band | 8 | one file per service day | kept at home; the copy at the region 3 years under the agency's key | agency |
| GTFS timetables already standard | online | Source | GTFS zip, as published | one row per trip per stop (stop_times) | trip_id, stop_id, stop_sequence; service_id carries the board period | 39 | by party and feed version | every version the archive still covers | none, open |
| GTFS-Realtime feeds already standard | both paths | Source | GTFS-Realtime protobuf, as each party publishes it | one position per vehicle every 10 s; one trip update per trip | party, vehicle id, trip id, timestamp | 39 | polled every 10 s | not stored as such; see the live lane | none, open |
| Weather and events planned | online | Source | not chosen | not chosen | place and time | 6 | not chosen | not chosen | none, open |
| Live lane planned | online | Bronze | records as received (Kinesis Data Streams), two record kinds | one record per position or per load row | party_id, sequence_number | 29 | one shard per party | 24 hours | region |
| Feed archive planned | offline | Bronze | records as polled, two kinds (Parquet in Iceberg) | one row per position; one per trip update stop | party_id, record_kind, polled_at, then the feed's own ids | 24 | by party and service day | 3 years, as costed; a leaver's part deleted at once, snapshots expired | region |
| TIDES vehicle_locations planned | online | Silver | TIDES vehicle_locations plus extras | one row per position | location_ping_id; party_id, service_date, vehicle_id, event_timestamp | 19 | by party and service day | 3 years, as costed; a leaver's part deleted at once, snapshots expired | region |
| Inbox: nightly files planned | offline | Bronze | S3 objects, the contract's rows as sent, SSE-KMS with the agency's key | one file per party per service day; its rows as sent | party_id, service_date | 14 | by party and service day | 3 years, under the agency's key; deleted when it leaves | agency, granted |
| Timetables already standard | online | Silver | GTFS, unchanged, plus party and version | as GTFS | party_id, feed_version, then each file's own key | 42 | by party and feed version | while the archive covers it | region |
| Public arrivals planned | offline | Silver | TIDES stop_visits, times only, plus the crosswalk | party × service day × trip × stop | party_id, service_date, trip_id_performed, trip_stop_sequence | 14 | by party and service day | 3 years, with the archive | region; read in place by each agency through a grant |
| Last state per vehicle planned | online | Gold | DynamoDB items of two kinds: a vehicle, a counter | one item per vehicle, overwritten; one per route and stop for the counters | pk = party_id; sk = vehicle_id, or route_id and stop_id | 16 | by party | until overwritten; expires a day after the last sighting | region |
| Delay and load per route replayed on the sample | online | Gold | CloudWatch metrics; the band is the detector's | route × direction × 5-minute window, one value per metric | party_id, route_id, direction_id, metric_name, timestamp | 11 | one series per route and direction | 63 days; cannot be deleted sooner | region |
| Regional transfer table planned | both paths | Gold | Iceberg table; the contract's row, with the party ids resolved | to-agency × from-party × route × date × 3-hour band | party_id, from_party, service_date, to_route, time_band | 11 | by party (the to-agency) and service date | 3 years; a leaver's rows deleted, snapshots expired, reports rebuilt | each agency's, by revocable grant |
| Who is affected planned | online | Gold | DynamoDB item, built with Athena | party × route × stop → neighbours and their share | pk = party_id; sk = route_id#stop_id | 10 | by party | replaced nightly | built under each agency's key, by grant |
| Registry planned | both paths | Source | Aurora tables: parties, contracts, shared_stops | one party; one contract version; one shared stop pair | party_id; contract_id; party_id, stop_id, neighbour_party | 22 | not partitioned | while the region runs; a leaver's row marked left, kept for audit | region |
| Alerts replayed on the sample | online | Out | no TIDES home; the shape the contract names (DynamoDB alert log) | one row per alert, open or cleared | alert_id; party_id and month for the partition | 18 | by party and month | 13 months at the region; copies stay with receivers | region; each receiver's own |
| Live alert feed planned | online | Out | JSON over the API | the open alerts a reader may see | reader's party; allow-or-deny rules | 14 | per request | not stored | region |
| Report API planned | offline | Out | JSON over the API; four reports | one report per request, filtered per reader | reader's party; allow-or-deny rules | 20 | per request; cached | cached briefly; purged when a party leaves | region |
| Rejected files planned | offline | Out | SQS message per file | one message per rejected file | party_id, service_date, object_key | 7 | not partitioned | 14 days, replayable | region |
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.
| Key | Path | In the vendor files | In the standard | At the region | Checked |
|---|---|---|---|---|---|
| Service day | both paths | CALENDAR_ID, 1YYYYMMDD, times in seconds past midnight (AVL, APC); Date and Time (fares) | service_date; a timestamp per event | start_date in the GTFS-Realtime trip; the partition of every regional table | one definition across six agencies is still open: taps before 04:00 sit on the calendar date |
| Stop | both paths | GEO_NODE_ABBR, STOP_NUMBER, TrxLocationID without leading zeros | stop_id = GTFS stop_id, which equals stop_code in this feed | shared_stops in the registry: the crosswalk the arrivals carry and the who-is-affected lookup joins on | 100% of visits and 99.1% of taps find their GTFS stop |
| Party | both paths | the file is one agency's | a party id from the registry, on every regional row | the feed address, the folder, the signing key, the PRESTO operator name: all in one registry row | by contract: no registered party, no row |
| Trip | online | vendor TRIP_ID, never in GTFS trips.txt | trip_id_performed → GTFS trip_id through the trip map | trip_id as the feed names it | 99.78% of 136,684 trip-days match one GTFS trip exactly |
| Route and direction | online | ROUTE_ABBR; direction codes | GTFS route_id; direction_id from the timetable trip | route_id, direction_id on the lane and the metrics | every route-direction pair maps to one direction_id |
| Window | online | none | window_start: the departure time rounded down to 5 minutes | the same | 96% of 247,241 route-windows hold three or more visits |
| Tap | offline | TransactionID | transaction_id | never: no tap leaves | 1.69 M taps, one malformed row |
| Card | offline | GSN, the serial; restricted | token_id null; card_hash extra, HMAC with the agency's secret | never | the real adapter counts distinct hashes; the sample counted taps because the card is never loaded |
| Transfer operator | offline | TransferServiceProviderID, _Name; 0 when none | from_operator_id, from_operator_name: named extras | from_party, resolved through the registry's PRESTO operator names | 818,562 taps name one |
| Band | offline | Time | event_timestamp | time_band: the hour floored to 3 | 1,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