Digital twin · transfer analysis · data architecture · planned
Tables, keys and rules.
Every table on the lineage picture, with 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 joins that hold it together and the rules that keep it clean. The column lists themselves live on the picture: hover a table, or hold Shift for the entity-relationship view.
Every table.
Grain, partitioning, retention and the columns of the regional tables are decision 58, proposed. Retention figures already in a contract or a cost model are kept as they stand.
| Table | Layer | Shape | Grain: one row is | Keys | Columns | Split by | Kept | Whose key |
|---|---|---|---|---|---|---|---|---|
| PRESTO fare export the sample files | 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 fare export the sample files | 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 fare_transactions tested on the sample | 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 |
| Nightly transfer totals replayed on the sample | 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-Realtime feeds already standard | 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 | 23 | polled every 10 s | not stored as such; see the feed archive | none, open |
| Feed archive planned | 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 |
| Public arrivals planned | 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 |
| Registry planned | 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 |
| Inbox: nightly files planned | 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 |
| Regional transfer table planned | 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 |
| Rejected files planned | Out | SQS message per file | one message per rejected file | party_id, service_date, object_key | 7 | not partitioned | 14 days, replayable | region |
| Report API planned | 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 |
Tested: an exploration built the table from the real month. Replayed: the sample analysis computed its values from the month's files. Standard: the shape is the published one already. Nothing is deployed. The column count links to the picture, where every column is listed with its type and key role.
Keys and joins.
Five identifiers carry every join in this use case. Each is written once in the sample's vendor form and once in the standard's.
| Key | In the vendor file | In the standard | At the region | Checked |
|---|---|---|---|---|
| Tap | TransactionID | transaction_id | never: no tap leaves | 1.69 M taps, one malformed row |
| Card | GSN, the serial; restricted | token_id null; card_hash extra, HMAC with the agency's secret | never | counted in taps in the sample because the card is never loaded there; the real adapter counts distinct hashes |
| Transfer operator | TransferServiceProviderID, _Name; 0 when none | from_operator_id, from_operator_name: named extras, no TIDES field | from_party, resolved through the registry's PRESTO operator names | 818,562 taps name one; six operators on a weekday |
| Stop | TrxLocationID, without leading zeros (398,199 padded) | stop_id = GTFS stop | shared_stops in the registry: the crosswalk the arrivals carry | 99.1% of taps find their GTFS stop |
| Route | LineID | route_id, an extra, with the agency's prefix | to_route | every tap has one |
| Band | Time | event_timestamp | time_band: the hour floored to 3 | 1,352 from-operator × route × band cells on the reference day |
| Party | the file is one agency's | a party id from the registry, on every regional row | the folder, and the key the file is signed with | by contract: no registered party, no row |
Taps between midnight and 04:00 sit on the calendar date (20,356 in the sample); six agencies adding up need one definition of the service day, which is still open (audit). The wait needs the from-operator's public arrivals at the crosswalked stop: the sample's sketch used the agency's own AVL instead, so it shows the method, not cross-agency waits.
Quality and privacy rules.
The same rules the data contracts page states, 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 transaction id.
- Stop must exist in the agency's GTFS; a device with no stop keeps a null, not a guess.
- The three extras are named in the contract, not slipped in: transfer operator, route, hashed card.
- Flagged, not rejected: a fare that differs from the amount paid (5,631 rows).
At the border
- Every file checked against its contract before it counts (T7): shape, 06:00 deadline, no row under 5 cards, the party's own key, an active contract.
- A file late or missing by 06:00 raises an alarm; the 06:30 table shows that agency as unknown, never zero.
- A rejected file is held 14 days with its reason; the path back to the agency is still to be drawn.
- A party not on PRESTO is never named on a tap, so it shows unknown (decision 37).
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): the sample's counts are in taps because the card is never loaded.
- Fare class and product are withheld even at home: they can reveal a concession.
- Rows under 5 distinct cards are dropped before the file is written (decision 26); the region adds, it never disaggregates.
Decided
- Transfers come from PRESTO's own flag, counted at home; only totals cross, nightly, under a published contract (25, 27)
- Rows under 5 distinct cards are dropped; the card is hashed at home to count them (26, 48)
- Each agency's rows at the region stay under its own key by revocable grant; leaving deletes them and rebuilds (41, 43, 50)
- Arrivals are derived by the region from the public feeds and read in place with a stop crosswalk (49)
Open
- Decision 58, proposed: grain, partitioning, retention and the columns of every table above, including the regional table's unknown rows and the four reports
- Crossing points by stop: the contract's grain is by route, the sample's finding (Kipling) is by stop; one of them changes (audit)
- One definition of the service day across six agencies
- The rejected-file path back to the agency, and whether a corrected file may replace a counted one
Caveats
- Tested means the adapter prototype built fare_transactions from one agency's month (100% pass the schema); the totals were replayed from it (20,234 cross-agency transfers a weekday); the regional tables exist on paper only
- The sample's waits are MiWay-to-MiWay, from its own AVL: the method, not the cross-agency figure
- Vendor ids and formats are one agency's; a second vendor would need its own adapter mapping
- A PRESTO transfer flag means a tap within the fare's transfer window, which includes long stops and return trips; the pages treat every flag as a connection