Loading exercise…

Video analytics service

Repair the daily view report behind a video dashboard that overcounts repeat events and mixes reporting dates.

Task

Build a video-analytics service that produces a daily view report from playback events.

Requirements

  1. Return [{video_id, views, unique_viewers}], sorted by views descending, then video_id ascending.
  2. Dates are inclusive YYYY-MM-DD UTC dates. Input timestamps are valid ISO timestamps with Z or an explicit offset.
  3. Keep the first occurrence of each event id BEFORE filtering dates. A retried event cannot move into another day.
  4. Count every retained event as a view and distinct user_id values as viewers. Do not mutate input. Reject a reversed date range with ValueError containing date.

Exercises

AI-assisted Coding9 exercises