← Back to Pattern Catalog
Advanced Modeling Pattern

Event-to-State Projection

Event-to-State Projection derives valid state intervals from ordered business events.

Problem

Source systems store events, but reporting often needs state.

Many systems store changes as events. A contract is activated, suspended, reactivated and cancelled as a sequence of business events.

For reporting, users usually need to know the state of the contract at each reporting date. Event-to-State Projection converts event sequences into valid-time intervals.

Incorrect orderingMissing transitionsInvalid state sequencesWrong interval boundaries
Example

A contract event stream becomes valid state intervals.

Contract events
Jan 05Created
Feb 01Activated
Jun 10Suspended
Jul 03Reactivated
Nov 20Cancelled
Projected state intervals
DraftJan 05 – Jan 31
ActiveFeb 01 – Jun 09
SuspendedJun 10 – Jul 02
ActiveJul 03 – Nov 19
CancelledNov 20 onward
Projection rule

Each event creates the next state. The following event closes the previous state interval.

Why it happens

Events describe changes, while reports ask for conditions over time.

An event tells you that something changed at a point in time. A state table tells you what was true during an interval. Projection bridges those two representations.

Event-sourced historyStatus transitionsCDC journalsWorkflow systemsSnapshot reportingInterval joins
Common modeling approaches

Turn ordered events into stable valid-time intervals.

Order events
Sort events by entity, event time and a deterministic tie-breaker.
Map events to states
Define which resulting state each event type creates.
Close with next event
Use the next event time as the valid_to boundary of the current state.
Validate transitions
Check that the projected sequence follows allowed business state changes.
Validation checks

Validate the projection before using it for snapshots.

Validate event ordering per entityDetect duplicate transition eventsCheck missing terminal or initial eventsValidate state coverage after projectionCompare projected state against known snapshots
Why it matters

Projection creates a stable bridge between event history and interval reporting.

Event-to-State Projection is essential when source systems provide history as events but analytics require interval-based state.

Without projection, reporting logic often repeatedly reinterprets raw events in inconsistent ways.

Related Patterns
Event ModelingState ModelingState ReductionHistorical BackfillSnapshot Reproducibility
Try it

Explore event-to-state behavior in the Workbench.

Use the Historical Modeling Workbench to reason about event streams, projected state intervals, snapshot joins and historical validation checks.

Open Historical Modeling Workbench →