TransitAI Core

Digital twin · data contracts

Data contracts.

A contract is the one page an agency signs up to: what it sends, how often, under what rule, and what it gets back. The two use cases each have one. Below them, a proposed general form that any new contract would fill in. Both are proposals; no agency has agreed to anything.

The two contractsThe general form

The two contracts, side by side.

Same clauses, different answers. The offline one moves a file a night; the online one moves counts every five minutes.

ClauseTransfer totals · v1 (offline)Live loads · v1 (online)
PurposeTransfer analysis: who changes agency, where, how long they waitAnomaly detection: crowding and dead counters, beside the public feeds
ShapeTIDES station_activitiesTIDES passenger_events, added up
Extra columnsfrom_operator, to_route, time_band, transfers (distinct cards), median_wait_min, share_wait_over_15; the party comes from the folder and the keyroute_id, direction_id, window_start (5 minutes), visits, on_board as the mean load over the window's visits
GrainFrom-operator × route × date × 3-hour bandRoute × direction × stop × 5-minute window
Cadence and deadlineNightly, by 06:00Every 5 minutes, within 2
When lateAlarm at 06:00; the 06:30 report shows the agency as unknownA rule fires; crowding alerts pause for that agency; delay alerts carry on
Privacy ruleRows under 5 distinct cards dropped before leavingCounts of people only; nothing about a rider or a card
CustodyAgency's key; the region holds a revocable grantRegion's key on arrival; 24 hours on the live lane
ReadersRegional planners, the journey viewThe detector only
What comes backPublic arrivals archive, stop crosswalk, regional transfer reportAlerts on your own feed and vehicles; neighbours' delays that break your connections
Retention3 years, under your key24 hours on the lane; route metrics age out in 63 days; alerts 13 months at the region
On leavingGrant revoked: rows go dark; files deleted; reports rebuiltPolling stops; alarms, vehicle state and archive part deleted
StatusDrafted; its counting tested on the September 2024 sampleDrafted; its detector tested on the same sample

What TIDES does not cover: the transfer operator (no field in the standard), the route and the distinct-card count (station_activities is per stop, not per route), the 5-minute window with its route, direction, visit count and mean load (passenger_events has no route and is per event), and alerts, which have no TIDES home at all. Each is named in the contract rather than slipped in. The column-level data architectures found the extras the first draft left out (decision 60, proposed).

A general data contract: proposed.

Decision 42 named nine clauses. Writing the two contracts added three: grain, when late, and custody. The form below is what a third contract would fill in.

What is sent

  • Name and version. Changes make a new version; the old one keeps running until its readers move.
  • Purpose. One sentence; the rule check refuses reads outside it.
  • Shape. A TIDES table, plus every extra column named and typed.
  • Grain. The keys of one row.

How it moves

  • Cadence and deadline. How often, and by when.
  • When late. What the region does, and what readers see: always unknown, never normal.
  • Privacy rule. The smallest count, or the fields that may never appear.
  • Custody. Whose key it rests under, and for how long.

What comes back, and the end

  • Readers. Who may read, compiled to allow-or-deny rules.
  • What comes back. The agency's return for sharing.
  • Retention. How long, and where.
  • On leaving. What is deleted at once, what ages out, what the agency keeps.

The same form, as the registry would hold it

Illustrative; field names are a proposal.

contract:
  name: live-loads            version: 1
  purpose: anomaly detection
  shape:
    tides_table: passenger_events
    extra_columns: [route_id: text, direction_id: integer, window_start: timestamp,
                    visits: integer, on_board: integer (mean load over the visits)]
  grain: [route_id, direction_id, stop_id, window_start]
  cadence: every 5 minutes    deadline: within 2 minutes
  when_late: pause crowding alerts for the sender; mark unknown
  privacy_rule: counts only; no rider, no card
  custody: region key; 24 hours on the lane
  readers: [detector]
  returns: [own alerts, neighbours' delays affecting connections]
  retention: 24 hours lane; 63 days metrics; 13 months alerts
  on_leaving: stop polling; delete alarms, state, archive part
  status: drafted
Why a form
The region compiles each clause into a rule it checks on every request; a clause that is prose cannot be compiled. The agreement-to-policy exploration showed 20 of 55 sub-clauses compile today.
What stays open
A TIDES home for transfer totals and for alerts; whether "when late" belongs in the contract or in the region's operating rules; how a version retires.
Decisions
42 decided the nine clauses; 55, proposed, adds grain, when late and custody; 60, proposed, completes both contracts' extra columns from the column-level data architectures and settles on_board as a mean. See the decisions page.

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