New Blueprint at app/tools/donor_report/ (registered on the platform
home page), following the eib tool's conventions:
- logic.py: parse_project() splits "<Company> - <SLOB> - <Donor...>"
with the join-back fix for hyphenated donor names; donor merge map is
a bind-mounted CSV (donor_merge_map.csv, same pattern as
merchant_lookup.csv) covering the confirmed G Adventures/EasyJet/
TruTravels/IGF spelling variants. Per stakeholder direction, any row
with no real donor segment (blank Project, or a 2-part Project with
no donor at the end) and any row whose donor segment is literally
"General" both collapse into one unified "General" report.
- Aggregation groups to (donor, account, slob, category) and sums -
since this is a trial balance, groups that net to exactly zero are
real (reclassifications, offsetting entries) rather than bugs, so
they're simply not displayed rather than needing special-case
duplicate detection. Verified the grand total across all donors
matches summing the raw filtered rows directly.
- build_donor_workbook() copies report_summary_template.xlsx per donor,
expanding the template's fixed 5-row detail area via insert_rows() to
fit each donor's actual row count (1-30+), writing Category -> SLOB
subtotal -> Account header -> Total Revenue, with the Expenses
section shifted down accordingly and left unpopulated per the current
scope (revenue only).
- routes.py: /donor-report/api/process (single synchronous call, no
progress polling needed - unlike the eib tool there's no slow
external step) and /api/download/<filename>.
- templates/donor_report/index.html: single-upload page in the same
theme as the platform shell.
Verified end to end against the real sample trial balance: 10 donor
sheets generated, all merge-map variants resolved correctly, no empty
sheets for accounts that fully net to zero, and the total revenue
figure matches an independent manual calculation from the raw file
(4,384,170.35).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>