Skip to content

vpyr/docket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docket

Docket extracts fields from invoices and receipts, classifies each document, and files it according to YAML rules. Every applied move is recorded in SQLite and can be reversed with undo.

Plain-text examples are included, so the core workflow runs without OCR software.

Run it

python -m venv .venv
source .venv/bin/activate
pip install -e .

docpipe process examples/inbox --out /tmp/filed
docpipe process examples/inbox --apply --out /tmp/filed
docpipe search widgets

The first command is a dry run. The second applies the moves and prints a run ID:

Moved 2 file(s). Run id: d15c5ff3

Use that ID to restore every file from the run:

docpipe undo d15c5ff3

An input such as acme_invoice.txt can become invoices/2026/2026-07-acme-supplies-ltd-invoice-INV-1042.txt, depending on the routing rules.

Extraction and routing

The extractors identify vendor, date, total, and document number. Each field includes a confidence score. Date parsing supports ISO dates, US-style numeric dates, month names, and an optional day-first mode.

classify.py uses document keywords to choose invoice, receipt, contract, or other. routing.py renders the selected YAML filename template without touching the filesystem, which keeps route planning easy to test.

Search and undo

Applied documents are indexed in SQLite FTS5. Search results include matching snippets and the filed path.

The journal records source and destination paths for each move. Undo restores files in reverse order, and repeating the same undo does not damage already restored files.

Optional PDF and image extraction

pip install -e '.[ocr]'
sudo apt-get install tesseract-ocr

PDF text uses pdfplumber. Images pass through grayscale conversion and adaptive thresholding before Tesseract reads them. These dependencies load only when the corresponding file type is processed.

Tests

pytest -q

The 14 tests cover field extraction, confidence values, classification, routing, FTS5 search, applied moves, exact file restoration, and idempotent undo.

About

Document field extraction, filing rules, full-text search, and undo.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages