-- PASS4_UV_WIRE.5 — PRIME proceedings journal DDL -- ============================================================================ -- Namespace: dolphin_uv (NOT dolphin.* — that's BLUE's live namespace, -- polluting it is FORBIDDEN). Create the table, then journal.py writes into -- it via HTTP INSERT JSONEachRow. MergeTree ordered by (scan_number, ts) -- so parity diff against dolphin.trade_events is a fast scan-order join. -- ============================================================================ CREATE DATABASE IF NOT EXISTS dolphin_uv; CREATE TABLE IF NOT EXISTS dolphin_uv.prime_decisions ( -- identity ts DateTime64(3, 'UTC') COMMENT 'wall-clock timestamp of the scan', scan_number UInt32 COMMENT 'scan number (joins to trade_events)', mono_ns Int64 COMMENT 'monotonic ns since epoch for ordering', -- inputs (from ScanContext) vel_div Float64 COMMENT 'velocity divergence (non-finite -> 0)', posture LowCardinality(String) COMMENT 'APEX | TURTLE | HIBERNATE | STALKER | ...', esof_json String COMMENT 'esof_payload as JSON (might be None)', vol_ok UInt8 COMMENT 'vol_ok flag (0/1)', trade_direction Int8 COMMENT '-1 SHORT / 0 flat / 1 LONG', efsm_pending_slots UInt8 COMMENT 'EFSM pending slot count (>=0)', -- 11 hook effects (from HookRunner frame) hooks_json String COMMENT 'HookEffect list: name, ok, note, mutations, elapsed_us', -- decision (from step_bar) has_entry UInt8 COMMENT '1 = entry generated', asset LowCardinality(String) COMMENT 'traded asset symbol', side LowCardinality(String) COMMENT 'BUY | SELL | ...', leverage Float64 COMMENT 'applied leverage', bar_idx Int32 COMMENT 'bar index when entry fired', entry_json String COMMENT 'full entry dict as JSON', -- deps status deps_json String COMMENT 'dep status map as JSON' ) ENGINE = MergeTree() ORDER BY (scan_number, ts) COMMENT 'PRIME proceedings -- parity-diff sink against dolphin.trade_events';