63 lines
1.3 KiB
Markdown
63 lines
1.3 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
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:**
|
|
```bash
|
|
python bac_extract.py statement.pdf 1234 --pretty
|
|
python bac_extract.py statement.pdf 1234 -o output.json -v
|
|
```
|
|
|
|
## Output Format
|
|
|
|
```json
|
|
{
|
|
"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
|
|
}
|
|
}
|
|
```
|