bankstatementparser 0.0.19__tar.gz → 0.0.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/PKG-INFO +20 -15
  2. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/README.md +17 -14
  3. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/__init__.py +9 -3
  4. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/additional_parsers.py +225 -153
  5. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/analytics.py +247 -85
  6. bankstatementparser-0.0.20/bankstatementparser/api.py +583 -0
  7. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/bank_statement_parsers.py +40 -22
  8. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/base_parser.py +43 -5
  9. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/camt_parser.py +424 -199
  10. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/cli.py +49 -40
  11. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/export/__init__.py +2 -1
  12. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/export/ledger.py +33 -5
  13. bankstatementparser-0.0.20/bankstatementparser/export/parquet.py +161 -0
  14. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/forensics.py +32 -7
  15. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/orchestrator.py +26 -6
  16. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/vision.py +174 -70
  17. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/pain001_parser.py +281 -194
  18. bankstatementparser-0.0.20/bankstatementparser/parallel.py +162 -0
  19. bankstatementparser-0.0.20/bankstatementparser/privacy.py +73 -0
  20. bankstatementparser-0.0.20/bankstatementparser/py.typed +0 -0
  21. bankstatementparser-0.0.20/bankstatementparser/reconciliation.py +362 -0
  22. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/record_types.py +12 -1
  23. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/transaction_deduplicator.py +66 -43
  24. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/transaction_models.py +30 -13
  25. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/pyproject.toml +7 -5
  26. bankstatementparser-0.0.19/bankstatementparser/api.py +0 -329
  27. bankstatementparser-0.0.19/bankstatementparser/export/parquet.py +0 -81
  28. bankstatementparser-0.0.19/bankstatementparser/parallel.py +0 -121
  29. bankstatementparser-0.0.19/bankstatementparser/reconciliation.py +0 -322
  30. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/LICENSE +0 -0
  31. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/LICENSE-APACHE +0 -0
  32. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/LICENSE-MIT +0 -0
  33. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/_amounts.py +0 -0
  34. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/_llm_common.py +0 -0
  35. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/enrichment/__init__.py +0 -0
  36. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/enrichment/account_mapper.py +0 -0
  37. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/enrichment/categorizer.py +0 -0
  38. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/exceptions.py +0 -0
  39. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/field86_parser.py +0 -0
  40. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/__init__.py +0 -0
  41. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/evaluation.py +0 -0
  42. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/llm_extractor.py +0 -0
  43. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/ollama_direct.py +0 -0
  44. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/pdf_text.py +0 -0
  45. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/prompts.py +0 -0
  46. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/scanner.py +0 -0
  47. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/hybrid/verification.py +0 -0
  48. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/input_validator.py +0 -0
  49. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/plugins.py +0 -0
  50. {bankstatementparser-0.0.19 → bankstatementparser-0.0.20}/bankstatementparser/zip_security.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bankstatementparser
3
- Version: 0.0.19
3
+ Version: 0.0.20
4
4
  Summary: BankStatementParser is your essential tool for easy bank statement management. Designed with finance and treasury experts in mind, it offers a simple way to handle CAMT (ISO 20022) formats and more. Get quick, accurate insights from your financial data and spend less time on processing. It's the smart, hassle-free way to stay on top of your transactions.
5
5
  License: Apache-2.0 OR MIT
6
6
  License-File: LICENSE
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
19
20
  Provides-Extra: api
20
21
  Provides-Extra: enrichment
21
22
  Provides-Extra: excel
@@ -36,6 +37,7 @@ Requires-Dist: pyarrow (>=14.0.0) ; extra == "parquet"
36
37
  Requires-Dist: pydantic (>=2.11.0,<3.0.0)
37
38
  Requires-Dist: pypdf (>=4.0.0) ; extra == "hybrid" or extra == "hybrid-plus" or extra == "hybrid-vision"
38
39
  Requires-Dist: pypdfium2 (>=4.30.0) ; extra == "hybrid-vision"
40
+ Requires-Dist: python-multipart (>=0.0.32) ; extra == "api"
39
41
  Requires-Dist: uvicorn (>=0.34.0) ; extra == "api"
