TransitAI Core

Digital twin · one platform, both use cases · system design · proposed

One platform, both use cases: the system design.

Both use cases on one platform: the nightly transfer count and the 5-minute anomaly watch as two readers of the same Silver at home, and one exchange at the region, every shared part once. The same system as the detailed architecture and its data architecture, with the product names taken off: what each part is for, in the three custody zones the rest of the site uses.

The pictureThe detailed architectureThe data architecture

What the merge made one.

Every component of either design appears exactly once. 15 stood in both designs already and are drawn once; the rest keep their path. This is a proposal (decision 62): the two use cases stay the deliverables, this page says what they would share.

Components, not products.

Hover a component for what it does, the service it maps to and the tables it holds. Hover a connection for what moves, how often and under whose key. Hold Shift over a component for its quality attributes. Click to pin; Esc releases. Each component carries the path it serves; the filter shows one path at a time, and what serves both stays lit. In the All view, rectangles group the components into the major components; the path views hide them. Desktop only.

Hover a component to see what it sends and receives.

Blue connections cross an account border. Shapes: a cylinder is a store, a cog a job, a key or shield a control, a person a reader. Nothing is deployed; services behind the components are recommendations, not settled (decision 35).

The major components.

In the All view the picture draws 10 rectangles around the parts that belong together; hover a rectangle's title for the paths, services and tables inside it. One line each here. The two use-case pages show the detailed parts.

Open data
Public feeds anyone may read: positions, trip updates, timetables; weather and events planned. 2 parts · open feeds
The agency's own systems
What the agency already runs: the fare system and counters the platform reads, the event bus and control room it delivers to. 4 parts · the agency's account
Adapter and standard tables
Published by the region, run at home: raw landing, Silver in the standards' shapes, the nightly count, the totals outbox and the agency's key. 8 parts · the agency's account
Feed intake
Reads every open feed every 10 seconds into the live lane, and batches the lane into the feed archive. 4 parts · the region's account
Online analytics
The speed layer: rules against the last state, delay and load against the timetable, a band per series; an alarm within 5 minutes. 7 parts · the region's account
Alerting
Builds each alert, says who is affected, routes it by receiver with retries, and keeps the log the alert feed reads. 5 parts · the region's account
Contract gateway
Where an agency's nightly file arrives and is checked against its contract; who is in, on what terms, with which grants. 5 parts · the region's account
Offline analytics
The batch layer: arrivals derived from the archive each night, every agency's totals added up into the regional table. 4 parts · the region's account
Serving
One front door for reports and the live alert feed, behind sign-in and the rule check; the planners, the journey view and the regional views. 7 parts · the region's account
Platform operations
The system watching itself: the audit log, monitoring and the on-call, the region's key, and the job that handles leaving. 5 parts · the region's account

From the abstract to the concrete.

Each generic component, the service that plays it in the detailed picture, the tables it holds or transforms, and why that choice. Derived from the detailed picture's node table, so the two cannot drift.

