← Back to Learn
COMPOSITE PATTERN

State ↔ State Alignment

Aligns two independently historized state sources across overlapping valid-time intervals.

Correct alignment splits the joined history whenever either source changes, so every reporting period resolves to one stable and explainable state combination.

Problem

Two historized sources can both be correct but still fail when joined.

Historical reporting often combines two sources that both change independently over time. Joining only by business key is not enough. The model must determine which versions were valid together at each reporting date.

When one side changes inside the other side's interval, the combined history must split at that boundary. Otherwise the result attributes a state combination to a period in which it did not actually exist.

Multiple overlapping matchesMissing valid-time coverageJoin explosionsIncorrect point-in-time results
Example

Contract state and customer state change on different dates.

Contract state
Active
Changed
Customer state
Customer A
Customer B
?
Reporting question
What should the joined history look like when either side changes? A correct model must split the result at every relevant state boundary.

Expected Result

2024-03-01 → 2024-06-30
C-1001
Active / Customer A
2024-07-01 → 2024-09-30
C-1001
Changed / Customer A
2024-10-01 → 2024-12-31
C-1001
Changed / Customer B
×

Common Wrong Result

2024-03-01 → 2024-06-30
C-1001
Active / Customer A
2024-07-01 → 2024-12-31
C-1001
Changed / Customer B
Key rule

The joined table should contain only periods in which both source states remain stable. If either side changes, the joined interval must split.

Core concepts

The joined history must be stable on both timelines.

State ↔ State Alignment compares two independently historized timelines and derives the periods in which both resolved states remain unchanged.

Cross-system comparison
Each source may use its own change dates and state boundaries.
Overlap join
Rows are candidates only when their valid-time intervals overlap.
Boundary union
Every relevant boundary from either side must be reflected in the result.
Stable combination
Each output interval contains one state from the left and one from the right.
Test case

Analyze this State ↔ State Alignment example

Use these sample target tables to test the Investigator:

  1. Select one of the target tables below.
  2. Start the prepared investigation.
  3. Review the supplied target output.
  4. Check whether all source boundaries were preserved.
Aligned target table

The expected output is split at every relevant state boundary.

entity_id,customer_key,contract_status,valid_from,valid_to,alignment_method
C-1001,Customer A,Active,2024-03-01,2024-03-31,interval_split
C-1001,Customer A,Active,2024-04-01,2024-04-30,interval_split
C-1001,Customer A,Active,2024-05-01,2024-05-31,interval_split
C-1001,Customer A,Active,2024-06-01,2024-06-30,interval_split
C-1001,Customer A,Changed,2024-07-01,2024-07-31,interval_split
C-1001,Customer A,Changed,2024-08-01,2024-08-31,interval_split
C-1001,Customer A,Changed,2024-09-01,2024-09-30,interval_split
C-1001,Customer B,Changed,2024-10-01,2024-10-31,interval_split
C-1001,Customer B,Changed,2024-11-01,2024-11-30,interval_split
C-1001,Customer B,Changed,2024-12-01,2024-12-31,interval_split
Wrong target table

The result is too coarse because it does not split when the customer state changes.

entity_id,customer_key,contract_status,valid_from,valid_to,alignment_method
C-1001,Customer A,Active,2024-03-01,2024-03-31,overlap_join_only
C-1001,Customer A,Active,2024-04-01,2024-04-30,overlap_join_only
C-1001,Customer A,Active,2024-05-01,2024-05-31,overlap_join_only
C-1001,Customer A,Active,2024-06-01,2024-06-30,overlap_join_only
C-1001,Customer B,Changed,2024-07-01,2024-07-31,overlap_join_only
C-1001,Customer B,Changed,2024-08-01,2024-08-31,overlap_join_only
C-1001,Customer B,Changed,2024-09-01,2024-09-30,overlap_join_only
C-1001,Customer B,Changed,2024-10-01,2024-10-31,overlap_join_only
C-1001,Customer B,Changed,2024-11-01,2024-11-30,overlap_join_only
C-1001,Customer B,Changed,2024-12-01,2024-12-31,overlap_join_only
Why it happens

Each source owns an independent timeline and change frequency.

A contract may change status in July while its customer relationship changes in October. A product category may change at a different time from its price or entitlement state.

A simple overlap join identifies intersecting rows but does not automatically create the stable subintervals required by the combined historical state.

Independent source timelinesDifferent change datesTemporal join predicatesCoverage gapsOverlapping versionsBoundary semantics
Common modeling approaches

Join on business key and overlapping valid-time intervals.

Overlap join
Match records whose business keys agree and whose valid-time intervals intersect.
Interval splitting
Split the joined result whenever either source changes within the overlap.
Coverage handling
Define what happens when one source has no valid row for a required period.
Cardinality validation
Check the expected number of matches per entity and reporting date.
left.business_key = right.business_key
AND intervals_overlap(
  left.valid_from,
  left.valid_to,
  right.valid_from,
  right.valid_to,
  boundary_convention
)

The exact overlap predicate depends on the interval convention. The important rule is that both sources and the resulting split intervals use the same boundary semantics consistently.

Validation checks

Validate the joined history, not only each source table.

Detect overlapping versions per business keyDetect gaps in required reporting periodsCount matches per entity and reporting dateValidate one intended combination where the model requires oneCheck whether joined intervals split at every relevant boundary
Detectable findings

The Investigator can surface state-to-state alignment risks.

JOIN_GAPJOIN_AMBIGUITYNO_VALID_MATCHMULTIPLE_MATCHES
Why it matters

State-to-state joins are a common source of historical reporting bugs.

Each source can be valid in isolation while the combined history still produces gaps, duplicates or incorrect attribution.

Validating the final aligned timeline is therefore often more important than validating either source independently.

Related temporal models

How State ↔ State Alignment relates to neighboring patterns

State Modeling
Defines the independently historized states that must later be aligned.
Historical Conformance
Checks whether separate models describe a compatible historical reality.
Identity Resolution
Ensures the business keys used to align both timelines represent the same entity.
Snapshot Reproducibility
Consumes the aligned history to reproduce deterministic point-in-time results.
Related Patterns
State ↔ Event AlignmentHistorical Match AmbiguityHistorical Coverage GapHistorical ConformanceRelationship History
Try it

Validate temporal joins before they reach reporting.

Detect gaps, ambiguous matches, overlapping versions and missing interval splits across independently historized state sources.

Open Historical Data Assistant →