40
42
  Project-URL: Homepage, https://bankstatementparser.com
41
43
  Project-URL: Repository, https://github.com/sebastienrousseau/bankstatementparser
@@ -62,7 +64,7 @@ Description-Content-Type: text/markdown
62
64
 
63
65
  <p align="center">
64
66
  <a href="https://github.com/sebastienrousseau/bankstatementparser/actions"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/bankstatementparser/quality-gates.yml?style=for-the-badge&logo=github" alt="Build" /></a>
65
- <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge&v=0.0.19" alt="PyPI" /></a>
67
+ <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge&v=0.0.20" alt="PyPI" /></a>
66
68
  <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/dm/bankstatementparser.svg?style=for-the-badge" alt="PyPI Downloads" /></a>
67
69
  <a href="https://codecov.io/github/sebastienrousseau/bankstatementparser?branch=main"><img src="https://img.shields.io/codecov/c/github/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="Codecov" /></a>
68
70
  <a href="LICENSE"><img src="https://img.shields.io/github/license/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="License" /></a>
@@ -258,9 +260,9 @@ Every row carries:
258
260
 
259
261
  - `source_method` — `"deterministic"`, `"llm"`, or `"vision"` for
260
262
  full audit provenance
261
- - `transaction_hash` — MD5 fingerprint of
262
- `date | normalized_description | amount`, ready for idempotent
263
- re-ingestion
263
+ - `transaction_hash` — versioned SHA-256 fingerprint scoped to account,
264
+ currency, date, description, amount, and available bank identity.
265
+ Rebuild persisted pre-v2 keys before re-ingestion
264
266
  - `confidence` — float between 0 and 1 for LLM rows, `None` for
265
267
  deterministic
266
268
  - `raw_source_text` — best-effort source-text slice for the v0.0.6
@@ -369,7 +371,7 @@ for the full surface.
369
371
  |---|---|
370
372
  | **Golden Rule verification** *(v0.0.5)* | Every result carries `opening + credits − debits == closing` status: `VERIFIED`, `DISCREPANCY`, `UNVERIFIABLE`, or `FAILED`. |
371
373
  | **Multi-currency verification** *(v0.0.8)* | `verify_balance_multi_currency()` groups transactions by currency and runs the Golden Rule independently per group — no more false `DISCREPANCY` on multi-currency statements. |
372
- | **Idempotent dedup** *(v0.0.5)* | Every `Transaction` carries a stable `transaction_hash` (MD5 of date + normalized description + amount). `Deduplicator.dedupe_by_hash()` makes incremental ingestion safe to re-run. |
374
+ | **Idempotent dedup** *(v0.0.5)* | Every `Transaction` carries a stable `transaction_hash` (versioned SHA-256 of account, currency, date, description, amount, and bank identity). `Deduplicator.dedupe_by_hash()` makes incremental ingestion safe to re-run. |
373
375
  | **Interactive review** *(v0.0.6)* | `--type review` CLI walks through discrepancies with accept/edit/skip/delete/quit. `IngestResult.to_json()` / `.from_json()` for stable round-trip with embedded audit trail. |
374
376
 
375
377
  ### Enrichment & export
@@ -388,17 +390,18 @@ for the full surface.
388
390
  |---|---|
389
391
  | **PII redaction** | Names, IBANs, and addresses masked by default — opt in with `--show-pii` |
390
392
  | **Secure ZIP** | `iter_secure_xml_entries()` rejects zip bombs, encrypted entries, and suspicious compression ratios |
391
- | **Tested** | 907 tests, coverage gated at 100% in CI, property-based fuzzing with Hypothesis |
393
+ | **Tested** | 1007 tests, coverage gated at 100% in CI, property-based fuzzing with Hypothesis |
392
394
 
393
395
  ---
394
396
 
395
397
  ## PII Redaction
396
398
 
397
399
  PII (names, IBANs, addresses) is **redacted by default** in
398
- console output and streaming mode.
400
+ CLI console output. Python parser methods return full records unless
401
+ `redact_pii=True` is supplied.
399
402
 