Generic componentIn the detailed pictureTables held or transformedWhy this choice
Open live feeds
source
GTFS-Realtime feedsGTFS-Realtime feeds
GTFS timetables
Every registered party's public feeds are read the same way; the registry says which.
Weather and events
source · planned
Weather and eventsWeather and eventsNamed by the instructor; not sourced, not costed (decision 52).
Fare system export
source
PRESTO fare exportPRESTO fare exportThe fare vendor's export is the only source of the transfer flag; it is read where it lands.
Counter systems
source
Passenger countersAVL stop times
APC counters
Door sensors count people; nothing about a rider exists in this use case.
Raw landing store
store
S3 · raw landingRaw AVL export
Raw APC export
Raw fare export
One Bronze for both paths: every export lands here untouched, so Silver can be rebuilt (decision 63).
Adapter: batch and stream
job
Glue ETL · the adapter, batch
Lambda · the adapter, stream
5-minute loadsOne adapter per party, published by the region, with a batch job and a stream function on the same tables (decisions 6, 63).
Standard tables
store
S3 + Iceberg · TIDES tablesTIDES stop_visits
TIDES trips_performed
TIDES fare_transactions
One Silver in the standards' shapes, read by the nightly count and the 5-minute loads alike (decisions 4, 63).
Counting job
job
Glue ETL · count and time—Counting at home is what keeps the card inside the agency (decision 25).
Totals outbox
store
S3 · nightly totalsNightly transfer totalsA file a night under a contract is simpler and cheaper than answering questions on demand (decision 27).
Agency key
control
KMS · MiWay's key—One key per agency; one revocable grant serves the reports and the nightly lookup (decisions 13, 41).
Scheduler
control
EventBridge Scheduler—A cron-style trigger; any workflow tool does the same.
In-place reader
job
Athena · read arrivals—Reading in place through a grant means nothing is copied to be deleted later (decision 49).
Agency event bus
control
EventBridge · TTC's bus
EventBridge · MiWay's bus
—The region delivers to one address per party; what happens next is the agency's business.
Control room
people
TTC control room
MiWay control room
—The reader decision 31 names; the neighbour hears what breaks its connections.
Feed poller
job
ECS on Fargate · poller—A small always-on container; the registry tells it which feeds.
Stream buffer (live lane)
store
Kinesis Data Streams · live laneLive laneAn ordered, replayable buffer two readers share; 24 hours is the Bronze of the region.
Batch writer
job
Data Firehose · archive—Turns the lane into files sized for the archive; no code to run.
Feed archive
store
S3 + Iceberg · feed archiveFeed archive
TIDES vehicle_locations
One store at two layers (decision 61): the arrivals are derived from Bronze, replays read Silver; one poller writes both.
Rule engine
job
Lambda · rules—Plain rules first (decision 30); the first reader of the lane.
Delay and load calculator
job
Lambda · delay and load—The step the audit found missing: positions become a delay only against a timetable.
Metric store
store
CloudWatch · metricsDelay and load per routeA time-series store with bands built in is the cheapest detector to run.
Band detector
job
CloudWatch anomaly detection—A ready-made band, used for inference only; nothing is trained on our data (decisions 30, 40).
Forecast model (upgrade)
job · planned
SageMaker · Chronos—Costed as the upgrade, about $2.4k a year more (decision 40).
Vehicle state store
store
DynamoDB · last stateLast state per vehicleA key-value store: one item per vehicle, what the rules compare against.
Timetable store
store
S3 · timetablesTimetablesGTFS as published, unchanged: the standard is the shape.
Who-is-affected lookup
store
DynamoDB · who is affectedWho is affectedBuilt nightly under each agency's key by grant, so a leaver drops out at the next rebuild.
Alert builder
job
Lambda · build the alert—One function turns a broken band or a fired rule into the shape the contract names.
Alert bus
control
EventBridge · alert bus—Routing by receiver is what lets a neighbour hear only what affects it (decision 31).
Alert dispatcher
control
SNS · delivery
SQS · undelivered
—Fan-out with retries and a dead-letter queue, so an alert nobody took is kept, not lost.
Alert log
store
DynamoDB · alert logAlertsA key-value log keyed by party and time; the API reads open alerts from it.
One front door
control
API Gateway · one front doorReport API
Live alert feed
One API with two routes; the same sign-in, rule check and audit on every request (decision 64).
Query engine
job
Athena · queries—Pay per query over the same files; any engine that reads the table format will do.
Catalogue and grants
control
Catalog + Lake Formation—Grants scoped by the contract are how an agency reads the region's tables in place.
Public arrivals table
store
S3 + Iceberg · public arrivalsPublic arrivalsWait times need arrivals at stops, not positions; this table is what an agency reads back (decision 49).
Arrival-deriving job
job
Glue ETL · derive arrivals—The step the audit found missing: positions become arrivals once, for every agency.
Inbox
store
S3 · inboxInbox: nightly filesA drop box the agency writes to; the region never reaches into the agency's account.
Contract check
job
EventBridge · file arrived
Lambda · contract check
—Every clause of the contract compiles to a check run on each file (decision 11).
Add-up job
job
Glue ETL · add up—A nightly job that reads every agency's rows by grant and appends to the regional tables.
Rejected-file queue
store
SQS · rejected filesRejected filesA queue keeps the bad file and its reason until the agency re-sends.
Regional transfer table
store
S3 + Iceberg · regional transfer tableRegional transfer tableOne table, each agency's rows under its own key; the transfer reports and the who-is-affected rebuild both read it by the same grant (decisions 41, 61).
Off-boarding workflow
job
Step Functions · off-boarding—One leaving job for both paths: revoke the grant, delete, expire, purge, rebuild both reports (decisions 43, 50, 54, 64).
Regional planners
people
Regional planners—The readers the contract names.
Journey view
people
Journey view—The public-facing reader the contract names.
Regional views
people
Regional views—The region's own readers of the alert feed.
Region's on-call
people
Region's on-call—System failures never page a control room.
Sign-in
control
Cognito · sign-in—Shared part, costed in every use case (decision 34).
Rule check
control
Verified Permissions—A policy engine: the contract's readers clause, checked on every request.
Party registry
control
Aurora · registryRegistryOne relational store for who is in, which feeds to poll, with which shared ids; the same table in both use cases.
Audit log
control
CloudTrail + Object Lock—Write-once storage so the record of who read what cannot be edited.
Monitoring and alarms
control
CloudWatch alarm · heartbeat
CloudWatch · monitoring
—The system watching itself: a dead poller means we are blind, not the feed.
Region key
control
KMS · region's keys—Counts that name nobody rest under the region's key (decision 54, proposed).

