Hierarchical State Derivation
A policy has multiple historized contracts. The policy status is not stored directly. It must be derived from the contract states over time.
The parent entity has no direct historical state.
In many source systems, business state exists at a lower level than the reporting entity. Contracts have status history, but the policy status must be derived from all contracts belonging to the policy.
This is not a simple aggregation. The parent timeline must be rebuilt from child timelines, and business rules decide which derived state is valid in each interval.
Contract states are historized. Policy status is derived.
The policy remains active until all related contracts are annulled. The parent state changes in June, not in April, because Contract B is still active.
Do not derive the parent state from only one child row.
What should the policy status be in May?
Contract A is already annulled in May. Contract B is still active until June. Apply the rule: the policy is active if at least one contract is active.
Pick the status that should be generated for the parent policy interval.
Derive parent states by probing historized child states.
Hierarchical State Derivation creates a historized parent attribute from multiple historized child entities. The child records define the timeline boundaries. The business rules define the derived parent value.
In your internal implementation this may look like a function such as probe_by_attribute: generate time slices, probe child values in each slice, apply rules, and output new parent intervals.
If at least one contract is active, the policy is active.
Contract states define the parent timeline.
| Child entity | Valid period | Status |
|---|---|---|
| Contract A | Jan → Apr | Active |
| Contract A | Apr → ∞ | Annulled |
| Contract B | Jan → Jun | Active |
| Contract B | Jun → ∞ | Annulled |
The policy status changes only when the derived rule result changes.
| Policy interval | Policy status | Reason |
|---|---|---|
| Jan → Apr | Active | A and B active |
| Apr → Jun | Active | B still active |
| Jun → ∞ | Annulled | All contracts annulled |
Source systems often store operational detail below the reporting grain.
Generate parent intervals before applying business rules.
Before publishing the derived state, validate the derivation.
Without explicit derivation, parent state becomes unstable or unexplainable.
A policy may look active, cancelled or suspended depending on which contract row was joined first, which status was prioritized, or which child history was visible at the time of publication.
Hierarchical State Derivation makes the business rule explicit. The parent state is no longer an accidental side effect of joins, but a reproducible historical data product.
This pattern connects several historical modeling problems.
Review your own model for derived state risks.
Paste SQL, PySpark, dbt model logic or an architecture description and check whether derived parent states are explicit, explainable and historically reproducible.
Review My Model →