Report Export
Report Export (Client-Side CSV + PDF)
Use Cases
- Export a handful of selected rows with manual edits for sharing.
- Export a large selection without editing every row.
- Reuse the current report filters/selection and return to the table intact.
- Add a title/subtitle/note in the PDF header.
- Rename column headers for CSV/PDF.
Open Questions (Confirm Before Build)
- âś… All cells editable.
- ✅ “Back to table” shows a warning; changes are not persisted.
- âś… CSV includes only report table columns (visible columns in current order).
- âś… PDF uses list/card styling (no heavy borders), with header/footer and page numbers.
- âś… PDF export limited to 200 rows (configurable via
app/config.py).
Specs
Data Source
- Use selected IDs from
data/users/{uuid}/session-report.json → selection.
- Query
transactions_analyzed for selected IDs only.
- Apply session column order + visibility and date formatting patterns.
Export Page
- Route:
/report/export (GET).
- Render editable table:
- Editable cells (all fields editable; input vs contenteditable TBD).
- Editable column headers (rename).
- PDF header fields: title, subtitle, note.
- Buttons:
- Back to report table (warn changes will be lost; selection preserved).
- Export CSV (client-side).
- Export PDF (client-side via html2pdf.js).
CSV Export (Client-Side)
- Serialize the current edited table state to CSV.
- Use renamed headers as CSV header row.
- Include only the report table columns (visible columns in current order).
- Trigger download via Blob.
PDF Export (Client-Side)
- Use html2pdf.js to render the export container.
- Apply print styles (A4, margins, header spacing).
- Include header fields above the table.
- Layout should be card/list style (no heavy table borders).
- Add header + footer with page numbers.
- Restrict PDF export to a max of 200 rows (configurable).
Task List
- [ ] Add “Create report” CTA in the selection banner (visible when selection count > 0)
- [ ] Create
/report/export page that:
- [ ] Fetches selected rows from
transactions_analyzed
- [ ] Applies column order/visibility + date formatting
- [ ] Renders editable table + editable column headers + PDF header inputs
- [ ] Add client-side CSV export:
- [ ] Serialize edited table to CSV
- [ ] Trigger download via Blob
- [ ] Add client-side PDF export (html2pdf.js):
- [ ] Render export container with header text
- [ ] Keep selection intact when navigating back to
/report
Notes
- PDF and CSV exports are client-side (no pandas, no server-side PDF).
- Consider limits/warnings for very large selections (e.g., PDF > 2,000 rows).