400
403
  ```python
401
- # Redacted by default
404
+ # Request redaction explicitly in Python
402
405
  for tx in parser.parse_streaming(redact_pii=True):
403
406
  print(tx) # Names and addresses show as ***REDACTED***
404
407
 
@@ -407,8 +410,9 @@ for tx in parser.parse_streaming(redact_pii=False):
407
410
  print(tx)
408
411
  ```
409
412
 
410
- File exports (CSV, JSON, Excel) always contain the full unredacted
411
- data.
413
+ Regular and hybrid file exports contain full records. Legacy CLI streaming
414
+ exports follow `--show-pii`; Python exports reflect the records supplied.
415
+ Choose redaction explicitly before sharing an exported file.
412
416
 
413
417
  ---
414
418
 
@@ -746,7 +750,7 @@ cleanly — see each companion's README for runnable examples.
746
750
  ## Project Layout
747
751
 
748
752
  ```text
749
- bankstatementparser/ Source code (38 modules)
753
+ bankstatementparser/ Source code (39 modules)
750
754
  bankstatementparser/hybrid/ PDF pipeline: orchestrator, llm_extractor, vision, scanner, ollama_direct, verification
751
755
  bankstatementparser/enrichment/ Categorizer, AccountMapper, EnrichedTransaction
752
756
  bankstatementparser/export/ hledger + beancount journal export, Apache Parquet columnar export
@@ -754,7 +758,7 @@ bankstatementparser/api.py REST API microservice (FastAPI)
754
758
  docs/compliance/ ISO 13485 validation, risk register, traceability matrix
755
759
  examples/ 14 deterministic + 9 hybrid runnable example scripts
756
760
  scripts/ SBOM generation, checksums, signature verification
757
- tests/ 907 tests (unit, integration, property-based, security, hybrid mocks)
761
+ tests/ 1007 tests (unit, integration, property-based, security, hybrid mocks)
758
762
  ```
759
763
 
760
764
  ---
@@ -826,8 +830,9 @@ No. Zero network calls. XML parsers enforce `no_network=True`. No
826
830
  cloud, no telemetry.
827
831
 
828
832
  **Is PII redacted automatically?**
829
- Yes. Names, IBANs, and addresses are masked by default in console
830
- output and streaming. File exports retain full data.
833
+ CLI console output masks personal fields by default. Python callers
834
+ must request `redact_pii=True`. Regular file exports retain full data;
835
+ legacy streaming exports follow `--show-pii`.
831
836
 
832
837
  **Is the extraction deterministic?**
833
838
  Yes. Same input produces byte-identical output. Critical for
@@ -19,7 +19,7 @@
19
19
 
20
20
  <p align="center">
21
21
  <a href="https://github.com/sebastienrousseau/bankstatementparser/actions"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/bankstatementparser/quality-gates.yml?style=for-the-badge&logo=github" alt="Build" /></a>
22
- <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge&v=0.0.19" alt="PyPI" /></a>
22
+ <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/pyversions/bankstatementparser.svg?style=for-the-badge&v=0.0.20" alt="PyPI" /></a>
23
23
  <a href="https://pypi.org/project/bankstatementparser/"><img src="https://img.shields.io/pypi/dm/bankstatementparser.svg?style=for-the-badge" alt="PyPI Downloads" /></a>
24
24
  <a href="https://codecov.io/github/sebastienrousseau/bankstatementparser?branch=main"><img src="https://img.shields.io/codecov/c/github/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="Codecov" /></a>
25
25
  <a href="LICENSE"><img src="https://img.shields.io/github/license/sebastienrousseau/bankstatementparser?style=for-the-badge" alt="License" /></a>
@@ -215,9 +215,9 @@ Every row carries:
215
215
 
216
216
  - `source_method` — `"deterministic"`, `"llm"`, or `"vision"` for
217
217
  full audit provenance
