Multi-file upload (auto-classifies each uploaded file as revenue or expense by column headers - "Revenue Category" vs "Spend Category" - so the order doesn't matter), with a clear prompt if only one file is uploaded or a role is duplicated/unrecognized. - logic.py: process_revenue()/process_expense() share one _process_side() implementation (revenue flips sign, expense doesn't - expense accounts are already debit-normal). EXPENSE_ACCOUNT_CODES covers all 19 P&L expense accounts (68010-82000), not just the "Disbursements to Projects" ones - real per-donor Project attribution turned out to be present across nearly all of them (salaries, travel, currency gain/loss, etc.), confirmed against the actual sample data. full_file_balance() checks each uploaded file's raw, unfiltered total nets to ~zero - a basic trial-balance integrity check independent of the revenue/expense filtering - and blocks processing if not. - Donor sheets now write both Revenue and Expenses sections (same Account -> SLOB -> Category -> Subtotal hierarchy for both), and every subtotal/total/surplus cell is a real Excel SUM/subtraction formula rather than a precomputed value, so the numbers are auditable directly in the workbook. - Fixed a latent bug found while adding the Expenses section: the previous row-insert logic could leave a stale duplicate "Total Revenue" label when a donor had fewer lines than the template reserves. _adjust_block() now inserts OR deletes rows symmetrically so the template's own total labels always land exactly where expected - no more relying on need >= the template's reserved slack. - routes.py: /api/process now accepts trial_balance_file_0.. (multiple), classifies each by its columns, and returns total_revenue, total_expense, and surplus_deficit alongside the existing donor count. - templates/donor_report/index.html: multi-file drop zone (mirroring the EIB tool's PDF upload pattern) and two more stat boxes (Total Expense, Surplus/(Deficit), red/green colored). - Added "Easyjet" (lowercase) to the donor merge map - a variant not present in the revenue file, found only once the expense file was processed. Verified end to end: every SLOB subtotal, Total Revenue, Total Expenses, and Surplus/(Deficit) formula in the generated workbook was independently re-evaluated (recursively resolving formula-to-formula references) and cross-checked against the API's reported totals - exact match on all 12 donor sheets and the grand total (revenue 4,384,170.35 / expense 3,611,064.64 / surplus 773,105.71). Also verified the zero-revenue and zero-expense edge cases produce no duplicate total labels. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> |
||
|---|---|---|
| app | ||
| templates | ||
| .gitignore | ||
| CLAUDE.md | ||
| Dockerfile | ||
| README.md | ||
| docker-compose.yml | ||
| eib-processor_how-it-works.md | ||
| requirements.txt | ||
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
- Upload a raw Equals Money export (.xlsx)
- Optionally upload a combined card statement CSV for per-person audit
- 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