SPEC: add Pivot and Log pages, update file structure

Document the Perspective-based pivot viewer, cell inspector
behavior, layout persistence, and row matching approach.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Paul Trowbridge 2026-04-14 22:54:40 -04:00
parent fb9ff8720a
commit ec0cc73f31

View File

@ -61,6 +61,8 @@ ui/
Rules.jsx — rule CRUD with live pattern preview
Mappings.jsx — mapping table with TSV import/export
Records.jsx — paginated, sortable view of transformed records
Pivot.jsx — interactive pivot table with cell inspector
Log.jsx — global import log across all sources
public/ — compiled UI (output of npm run build in ui/)
```
@ -214,7 +216,9 @@ Built with React + Vite + Tailwind CSS. Compiled output goes to `public/`. The s
- **Mappings** — Tabular mapping editor. Shows all extracted values from transformed records with record counts and sample raw data. Rows are yellow (unmapped), white (mapped), or blue (edited but unsaved). Supports TSV export and import. Columns can be added dynamically.
- **Records** — Paginated table showing the `dfv.{source}` view. Server-side sorting (column validated against `information_schema.columns`, interpolated with `quote_ident`). Dates are formatted `YYYY-MM-DD` for correct lexicographic sort.
- **Records** — Paginated table showing the `dfv.{source}` view. Server-side sorting (column validated against `information_schema.columns`, interpolated with `quote_ident`). Dates are formatted `YYYY-MM-DD` for correct lexicographic sort. Regex filters can be added per column. If the view cast fails (e.g. a field typed as `date` contains text), the error is shown inline rather than a blank page.
- **Pivot** — Interactive pivot/crosstab powered by [Perspective](https://perspective.finos.org/) (loaded from CDN at runtime). Loads all rows from the source view into an in-browser Perspective worker and renders a `<perspective-viewer>` web component. Supports grouping, splitting, filtering, sorting, and charting interactively. Layout (group_by, split_by, filters, plugin) is saved per source to `localStorage` and can be reset. Clicking a cell opens an inspector panel on the right showing the exact cell coordinates (group_by split_by values), the clicked metric value, any active user filters, and the underlying raw rows that contribute to that cell. Row matching applies the `perspective-click` event's filter array directly against the in-memory rows, skipping filters for Perspective-computed columns (e.g. derived date parts like Month or YearDate) that don't exist in the source data.
- **Log** — Global import log across all sources. Same expandable key detail and delete capability as the Import page, plus a source name column.