Polymorphic Temporal Event Ledger

Operational systems rarely produce one clean stream of data. They emit alarms, user actions, configuration changes, service health signals, communication events, and state snapshots. Each record has a different shape, but together they describe one evolving system.

The usual storage choices create an avoidable trade-off. A generic document column accepts almost anything, but leaves meaning, identity, and validation for every consumer to rediscover. A separate relational table for every record type preserves structure, but fragments the timeline and makes schema changes expensive. The Polymorphic Temporal Event Ledger explores a third option: one stable temporal envelope with typed, domain-specific details attached to it.

The goal is not to replace specialized operational databases or real-time platforms. It is to create a coherent, queryable history of discrete events and state observations without forcing every kind of information into the same payload.

One ledger, many record shapes

Polymorphic means that the ledger can store different kinds of records without hiding their meaning in an unstructured object.

Every record begins with a small fixed-width spine. It identifies the record and its type, records when it happened and when it entered the ledger, identifies the producer, and describes the subject, reliability, security context, and classification state. Correlation and causation identifiers connect records without assuming that they came from the same service or even the same workflow.

The record type determines the extension that holds its specific data. A communication event can have delivery details, an alarm can have lifecycle information, and a configuration change can describe the parameter that changed. These extensions are relational tables with explicit columns, constraints, and indexes. They are optional in shape, but not optional in meaning.

This produces a useful separation:

  • the shared spine answers when, who, which type, and what is related;
  • the typed extension answers what happened in domain terms;
  • common reference data and identities are stored once instead of repeated on every row.

The type catalogue is the switchboard. It records each supported record type and schema version, whether the record represents an event or state, its semantic category, its owner, its retention class, and the extension table that interprets it.

Polymorphism therefore lives in the data model, not in implicit conventions hidden inside JSON.

Time is a first-class dimension

The ledger deliberately distinguishes two clocks. effective_at is when an event occurred or a state was observed. recorded_at is when the ledger received that knowledge. Keeping them separate matters whenever source systems retry, arrive late, report historical data, or correct an earlier understanding.

Sequence numbers make ordering more precise when timestamps alone are not enough. They also expose gaps from a producer. Causation links preserve why a record exists, while correlation identifiers group work that may span multiple events and components.

The temporal spine is append-only. New evidence is added as a new record rather than rewriting history. Retention can remove complete partitions, but ordinary updates are rejected. This keeps the ledger honest about what was known at the time.

Events and state share the same history

An event describes a change or action. A state observation describes the system as it was understood at a particular moment. Both are useful, and treating one as a secondary concern usually creates blind spots.

State records use the same spine as events, followed by a state-folding extension. That extension describes whether an observation is a full checkpoint, a scoped checkpoint, a member of a checkpoint, a delta, or a removal. It can point to the checkpoint from which a partial observation derives.

This model can represent two complementary views:

  • the event view explains how the system changed;
  • the state view supports reconstruction of what it looked like at a selected point in time.

The two views remain connected by subjects, timestamps, versions, and causal links rather than becoming two unrelated stores.

Identity and relationships are separate from payload

Operational records often refer to the same entity through different identifier systems. A sensor, configuration object, asset, user, or other subject may appear with several external identities depending on where a record originated.

The ledger interns subjects in shared dimensions and records aliases between equivalent identities. Records can then use compact foreign keys while external identifiers remain available at the boundary. One primary subject identifies the main entity, while a dedicated link table represents additional subjects and their roles, such as parent, related, secondary, or associated.

This is more than storage normalization. It makes relationships queryable across record types. An alarm, a configuration change, and a state snapshot can describe the same subject without duplicating its identity in three payloads.

Unknown does not mean lost

A fixed model must also describe how it behaves when the world does not match the model.

Unknown or unmodeled attributes have a separate extension rather than being allowed to make the core schema variable. More importantly, records that cannot yet be classified or decoded can enter a raw-preservation quarantine. The ledger keeps the original representation, its encoding, a checksum, source reference, and diagnostic context.

Later classification can create a typed record without deleting or rewriting the original. A governance table records that relationship, so consumers can distinguish an original unclassified record from its promoted form.

An unknown record is still evidence. The system has not explained it yet, but it has not thrown it away either.

This changes schema evolution from a binary choice between accepting everything and rejecting everything. The ledger can remain operational while its understanding catches up.

A practical relational shape

In relational terms, the ledger needs a few kinds of tables, each with a distinct role:

  • ref_ tables define stable vocabularies and record types;
  • dim_ tables hold shared identities, producers, and visibility sets;
  • core_ tables form the fixed temporal spine and subject links;
  • ext_ tables hold typed events, state observations, overflow, and preserved raw data;
  • meta_ tables record classification lineage.

Temporal tables are partitioned together by effective time. The core remains fixed-width and free of variable payloads, while typed extensions carry the fields required by each domain. Compact codes and interned references reduce repeated storage, but the model preserves descriptive names in reference tables where humans need them.

This design is intentionally relational. JSON is not the enemy, but it belongs at the edge of the model where information is genuinely unknown or provisional. Once meaning becomes stable, it should become a named column, a constraint, and a queryable relationship.

The design boundary

The ledger stores discrete operational history. High-frequency measurements and continuous tracking streams have different access patterns, retention needs, and query shapes. They belong in specialized platforms, although events concerning their subjects can still refer to them.

That boundary is essential. A ledger becomes harder to trust when it tries to be the answer to every data problem.

Open questions

The idea still has to prove itself against real data:

  • Can heterogeneous records share one stable temporal contract?
  • Can typed extensions cover real domain concepts without constant schema churn?
  • Can checkpoints and deltas reconstruct state predictably?

The value is not a particular set of tables. It is a clearer separation between facts that are stable, facts that vary by record type, and facts that are not understood yet.

That is the idea behind the Polymorphic Temporal Event Ledger: keep one accountable history, allow the details to vary, and treat uncertainty as something the architecture can carry.