Commit Graph

4 Commits

Author SHA1 Message Date
JasonFraser e339b7147a Move merchant mapping to a bind-mounted CSV, add in-UI mapping flow
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>
2026-08-19 11:55:43 -04:00
JasonFraser 6590567c98 Update docs for the template-population features
eib-processor_how-it-works.md still described the pre-restructure
single-file app; corrected paths and added the two-output-file workflow
(eib_pre_template.xlsx vs. planeterra_equals_cards_transactions_eib_v45.xlsx).
CLAUDE.md gains populate_upload_template()/LAST_RESULT/the generate-upload
route, and a trajectory entry for how both template features were built.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 16:13:58 -04:00
JasonFraser a9df545952 Populate finance's EIB template instead of generating a fresh workbook
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>
2026-08-18 15:24:21 -04:00
JasonFraser bdfa244729 Add CLAUDE.md with architecture and project trajectory
Documents the platform-shell/tool-blueprint convention, the EIB tool's
mechanics, and the two-step path (landing page preview, then blueprint
restructuring) so future sessions can pick up without re-deriving it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:29:54 -04:00