Skip to content
Middle+0 views

Design a platform for exchanging and analyzing sports data with real-time updates, historical data, and privacy controls.

Practice

Asked at

AI answer

Components and data flows

  • Clients and integrations send data through the API and streaming gateway. Collectors validate the schema, source identity, timestamps, and allowed values; events are sent to the message broker.
  • Stream processing normalizes and enriches events, then writes current metrics to a low-latency store and long-term history to a columnar store or lakehouse. The read API handles queries and real-time subscriptions; a separate service manages profiles and privacy.

Model and scaling

Each event contains a type, subject, source, event time and ingestion time, schema version, and deduplication identifier. Partition the stream by subject or competition, and retain raw events for reprocessing. Handle late-arriving events using event time and define rules for correcting aggregates. Use idempotency for redelivery; do not promise exactly-once delivery without specifying a concrete mechanism and the boundaries of the guarantee.

Privacy and operations

Consent and visibility are defined separately for the user, dataset, and purpose of use. Check access and filter fields before returning data; support data export and deletion, and minimize collection and retention periods. Pseudonymization does not replace access control. Encrypt traffic and storage, and audit access. Monitor event-to-API latency, queue lag, data loss, and duplicates. Plan for broker and storage redundancy, replay from raw events, quotas, and graceful degradation: during overload, preserve ingestion of critical events while temporarily updating aggregates with a delay.