learning-it by example

Back to the video

Event Data Modelling: Events, Sessions, Late Arrivals

Two late clicks made an append-only job report 7 sessions; rebuilt from event time there were 4.

Video #266 ยท Data modelling

Steps in the video

  1. 0:00 Two late events: 4 real sessions, 7 if you only append.
  2. 0:31 The idea
  3. 1:07 Setup
  4. 1:30 The events
  5. 2:01 One row per event
  6. 2:18 Loading a batch
  7. 2:33 Sessions from event time
  8. 3:04 Run the first batch
  9. 3:22 Spotting late events
  10. 3:33 Two ways to handle batch two
  11. 3:57 Run the late batch
  12. 4:27 What this does not show
  13. 4:59 Mistakes to avoid
  14. 5:32 My take and next steps
  15. 5:56 Recap

Files

  • events.py (44 lines)
  • run.py (37 lines)
  • sessions.py (27 lines)

Download the code (zip)

Tested with

Python 3.12.15

What this does not show

Eleven made-up events in SQLite, rebuilt in full each time, with no lateness cut off, one time zone and no speed measured.

Sources

Learning IT by Example.