MERCHANT_LOOKUP was a hardcoded dict in logic.py, so adding a merchant
meant editing Python and rebuilding the Docker image just to add one
row of data. Replaces it with:
- app/tools/eib/merchant_lookup.csv (raw_description,clean_name),
bind-mounted in docker-compose.yml so edits (by hand or via the app)
take effect on the next run — no rebuild, no restart.
- logic.py: _load_merchant_lookup() reads it fresh on every
process_raw() call; add_merchant_mappings() rewrites it with new
entries merged in.
- routes.py: new POST /api/merchant-mappings endpoint.
- templates/eib/index.html: the unmapped-merchant panel is now a form
(raw name -> editable clean-name input per merchant, prefilled with
the raw name) with a "Save & Continue Processing" button. Saving
posts the mappings, then automatically resubmits the same in-browser
File object to /api/process — no re-upload needed to resume.
Verified end to end: removed a known mapping to trigger the unmapped
path with zero rebuild (confirming the bind mount), saved it back via
curl, confirmed the CSV was updated on the host, and confirmed
reprocessing succeeded immediately after.
Also includes the user's own edits to eib_pre_template.xlsx and
planeterra_equals_cards_transactions_eib_v45.xlsx made directly in
Excel/Numbers outside this session.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
New "Generate EIB File (for Upload)" button, shown after a successful
process run, populates planeterra_equals_cards_transactions_eib_v45.xlsx
(the Workday EIB "Expense Credit Card Transaction" import template)
directly from that run's output, without a re-upload:
- app/tools/eib/logic.py: populate_upload_template() writes Header Key,
Line Key, Transaction Number/Date, Amount, currencies, description and
merchant name into the "Expense Credit Card Transaction" sheet, plus a
per-file metadata row into "Credit Card Transaction Header" (Header
Key, Credit Card Type, an auto-generated File Name covering the run's
date range, and today's date). Corporate-card identifiers
(AK/AM/AN) are resolved by reading eib_pre_template.xlsx's "Equals
Card IDs" sheet at generation time rather than duplicating that
mapping, so both output files always agree.
- app/tools/eib/routes.py: new /api/generate-upload route, backed by a
small module-level "last processed output" holder (same single-user
pattern as PROCESS_STATUS) so the button can reuse the prior run's
data.
- templates/eib/index.html: the new button + status note in the result
panel.
- .gitignore: exception for the new template, same as eib_pre_template.xlsx.
Also includes the user's own edit to eib_pre_template.xlsx (J:M formula
fill range manually extended from row 699 to row 2000).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace build_excel() with populate_template(): loads
app/tools/eib/eib_pre_template.xlsx fresh each run, writes EIB rows into
Final Sheet A2:I<n+1> (clearing prior run's rows first) and the audit
table starting at column AA, then saves a dated copy into outputs/ —
the template itself is never mutated. Columns J:Y (finance's own
corporate-card-ID lookup formulas and a legacy static block) are never
written to; _extend_formulas_down() only fills in a missing J:M formula
within the new data range (the template's formula rows turned out to be
non-contiguous, leftover from old manual test batches) without ever
touching a row that already has one.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Single-tool Flask app (Equals Money -> Workday EIB conversion + audit)
plus a new /home-preview landing page in preparation for turning this
into a multi-tool platform.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>