Parsing Pipeline
The parsing pipeline is designed for reliability and repeatability. Every import is tracked as a session and can be previewed, audited, or reprocessed.
Pipeline stages
-
Upload
- Files go to the uploads directory:
UPLOADS_DIR, otherwise./uploads(/app/uploadsin Docker) - A SHA-256 hash is computed to catch duplicate uploads
- Up to 10 MB per file
- Files go to the uploads directory:
-
Queue
- Parsing runs asynchronously in the BullMQ statement parsing queue (
parsing/queue) STATEMENT_PARSING_CONCURRENCY(default 5) limits how many statements are parsed at once
- Parsing runs asynchronously in the BullMQ statement parsing queue (
-
Parser selection
ParserFactoryServicedetects the bank from the document text (bank name, then BIC) and holds the parsers fromparser-registry.ts: one per supported bank, generic PDF, Excel, CSV, DOCX, OFX, QIF, CAMT.053, and MT940OcrService(tesseract.js) extracts text from images and scans
-
Quality gate
StatementQualityGateServicerates the parsed statementready,review, orblocked
-
Import session: preview and commit
- An
import_sessionsrecord tracks the status:pending,processing,preview,completed,failed, orcancelled GET /statements/:id/import-previewshows the parsed rows and their conflicts with existing transactionsPOST /statements/:id/import-commitsaves them; each conflict is resolved asskip,force_import, ormark_duplicate
- An
-
Categorization
- Your categorization rules apply first, in priority order
- Payee history fills the rest: a payee's default category moves only when two of its three most recent confirmed rows agree; anything left is Uncategorized and goes to Review — see Categorization
-
Deduplication
- Transaction fingerprints plus fuzzy matching on date, amount, and text
- Uncertain matches are flagged for manual review
Error handling
- Parsing errors are captured on the statement and its import session
POST /statements/:id/reprocessreruns parsing without re-uploading- Logs are structured JSON with request and trace IDs; parsers log volumes and outcomes, never transaction contents
Related code
backend/src/modules/parsingbackend/src/modules/importbackend/src/modules/classification
Next: Importing Statements