internal tool to analyze equals money expense card transactions into a formatted excel for upload to work day accounting software using the EIB excel tool
Go to file
JasonFraser a9f4b5a597 Add Donor Revenue Report tool
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>
2026-08-25 12:36:11 -04:00
app Add Donor Revenue Report tool 2026-08-25 12:36:11 -04:00
templates Add Donor Revenue Report tool 2026-08-25 12:36:11 -04:00
.gitignore Add Donor Revenue Report tool 2026-08-25 12:36:11 -04:00
CLAUDE.md Move merchant mapping to a bind-mounted CSV, add in-UI mapping flow 2026-08-19 11:55:43 -04:00
Dockerfile Initial commit: EIB processor tool with new landing page preview 2026-08-18 10:30:53 -04:00
README.md Move merchant mapping to a bind-mounted CSV, add in-UI mapping flow 2026-08-19 11:55:43 -04:00
docker-compose.yml Add Donor Revenue Report tool 2026-08-25 12:36:11 -04:00
eib-processor_how-it-works.md Update docs for the template-population features 2026-08-18 16:13:58 -04:00
requirements.txt Initial commit: EIB processor tool with new landing page preview 2026-08-18 10:30:53 -04:00

README.md

Internal Tools

A small platform of internal tools for Planeterra International Foundation. Built by Undo Designs. Currently hosts one tool: the EIB Processor (Equals Money → Workday EIB transformer and statement auditor).

Quick start

docker compose up --build

Then open http://localhost:8081 for the tools landing page, or go straight to http://localhost:8081/eib/ for the EIB Processor.

Adding a new tool

Each tool lives in its own app/tools/<name>/ package with a Flask Blueprint (routes + a logic.py of Flask-free business logic) and its own templates/<name>/ folder. Register the blueprint and add an entry to the TOOLS list in app/main.py to get a card on the landing page.

EIB Processor — what it does

  1. Upload a raw Equals Money export (.xlsx)
  2. Optionally upload a combined card statement CSV for per-person audit
  3. Download the processed EIB Excel file

The audit table appears in the output file four columns after the last EIB column. Each person gets a single MATCHED / REVIEW REQUIRED status based on:

sum(EIB Converted Amount) == sum(statement Total debited for rows in EIB)

PDF statement audit (Docling)

The Docling container starts automatically with Docker Compose. Once it's healthy (check the badge in the top-right of the UI), you can upload a PDF statement instead of the CSV.

PDF parsing extracts the opening/closing balance summary from page 1 of the Equals statement. The Docling health check takes ~60s on first start.

Adding new merchants

If the processor reports unmapped merchants, the result panel lets you type a clean name for each one right there and continue processing immediately — no code changes or restarts needed.

The mappings live in app/tools/eib/merchant_lookup.csv (bind-mounted, so edits — from the UI or by hand — take effect on the next run with no rebuild). Editing it directly works too: it's a plain two-column CSV (raw_description,clean_name).

Services

Service Port Description
app 8081 Flask web app (tools platform)
docling 5001 Docling PDF parsing service

Volumes

  • ./uploads/ — temporary uploaded files
  • ./outputs/ — generated EIB Excel files