socioverse.io — the trajectory store¶
The durable, queryable panel store: tables panel, metrics, events
(and messages when the bus is used), with parquet exports at finalize.
socioverse.io.duckdb_store ¶
DuckDbTrajectoryStore — database-like panel/metrics/events/messages store.
One DuckDB file per study (trajectory/study.duckdb) with tables:
- panel(agent_id, step, state JSON, action_kind, action_payload JSON) -- longitudinal panel
- metrics(step,
Panel rows + events + messages stream in per step (so a reader can attach mid-run);
each batch is written in ONE transaction (DuckDB commits every statement separately in
autocommit mode, which costs one fsync per agent row). The wide metrics table is
materialized at finalize(). Parquet copies are exported for
portability. The reporter (and any later real-time viewer) just opens the same file and
runs SQL — e.g. SELECT step, state->>'tract_id' FROM panel WHERE agent_id = ?.
DuckDbTrajectoryStore ¶
Bases: TrajectoryStore
Source code in socioverse/io/duckdb_store.py
open_readonly ¶
Open a finalized study store for querying (reporter / interactive viewer).