Fixed by the design, free to swap.

What a different cloud or vendor would have to keep, and what it could replace without changing the story.

Fixed

  • One agency-side platform per party: one adapter, one Bronze and one Silver in the standards' shapes, one key, one event bus; both paths read the same Silver (decision 63).
  • The speed layer and the batch layer are separate readers of one store, not one stream doing both: Lambda architecture, not Kappa (decision 65).
  • One regional exchange: one registry, one inbox and contract check, one catalogue and grants, one feed archive at two layers, one query engine, one alert dispatcher, one audit log, one monitoring, one front door (decision 64).
  • What crosses is the union of the two contracts and nothing more; the public feed and the nightly totals file cross once and serve both.
  • Each agency's rows at the region rest under its one key; one revocable grant serves the reports and the nightly lookup; revoke it and both lose that agency at once (decisions 41, 54).
  • One off-boarding job covers both paths: stop polling, delete rows, alarms, state and archive part, expire snapshots, purge caches, rebuild both reports (decisions 43, 50, 54).

Free to swap

  • Everything the two designs already let you swap: the batch and query engines, the stream buffer, the table format, the scheduler, the catalogue, the key service, the detector, the dispatcher.
  • Kappa instead of Lambda: one streaming path that also builds the nightly totals; not taken, because the totals need the card hash and the privacy rule at home, which a stream in the region must never see (decision 65).
  • Two front doors instead of one, if the alert feed's latency budget and the report API's cache ever want different gateways; the sign-in, rule check and audit stay shared.
  • Whether the archive's two layers are one Iceberg table with a view or two tables; the contracts see only the Silver shape.
Consistent with
The detailed architecture (every box maps to one component here; every connection is one of its edges) and the data architecture (every table sits on one component).
Quality attributes
Sourced from the use-case page, the contracts and the audit where they exist; the rest are marked proposed in the Shift panel.
Decisions
4 to 7, 13, 14, 41 to 43, 50, 54, 59 to 61; 62 to 65 proposed

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