pf_app/routes
Paul Trowbridge 1ed8595577 SPIKE: server-side DuckDB virtual server behind ?engine=duck
Working measurement spike for Option C: aggregation runs in a server-side
DuckDB instead of shipping every row to the browser. Opt-in via
?engine=duck; the default client-side WASM path is untouched.

- routes/perspective.js: POST /perspective/init materializes a version's
  forecast table into a persistent in-process DuckDB (ATTACH postgres,
  so 535k rows land in ~1.5s without streaming through Node); POST
  /perspective/sql executes one Perspective-generated statement, with
  Arrow IPC output for viewport reads.
- ui/src/duckServerHandler.js: VirtualServerHandler that delegates SQL
  generation to Perspective's own GenericSQLVirtualServerModel and POSTs
  the result to the server. Adapted from @perspective-dev/client's
  virtual_servers/duckdb.ts — same SQL model, different transport.
- Forecast.jsx: DUCK_MODE branch replaces the heavy /data fetch with
  /perspective/init, opens the hosted table over a message port, and
  shows a latency overlay. applyDepth routes through viewer.restore()
  since the SQL server cannot handle view.set_depth().

Preserved for a future faster-load effort. Findings and the reason this
is not the shipped path (no interactive tree expand/collapse) are in
pf_perspective_options.md on master.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 21:48:06 -04:00
..
log.js Consolidate duplicate log routes into routes/log.js 2026-06-17 21:50:21 -04:00
operations.js Consolidate duplicate log routes into routes/log.js 2026-06-17 21:50:21 -04:00
perspective.js SPIKE: server-side DuckDB virtual server behind ?engine=duck 2026-08-17 21:48:06 -04:00
sources.js Add dim-period/cols endpoint and replace dim_period_col text input with select 2026-06-13 00:17:22 -04:00
tables.js Expose pf_note/pf_op in forecast data; fix tables list duplicates 2026-04-28 19:51:45 -04:00
versions.js Refactor sources UI, rename pf_ system cols, replace filter builder with raw SQL 2026-04-03 00:47:57 -04:00