Identifying Domain Events¶
Every successful Event Sourcing and AI initiative starts with the right events. If your events are vague, too technical, or incomplete, they won't capture the meaningful changes in your domain – and your analytics, statistics, and AI models will suffer.
What Is a Domain Event?¶
A domain event is:
- Something that has happened in the domain
- A fact the business cares about
- Expressed in the language of the business
- Not a log entry or a low-level technical operation
In our library:
BookBorrowed– a member borrows a copy of a bookLoanExtended– the due date is pushed further into the futureBookReturned– the book is brought backLateFeeIncurred– a fee is charged for returning it late
Each event describes what happened, not just what someone did in the software. This keeps events meaningful for business experts, analysts, and data scientists.
Why Event Quality Matters for AI¶
Poorly designed events can cause:
- Noisy data – unclear meaning or overloaded events
- Incomplete data – missing attributes for analysis
- Inconsistent data – naming and structure changes over time
High-quality domain events enable:
- Accurate statistics – trends reflect real-world patterns
- Feature clarity – every model variable maps to a single, well-defined fact
- Explainable AI – domain experts can understand each feature's meaning
How to Identify the Right Events¶
Start by talking to domain experts, not just developers.
Ask them:
- What changes they currently track – and why
- What facts they consult when making decisions
- What events they'd want to see if they could revisit the past
Look for:
- Meaningful state transitions – moments when the business takes notice or acts differently
Avoid:
- Generic names like
RecordUpdatedorStatusChanged - Technical artifacts that don't reflect the real-world change
Use clear, domain-specific names such as:
LoanExtendedMembershipExpired
Thinking Ahead to Analytics and AI¶
When defining events, aim for:
- Granularity – enough detail to power statistical models
- Completeness – all attributes needed for feature engineering
- Consistency – structure and meaning stay stable over time
By thinking ahead, you create events that are operationally useful and AI-ready from the start.
Next up: Writing and Storing Events – learn how to persist your events so that every AI/ML dataset can be reproduced exactly.