bac_tools/README.md
2026-03-09 15:41:15 -06:00

1.4 KiB

BAC Statement Extractor

Extracts credit card transactions from BAC Costa Rica statement PDFs. Parses sections B (purchases), D (other charges), and E (voluntary services) and outputs JSON.

Dependencies

  • Python 3.10+
  • pdfplumber (>=0.10.0)

Usage

python bac_extract.py <pdf_file> [options]

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 --pretty
python bac_extract.py statement.pdf -o output.json -v

Output Format

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