218
- - `transaction_hash` — MD5 fingerprint of
219
- `date | normalized_description | amount`, ready for idempotent
220
- re-ingestion
218
+ - `transaction_hash` — versioned SHA-256 fingerprint scoped to account,
219
+ currency, date, description, amount, and available bank identity.
220
+ Rebuild persisted pre-v2 keys before re-ingestion
221
221
  - `confidence` — float between 0 and 1 for LLM rows, `None` for
222
222
  deterministic
223
223
  - `raw_source_text` — best-effort source-text slice for the v0.0.6
@@ -326,7 +326,7 @@ for the full surface.
326
326
  |---|---|
327
327
  | **Golden Rule verification** *(v0.0.5)* | Every result carries `opening + credits − debits == closing` status: `VERIFIED`, `DISCREPANCY`, `UNVERIFIABLE`, or `FAILED`. |
328
328
  | **Multi-currency verification** *(v0.0.8)* | `verify_balance_multi_currency()` groups transactions by currency and runs the Golden Rule independently per group — no more false `DISCREPANCY` on multi-currency statements. |
329
- | **Idempotent dedup** *(v0.0.5)* | Every `Transaction` carries a stable `transaction_hash` (MD5 of date + normalized description + amount). `Deduplicator.dedupe_by_hash()` makes incremental ingestion safe to re-run. |
329
+ | **Idempotent dedup** *(v0.0.5)* | Every `Transaction` carries a stable `transaction_hash` (versioned SHA-256 of account, currency, date, description, amount, and bank identity). `Deduplicator.dedupe_by_hash()` makes incremental ingestion safe to re-run. |
330
330
  | **Interactive review** *(v0.0.6)* | `--type review` CLI walks through discrepancies with accept/edit/skip/delete/quit. `IngestResult.to_json()` / `.from_json()` for stable round-trip with embedded audit trail. |
331
331
 
332
332
  ### Enrichment & export
@@ -345,17 +345,18 @@ for the full surface.
345
345
  |---|---|
346
346
  | **PII redaction** | Names, IBANs, and addresses masked by default — opt in with `--show-pii` |
347
347
  | **Secure ZIP** | `iter_secure_xml_entries()` rejects zip bombs, encrypted entries, and suspicious compression ratios |
348
- | **Tested** | 907 tests, coverage gated at 100% in CI, property-based fuzzing with Hypothesis |
348
+ | **Tested** | 1007 tests, coverage gated at 100% in CI, property-based fuzzing with Hypothesis |
349
349
 
350
350
  ---
351
351
 
352
352
  ## PII Redaction
353
353
 
354
354
  PII (names, IBANs, addresses) is **redacted by default** in
355
- console output and streaming mode.
355
+ CLI console output. Python parser methods return full records unless
356
+ `redact_pii=True` is supplied.
356
357
 
357
358
  ```python
358
- # Redacted by default
359
+ # Request redaction explicitly in Python
359
360
  for tx in parser.parse_streaming(redact_pii=True):
360
361
  print(tx) # Names and addresses show as ***REDACTED***
361
362
 
@@ -364,8 +365,9 @@ for tx in parser.parse_streaming(redact_pii=False):
364
365
  print(tx)
365
366
  ```
366
367
 
367
- File exports (CSV, JSON, Excel) always contain the full unredacted
368
- data.
368
+ Regular and hybrid file exports contain full records. Legacy CLI streaming
369
+ exports follow `--show-pii`; Python exports reflect the records supplied.
370
+ Choose redaction explicitly before sharing an exported file.
369
371
 
370
372
  ---
371
373
 
@@ -703,7 +705,7 @@ cleanly — see each companion's README for runnable examples.
703
705
  ## Project Layout
704
706
 
