Digital twin · anomaly detection · system design · planned
Anomaly detection: the system design.
Disruptions, events and failed sensors caught from the public feeds and shared counts, with alerts to whoever it affects. 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.
- 34generic components, standing in for 39 boxes of the detailed picture
- 41connections, each named with what moves, how often and under whose key
- 6cross an account border; everything else stays where it was made
- 20tables placed on the component that holds or transforms them
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. Desktop only.
Hover a component to see what it sends and receives.
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 component | In the detailed picture | Tables held or transformed | Why this choice |
|---|---|---|---|
| Open live feeds source | GTFS-Realtime feeds | GTFS-Realtime feedsGTFS timetables | Every registered party's public feeds are read the same way; the registry says which. |
| Weather and events source · planned | Weather and events | Weather and events | Named by the instructor; not sourced, not costed (decision 52). |
| Counter systems source | Passenger counters | AVL stop timesAPC counters | Door sensors count people; nothing about a rider exists in this use case. |
| Adapter job | Lambda · the adapter | Raw AVL exportRaw APC exportTIDES stop_visitsTIDES trips_performed5-minute loads | Published by the region, run in the agency's account: raw and stop-level tables stay home, only summed counts leave (decisions 6, 21). |
| 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. |
| Agency key control | KMS · MiWay's key | — | The one place an agency's key appears in this use case: the transfer totals it already shares. |
| 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 lane | Live lane | An ordered, replayable buffer two readers share; 24 hours is the Bronze of the region. |
| 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 · metrics | Delay and load per route | A time-series store with bands built in is the cheapest detector to run. |
| 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 API control | API Gateway · live alert feed | Live alert feed | The pull side of alerts: the same allow-or-deny per reader. |
| 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 archive | TIDES vehicle_locations | For replays and tuning the bands; a leaver's part is one prefix delete. |
| Vehicle state store store | DynamoDB · last state | Last state per vehicle | A key-value store: one item per vehicle, what the rules compare against. |
| Timetable store store | S3 · timetables | Timetables | GTFS as published, unchanged: the standard is the shape. |
| Band detector job | CloudWatch anomaly detection | — | A ready-made band, used for inference only; nothing is trained on our data (decisions 30, 40). |
| Who-is-affected lookup store | DynamoDB · who is affected | Who is affected | Built nightly under each agency's key by grant, so a leaver drops out at the next rebuild. |
| Alert log store | DynamoDB · alert log | Alerts | A key-value log keyed by party and time; the API reads open alerts from it. |
| Regional views people | Regional views | — | The region's own readers of the alert feed. |
| Forecast model (upgrade) job · planned | SageMaker · Chronos | — | Costed as the upgrade, about $2.4k a year more (decision 40). |
| Leaving job job | Step Functions · leaving job | — | Leaving is a job with an edge to everything it deletes (decision 54, proposed). |
| Regional transfer table store | S3 + Iceberg · transfer totals | Regional transfer table | The one fare-derived input, already protected at home by the 5-card rule; the same table transfer analysis builds. |
| 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 · registry | Registry | One 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. |
| Region key control | KMS · region's keys | — | Counts that name nobody rest under the region's key (decision 54, proposed). |
| Monitoring and alarms control | CloudWatch alarm · heartbeat CloudWatch · monitoring | — | The system watching itself: a dead poller means we are blind, not the feed. |
| Region's on-call people | Region's on-call | — | System failures never page a control room. |
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
- The open standards are the shapes: GTFS-Realtime and GTFS in, TIDES vehicle_locations for the archive, TIDES passenger_events summed for the loads (decision 4).
- Only counts cross: 5-minute loads per route, direction and stop every 5 minutes under a contract; raw and stop-level tables stay home (decisions 21, 29, 60).
- Alerts go to the agency it happened at, the region, and neighbours whose transfers it affects (decision 31).
- Rules first, a ready-made band or forecaster for inference only; nothing is trained on our data (decisions 30, 40).
- A dead poller or an undelivered alert pages the region's on-call, never a control room (decision 54, proposed).
- Leaving stops polling and deletes alarms, state and the archive part at once (decision 54, proposed).
Free to swap
- The stream buffer: a managed shard stream today; a Kafka-style log would carry the same two readers and 24-hour rule.
- The band detector: the metric store's built-in bands today; a pre-trained forecaster is the costed upgrade; any model used for inference only fits.
- The functions (rules, delay, alert builder): serverless functions today; a stream processor would do the same work.
- The key-value stores (vehicle state, alert log, who is affected): any store with a key per vehicle or alert and a time-to-live.
- The alert bus and dispatcher: any pub/sub with per-receiver topics, retries and a dead-letter queue.
- The container running the poller, the object store and the table format under the archive.
- 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, 21, 29 to 31, 34, 35, 40, 51 to 53; 54, 56, 57, 59 to 61 proposed