ตัวแยกวิเคราะห์ใบแจ้งยอดธนาคาร

แอปพลิเคชันในโลกแห่งความเป็นจริง

คลัง: การย้าย MT940 ถึง CAMT.053

ทีมคลังทั่วโลกกำลังย้ายจาก MT940 ไปใช้ CAMT.053 ก่อนกำหนดเวลา SWIFT ในเดือนพฤศจิกายน 2570 ตัวแยกวิเคราะห์ใบแจ้งยอดธนาคาร จัดการทั้งสองรูปแบบด้วย API เดียว ทำให้การเปลี่ยนแปลงราบรื่น

from bankstatementparser import create_parser, detect_statement_format

# Process both MT940 and CAMT.053 with the same code
for file in daily_statement_files:
    fmt = detect_statement_format(file)
    parser = create_parser(file, fmt)
    df = parser.parse()
    load_to_treasury_system(df)

การกระทบยอดอัตโนมัติ

แยกวิเคราะห์ใบแจ้งยอดธนาคารและจับคู่กับบันทึกภายในโดยอัตโนมัติ เอาต์พุต DataFrame แบบรวมทำให้รูปแบบตรรกะการกระทบยอดไม่เชื่อเรื่องพระเจ้า

from bankstatementparser import CamtParser, Deduplicator

parser = CamtParser("bank_statement.xml")
bank_txns = parser.parse()

# Deduplicate before reconciliation
dedup = Deduplicator()
result = dedup.deduplicate(dedup.from_dataframe(bank_txns))
clean_txns = result.unique_transactions

# Match against internal records
unmatched = reconcile(clean_txns, internal_ledger)

แนวทางการปฏิบัติตามและการตรวจสอบ

สร้างไปป์ไลน์ที่พร้อมสำหรับการตรวจสอบด้วยการตรวจทาน PII และเอาต์พุตตามที่กำหนด การทำงานทุกครั้งจะให้ผลลัพธ์ที่เหมือนกันสำหรับอินพุตเดียวกัน ซึ่งเป็นไปตามข้อกำหนดด้านความสามารถในการทำซ้ำตามกฎระเบียบ

from bankstatementparser import CamtParser

parser = CamtParser("statement.xml")

# Stream with PII redacted for audit logs
for txn in parser.parse_streaming(redact_pii=True):
    audit_log.write(txn)

# Export full data for secure internal processing
parser.export_csv("archive/statement.csv")

เวิร์กโฟลว์ SFTP สู่ DataFrame

ธนาคารหลายแห่งส่งใบแจ้งยอดผ่าน SFTP แยกวิเคราะห์โดยตรงจากไบต์โดยไม่ต้องเขียนลงดิสก์

from bankstatementparser import CamtParser

xml_bytes = sftp_client.read("daily_statement.xml")
parser = CamtParser.from_bytes(xml_bytes, source_name="daily.xml")
df = parser.parse()

การรวมบัญชีหลายธนาคาร

รวมใบแจ้งยอดจากธนาคารหลายแห่งโดยใช้รูปแบบที่แตกต่างกันให้เป็นชุดข้อมูลมาตรฐานชุดเดียว

from bankstatementparser import parse_files_parallel

results = parse_files_parallel([
    "hsbc/camt053.xml",
    "barclays/mt940.sta",
    "revolut/transactions.csv",
    "wise/statement.ofx",
])

all_transactions = pd.concat([r.transactions for r in results if r.status == "success"])

การประมวลผลเป็นชุดพร้อมไฟล์ ZIP

ประมวลผลคำสั่งที่บีบอัดไว้อย่างปลอดภัยด้วยการป้องกัน ZIP Bomb ในตัว

from bankstatementparser import iter_secure_xml_entries, CamtParser

for entry in iter_secure_xml_entries("monthly_statements.zip"):
    parser = CamtParser.from_bytes(entry.xml_bytes, source_name=entry.source_name)
    df = parser.parse()
    save_to_warehouse(entry.source_name, df)