705
707
  ```text
706
- bankstatementparser/ Source code (38 modules)
708
+ bankstatementparser/ Source code (39 modules)
707
709
  bankstatementparser/hybrid/ PDF pipeline: orchestrator, llm_extractor, vision, scanner, ollama_direct, verification
708
710
  bankstatementparser/enrichment/ Categorizer, AccountMapper, EnrichedTransaction
709
711
  bankstatementparser/export/ hledger + beancount journal export, Apache Parquet columnar export
@@ -711,7 +713,7 @@ bankstatementparser/api.py REST API microservice (FastAPI)
711
713
  docs/compliance/ ISO 13485 validation, risk register, traceability matrix
712
714
  examples/ 14 deterministic + 9 hybrid runnable example scripts
713
715
  scripts/ SBOM generation, checksums, signature verification
714
- tests/ 907 tests (unit, integration, property-based, security, hybrid mocks)
716
+ tests/ 1007 tests (unit, integration, property-based, security, hybrid mocks)
715
717
  ```
716
718
 
717
719
  ---
@@ -783,8 +785,9 @@ No. Zero network calls. XML parsers enforce `no_network=True`. No
783
785
  cloud, no telemetry.
784
786
 
785
787
  **Is PII redacted automatically?**
786
- Yes. Names, IBANs, and addresses are masked by default in console
787
- output and streaming. File exports retain full data.
788
+ CLI console output masks personal fields by default. Python callers
789
+ must request `redact_pii=True`. Regular file exports retain full data;
790
+ legacy streaming exports follow `--show-pii`.
788
791
 
789
792
  **Is the extraction deterministic?**
790
793
  Yes. Same input produces byte-identical output. Critical for
@@ -31,9 +31,11 @@ from .analytics import (
31
31
  AnalyticsReport,
32
32
  AnomalyFinding,
33
33
  CashFlowMetrics,
34
+ DailyBalanceMetrics,
34
35
  RecurringCadence,
35
36
  RecurringPattern,
36
37
  analyze_statement_transactions,
38
+ compute_average_daily_balance,
37
39
  compute_cash_flow_summary,
38
40
  detect_anomalies_and_nsf,
39
41
  detect_recurring_transactions,
@@ -46,7 +48,7 @@ from .exceptions import (
46
48
  Pain001ParseError,
47
49
  ParserError,
48
50
  )
49
- from .export.parquet import export_parquet
51
+ from .export.parquet import export_parquet, export_parquet_stream
50
52
  from .field86_parser import Field86Structure, parse_field_86
51
53
  from .forensics import (
52
54
  ForensicFinding,
@@ -56,7 +58,7 @@ from .forensics import (
56
58
  )
57
59
  from .input_validator import InputValidator, ValidationError
58
60
  from .pain001_parser import Pain001Parser
59
- from .parallel import FileResult, parse_files_parallel
61
+ from .parallel import FileResult, iter_files_parallel, parse_files_parallel
60
62
  from .plugins import (
61
63
  discover_loaders,
62
64
  discover_writers,
@@ -89,7 +91,7 @@ from .zip_security import (
89
91
  #: so the conformance gate can compare it statically against
90
92
  #: pyproject.toml -- that comparison is the thing that catches drift, and
91
93
  #: a runtime lookup would make the two trivially equal and check nothing.
92
- __version__ = "0.0.19"
94
+ __version__ = "0.0.20"
93
95
 
94
96
  __all__ = [
95
97
  "AnalyticsReport",
@@ -100,6 +102,7 @@ __all__ = [
100
102
  "CamtParser",
101
103
  "CashFlowMetrics",
102
104
  "CsvStatementParser",
105
+ "DailyBalanceMetrics",
103
106
  "DeduplicationResult",
104
107
  "Deduplicator",
105
108
  "ExactDuplicateGroup",
@@ -129,6 +132,7 @@ __all__ = [
129
132
  "ZipXMLSource",
130
133
  "__version__",
131
134
  "analyze_statement_transactions",
135
+ "compute_average_daily_balance",
132
136
  "compute_cash_flow_summary",
133
137
  "create_parser",
134
138
  "detect_anomalies_and_nsf",
@@ -137,7 +141,9 @@ __all__ = [
137
141
  "discover_loaders",
138
142
  "discover_writers",
139
143
  "export_parquet",
144
+ "export_parquet_stream",
140
145
  "inspect_pdf_forensics",
146
+ "iter_files_parallel",
141
147
  "iter_secure_statement_entries",
142
148
  "iter_secure_xml_entries",
143
149
  "parse_field_86",