Skip to content

Add a modular, opt-in PDF report builder - #31

Merged
BasLinders merged 1 commit into
mainfrom
pdf-report-builder
Aug 21, 2026
Merged

Add a modular, opt-in PDF report builder#31
BasLinders merged 1 commit into
mainfrom
pdf-report-builder

Conversation

@BasLinders

@BasLinders BasLinders commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • New pdf_builder.py: a modular PDF report builder, separate from prox/report.py's generate_html_report(). Where that HTML report always bundles every section into one fixed file, this presents a checkbox per available results tab (Process Maps, Variants, Bottlenecks, Conformance, Funnel, Business Insights, Session Insights, Segment Comparison) and only includes what's checked — so a shared PDF can be scoped to just what's relevant instead of exporting everything.
  • Only sections with actual data are offered as checkboxes (e.g. no "Segment Comparison" checkbox until a segment comparison has actually been run).
  • Built with reportlab (pure Python, no system rendering dependency — no wkhtmltopdf binary, no Cairo/Pango), consistent with the "runs on a standard laptop" design goal already in the README. Added as a new base dependency in requirements.txt/setup.py.
  • Wired into main.py as a new "5. Build a Custom PDF Report" section below the results tabs, reading from the same results dict (and segment_result, if present) the tabs already render from.

Why

The HTML report is all-or-nothing. This makes reporting modular: pick exactly the sections a given audience needs (e.g. just Business + Session Insights for a stakeholder update) instead of a fixed everything-bundle.

Test plan

  • pytest tests/ — 129 passed (10 new tests in tests/test_pdf_builder.py covering section availability/filtering, individual section builders with and without data, and end-to-end PDF byte generation)
  • Manually ran the full pipeline against generated mock data and built a PDF from all available sections, and from a deliberate subset (['business', 'sessions']) — verified valid %PDF output both times, with the subset producing a smaller file
  • Manual click-through of the new checkboxes/Generate/Download flow in a running Streamlit session — not run in this environment (no display)

Unlike generate_html_report(), which always bundles every section into
one fixed file, this lets the user check which tabs to include (Process
Maps, Variants, Bottlenecks, Conformance, Funnel, Business Insights,
Session Insights, Segment Comparison) before generating a PDF, so a
shareable report can be scoped to just what's relevant.

Built with reportlab - pure Python, no system rendering dependency
(no wkhtmltopdf binary, no Cairo/Pango) - consistent with the "runs on
a standard laptop" design goal. Only sections with actual data are
offered as checkboxes. Wired into main.py as a new "Build a Custom PDF
Report" section below the results tabs.
@BasLinders
BasLinders marked this pull request as ready for review August 21, 2026 11:08
@BasLinders BasLinders self-assigned this Aug 21, 2026
@BasLinders BasLinders added bug Something isn't working enhancement New feature or request labels Aug 21, 2026
@BasLinders
BasLinders merged commit d0dc0c1 into main Aug 21, 2026
1 check passed
@BasLinders
BasLinders deleted the pdf-report-builder branch August 21, 2026 11:08
BasLinders added a commit that referenced this pull request Sep 8, 2026
Add a modular, opt-in PDF report builder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants