ledger-sentinel
motivation
I wanted a pipeline that treats an LLM as one stage in a larger, testable system rather than the whole system — CSV in, cleaned and validated data, deterministic anomaly rules, then an LLM stage for the parts that are genuinely about language, all behind a task queue so a slow model call never blocks the API.
what it does
Ingests raw transaction CSVs asynchronously via Celery, normalizes inconsistent date formats and deduplicates records, flags anomalies with deterministic rules (spend outliers past 3x the account median, foreign-currency charges on domestic-only merchants), then batches uncategorized transactions through the Gemini API for classification and generates a narrative spend summary.
technical detail
The Gemini integration is genuinely wired in production, not mocked — tests patch the model client directly so the pipeline is fully unit-testable without live API calls. Batch classification runs in groups of 20 with exponential backoff. The whole thing is Dockerized with a Flower dashboard for watching the Celery queue in real time.
system architecture
encode / decode
ST01 ST03 ST08 ST17 ST20
(real hardware)
(Renode / CI)