Usage Domain¶
The usage_domain bounded context tracks all product interactions. Usage decay (declining event frequency) is the strongest leading indicator of churn.
Entities¶
src.domain.usage.entities ¶
UsageEvent entity – core of the Usage bounded context.
Classes¶
UsageEvent
dataclass
¶
A single product interaction by a customer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_id
|
str
|
UUID primary key. |
required |
customer_id
|
str
|
FK to Customer entity. |
required |
timestamp
|
datetime
|
UTC datetime of the event. |
required |
event_type
|
EventType
|
The type of product action taken. |
required |
feature_adoption_score
|
FeatureAdoptionScore
|
Adoption score snapshot at the time of the event. |
required |
Source code in src/domain/usage/entities.py
Value Objects¶
src.domain.usage.value_objects ¶
Value objects for the Usage domain.
Classes¶
EventType ¶
Bases: StrEnum
Product event types tracked in usage_events.
integration_connect events are strong retention signals.
Absence of monitoring_run events is an early churn indicator.
Source code in src/domain/usage/value_objects.py
FeatureAdoptionScore
dataclass
¶
Composite 0–1 score reflecting breadth and depth of feature usage.
Scores below 0.2 combined with declining event frequency are the strongest leading indicators of churn in the first 90 days.
Source code in src/domain/usage/value_objects.py
Repository Interface¶
src.domain.usage.repository ¶
UsageRepository – abstract port for the Usage domain.
Classes¶
UsageRepository ¶
Bases: ABC
Port for retrieving usage events.
Source code in src/domain/usage/repository.py
Functions¶
abstractmethod
¶Retrieve all usage events for a customer, optionally filtered by date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
customer_id
|
str
|
The customer whose events to fetch. |
required |
since
|
datetime | None
|
If provided, return only events after this UTC datetime. |
None
|
Source code in src/domain/usage/repository.py
abstractmethod
¶Count events in the last N days.
Used as a feature for churn model: event decay is a leading indicator.