Building Analytical Projections¶
Raw events hold a wealth of information, but they are rarely in the shape needed for direct analysis, statistics, or AI applications. Analytical projections take those events and transform them into structured, queryable datasets that make patterns, trends, and relationships visible in ways that analytical and machine learning workflows can easily consume.
They act as a bridge between the raw, immutable history in the event store and the AI-ready features that models depend on.
Why Analytical Projections Matter¶
Operational projections are typically designed for immediate use – for example, showing which books are currently on loan. They answer a specific question in real time, often for a user interface.
Analytical projections serve a different purpose. They are built to:
- Reveal trends and patterns over time
- Calculate derived metrics
- Produce clean, consistent datasets for AI models
- Support deeper exploration and insight generation
This shift in focus turns events from operational facts into strategic knowledge.
Characteristics of a Good Analytical Projection¶
A strong analytical projection is more than just a query result. It should be:
- Accurate – faithfully reflecting the underlying events without introducing bias
- Complete – including all attributes needed for meaningful analysis
- Point-in-time correct – matching the state exactly as it was at a specific historical moment
- Rebuildable – possible to regenerate at any time from the original events
These qualities ensure that the dataset is reliable, whether you are exploring it interactively or training a long-lived machine learning model.
Example: Library Loan Statistics¶
In our library domain, we might create a projection that tracks loans per title per week. It could be based on BookBorrowed and BookReturned events and enriched with metrics such as:
- The number of active loans
- The average loan duration
- The overdue rate
This projection would help library staff monitor circulation trends, while also providing AI models with the historical data needed for demand forecasting or trend detection.
AI/ML Connection¶
Analytical projections are where domain modeling meets data science. They allow you to precompute valuable signals such as seasonal borrowing patterns, overdue frequency, or borrowing diversity.
Having these insights readily available:
- Reduces preprocessing time for data scientists
- Allows more frequent retraining of models
- Improves explainability – every feature can be traced directly back to the events that produced it
This traceability is essential when models need to be audited or when stakeholders must understand how a prediction was made.
Practical Considerations¶
When designing analytical projections, it's often best to keep them separate from operational projections, since their requirements and performance profiles differ.
Flexibility is also key: a projection that starts as a simple weekly count might later evolve into a richer dataset with additional derived metrics.
Including relevant metadata from the beginning helps ensure reproducibility and supports auditing – both of which are especially valuable in regulated environments.
Next up: Designing Time-Series Projections – learn how to capture trends, seasonality, and temporal patterns for forecasting and anomaly detection.