No description
Find a file
2026-03-09 13:24:41 -06:00
.gitignore add gitignore 2026-03-09 13:24:23 -06:00
bac_extract.py initial commit 2026-03-09 13:24:41 -06:00
CLAUDE.md initial commit 2026-03-09 13:24:41 -06:00
README.md initial commit 2026-03-09 13:24:41 -06:00
requirements.txt initial commit 2026-03-09 13:24:41 -06:00

BAC Statement Extractor

Extracts credit card transactions from BAC Costa Rica statement PDFs. Parses section "B) Detalle de compras del periodo" and outputs JSON.

Dependencies

  • Python 3.10+
  • pdfplumber (>=0.10.0)

Usage

python bac_extract.py <pdf_file> <card_suffix> [options]

Arguments:

  • pdf_file: Path to the BAC statement PDF
  • card_suffix: Last 4 digits of the card to filter

Options:

  • -o, --output: Output JSON path (default: transactions.json)
  • --pretty: Pretty-print JSON output
  • -v, --verbose: Enable debug logging

Examples:

python bac_extract.py statement.pdf 1234 --pretty
python bac_extract.py statement.pdf 1234 -o output.json -v

Output Format

{
  "metadata": {
    "source_file": "statement.pdf",
    "extraction_date": "2025-01-15T12:00:00Z",
    "statement_date": "2025-01-10",
    "card_filter": "1234",
    "total_transactions": 5
  },
  "card_holder": {
    "card_suffix": "1234",
    "name": "CARD HOLDER NAME"
  },
  "transactions": [
    {
      "reference": "123456789012",
      "date": "2025-01-09",
      "description": "EXAMPLE STORE",
      "location": null,
      "currency": "CRC",
      "amount_crc": 1234.56,
      "amount_usd": null
    }
  ],
  "summary": {
    "total_crc": 50000.00,
    "total_usd": 0.00,
    "transaction_count": 5
  }
}