API Reference: Event Classes

Event classes are the primary way to query data in bitmapist. They represent a set of user IDs that performed a specific action in a given time period.

All time-based event classes inherit from GenericPeriodEvents and share a common API for navigation (next(), prev(), delta()) and querying (__len__, __in__, __iter__).


UniqueEvents

Represents a non-time-based set of users (a flag).

Constructor:

UniqueEvents(event_name, system="default")

  • event_name: The name of the unique event (e.g., 'premium_users').
  • system: The Redis system to use.

HourEvents

Represents events that occurred within a specific hour.

Constructor:

HourEvents(event_name, year=None, month=None, day=None, hour=None, system="default")
If year, month, day, or hour are omitted, they default to the current UTC time.


DayEvents

Represents events that occurred on a specific day.

Constructor:

DayEvents(event_name, year=None, month=None, day=None, system="default")
If year, month, or day are omitted, they default to the current UTC date.


WeekEvents

Represents events that occurred within a specific week (ISO 8601 week date).

Constructor:

WeekEvents(event_name, year=None, week=None, system="default")
If year or week are omitted, they default to the current UTC week.


MonthEvents

Represents events that occurred within a specific month.

Constructor:

MonthEvents(event_name, year=None, month=None, system="default")
If year or month are omitted, they default to the current UTC month.


YearEvents

Represents events that occurred within a specific year.

Constructor:

YearEvents(event_name, year=None, system="default")
If year is omitted, it defaults to the current UTC year.