Skip to main content

Parse checking account PDF statements into structured financial data. Extensible multi-bank support with Strategy Pattern.

Project description

chkparse

A Python library for extracting financial data from TD Business Convenience Plus checking account PDF statements.

Parses transactions, account summaries, and validates the Golden Equation on every parse.


Features

  • Extracts all transactions with posting date, description, amount, and type
  • Categorises transactions: DEPOSIT, ELECTRONIC_DEPOSIT, OTHER_CREDIT, CHECK, ELECTRONIC_PAYMENT, OTHER_WITHDRAWAL
  • Checks include serial_number
  • Validates Beginning Balance + Credits - Debits = Ending Balance on every parse
  • All monetary values use decimal.Decimal
  • Exports to Pandas DataFrame with datetime64 date column

Installation

pip install chkparse

Requires Python 3.11+.


Quick Start

from chkparse import parse

statement = parse("path/to/statement.pdf")

print(statement.account_suffix)           # "7410"
print(statement.statement_period_start)   # datetime.date(2024, 12, 26)
print(statement.account_summary.ending_balance)  # Decimal('4482.23')

for t in statement.transactions:
    print(t.posting_date, t.transaction_type, t.description, t.amount)

Pandas Export

from chkparse import parse
from chkparse.export.export_service import to_df

statement = parse("path/to/statement.pdf")
df = to_df(statement)

print(df.dtypes)
# posting_date        datetime64[ns]
# description                 object
# amount                     float64
# transaction_type            object
# serial_number               object

Error Handling

from chkparse import parse, BalanceMismatchError, DataIntegrityError

try:
    statement = parse("path/to/statement.pdf")
except BalanceMismatchError as e:
    print(e)
except DataIntegrityError as e:
    print(e)
Exception Raised when
BalanceMismatchError Golden Equation validation fails
DataIntegrityError A required field is missing or unparseable
UnsupportedFormatError PDF is not a TD Business checking statement
ChkParserError Base class for all library errors

Development

git clone https://github.com/rmuktader/chkparse
cd chkparse
uv sync
uv run pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chkparse-1.0.0.tar.gz (57.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chkparse-1.0.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file chkparse-1.0.0.tar.gz.

File metadata

  • Download URL: chkparse-1.0.0.tar.gz
  • Upload date:
  • Size: 57.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for chkparse-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6a1e3d50b3ce206a3ae5798bff637f67829fb14372244602ffc08ea771a38440
MD5 e07aa6c038664109122ec064c5bb2cdd
BLAKE2b-256 c1a50a297a40e0574768ec41f5ac8d526b951d4d252066f8aebb5985b329f78e

See more details on using hashes here.

File details

Details for the file chkparse-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: chkparse-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for chkparse-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1626956723631ae5ccb4b2c9d1ba1bca1b702895721fd2c08945ca68532fbbce
MD5 b296798037d204754678bb048a76f7d4
BLAKE2b-256 ecc542462d9ae607afe2070329f6758acba538c941cc73fcecd86257f3c54e94

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page