fraudtwin.replay#

Historical event replay and ordering.

Status: Stable

Classes#

fraudtwin.replay.ReplayResult

Selected source records, ordered envelopes, and replay manifest.

Functions#

fraudtwin.replay.iter_partition_replay_events

Stream replay envelopes directly from M18 partitioned Parquet.

fraudtwin.replay.replay_run

Select and order an existing run without regenerating any source data.

fraudtwin.replay.write_replay

Write a replay artifact below the supplied destination root.

Constants and protocols#

Name

Reference

REPLAY_EVENT_SCHEMA

fraudtwin.replay.REPLAY_EVENT_SCHEMA

ReplayOrder

fraudtwin.replay.ReplayOrder

Detailed API#

Deterministic historical replay over one already-generated run.

class fraudtwin.replay.ReplayResult(entities, behavior, envelopes, manifest)[source][source]

Bases: object

Selected source records, ordered envelopes, and replay manifest.

Parameters:
  • entities (EntityDataset)

  • behavior (BehaviorDataset)

  • envelopes (tuple[dict[str, Any], ...])

  • manifest (ReplayManifest)

fraudtwin.replay.iter_partition_replay_events(run_dir, from_time, to_time, *, order='original_delivery')[source][source]

Stream replay envelopes directly from M18 partitioned Parquet.

Return type:

Iterator[dict[str, Any]]

Parameters:
  • run_dir (Path)

  • from_time (datetime)

  • to_time (datetime)

  • order (Literal['original_delivery'])

fraudtwin.replay.replay_run(run_dir, from_time, to_time, *, order='event_time_order')[source][source]

Select and order an existing run without regenerating any source data.

Return type:

ReplayResult

Parameters:
  • run_dir (Path)

  • from_time (datetime)

  • to_time (datetime)

  • order (Literal['event_time_order', 'original_delivery'])

fraudtwin.replay.write_replay(result, output_dir)[source][source]

Write a replay artifact below the supplied destination root.

Return type:

tuple[Path, Path]

Parameters:
  • result (ReplayResult)

  • output_dir (Path)