Axis
pipelines.extraction.pdf.banks.axis
Summary
Axis bank-specific port implementations (pdf statement path).
Banks EXTEND the concrete Impl* classes — they never reinvent the ABC
contracts. Each Axis* class overrides only the behavior that DIFFERS from the
common Impl*; anything shared is inherited. The pipeline root
AxisPdfExtractionPipeline pins only the stage slots that differ.
Classes
AxisAmountBalancePort
Bases: ImplAmountBalancePort
Axis amount/balance leaf — pins the Axis number leaf.
Functions
adjust_balance
Adjust an OCR balance (no-op base).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
balance |
float
|
OCR balance. |
required |
line |
str
|
Transaction line. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The balance, unmodified. |
missing_number_candidates
Provide candidates for one-number lines (no-op base).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx |
The active |
required |
Returns:
| Type | Description |
|---|---|
|
None. |
resolve
Resolve (amount, balance) via ResolutionContext.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount |
OCR amount. |
required | |
balance |
OCR balance (adjusted first). |
required | |
prev_balance |
Previous transaction balance. |
required | |
line |
Raw transaction line. |
required | |
numbers |
Extracted numbers; default None. |
None
|
Returns:
| Type | Description |
|---|---|
|
(signed amount, resolved balance) tuple. |
AxisBucketFinderPort
Bases: ImplBucketFinderPort
Axis bucket finder — pins the Axis number leaf.
Functions
get_opening_balance_buckets
Divide raw lines into opening-balance buckets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines |
Raw text lines. |
required | |
limit_first |
Keep only the first bucket. |
False
|
|
line_offset |
Offset added to starting indices. |
0
|
Returns:
| Type | Description |
|---|---|
|
List of |
AxisDescPort
Bases: ImplDescPort
Axis description leaf — slices at UPI/IMPS/NEFT/ACH/2A markers.
Attributes:
| Name | Type | Description |
|---|---|---|
starters |
List[str]
|
Description starter markers. |
Functions
extract_description
Extract and clean the transaction description.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
description |
str
|
Raw description text. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Cleaned description. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
When no starters are configured. |
fix_ocr
Fix OCR artifacts in the description text (no-op base).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text |
str
|
Text to fix. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Fixed text. |
AxisNumberPort
Bases: ImplNumberPort
Axis number leaf — returns every number in the line.
Functions
get_numbers
Extract every cleaned number from the line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line |
str
|
Text line to scan. |
required |
Returns:
| Type | Description |
|---|---|
List[float]
|
List[float]: All cleaned numbers in the line. |
get_opening_balance
Return the last number as the opening balance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line |
str
|
Text line to scan. |
required |
Returns:
| Type | Description |
|---|---|
Optional[float]
|
Optional[float]: The last number, else |
AxisPdfExtractionPipeline
Bases: ImplPDFExtractionPipeline
Axis pdf graph root — pins the Axis txn-blocks and txn-dicts stages.
Attributes:
| Name | Type | Description |
|---|---|---|
txn_blocks |
AxisTxnBlocksPort
|
Axis txn-blocks stage. |
txn_dicts |
AxisTxnDictsPort
|
Axis txn-dicts stage. |
Functions
run
Run the pdf extraction chain end-to-end.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source |
Raw extraction source. |
required |
Returns:
| Type | Description |
|---|---|
|
List of raw expense records. |
AxisSplitterPort
Bases: ImplSplitterPort
Axis splitter — pins the Axis number leaf.
Functions
split_blocks
Split bucket lines into transaction blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines |
Bucket lines. |
required | |
has_header |
Whether a header precedes the rows. |
False
|
|
min_numbers |
Minimum numbers for a split. |
3
|
|
detect_date_ranges |
Detect date-range lines. |
False
|
Returns:
| Type | Description |
|---|---|
|
List of transaction block texts. |
AxisTransactionParserPort
Bases: ImplTransactionParserPort
Axis transaction parser — pins Axis-stage leaves and min_numbers=2.
Attributes:
| Name | Type | Description |
|---|---|---|
number |
AxisNumberPort
|
Axis number leaf. |
desc |
AxisDescPort
|
Axis description leaf. |
amount_balance |
AxisAmountBalancePort
|
Axis amount/balance leaf. |
min_numbers |
int
|
Minimum numbers for a block. |
Functions
parse
Parse a transaction block into a txn dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
txn_text |
Transaction block text. |
required | |
prev_date_str |
Previous transaction date string. |
required | |
prev_balance |
Running balance from the previous transaction. |
required |
Returns:
| Type | Description |
|---|---|
|
Txn dict, or |
AxisTxnBlocksPort
Bases: ImplTxnBlocksPort
Axis txn-blocks stage — header-scanning, date-range, min_numbers=2.
Attributes:
| Name | Type | Description |
|---|---|---|
bucket_finder |
AxisBucketFinderPort
|
Axis bucket finder. |
splitter |
AxisSplitterPort
|
Axis splitter. |
has_header |
bool
|
Header scan enabled. |
min_numbers |
int
|
Minimum numbers for a block. |
detect_date_ranges |
bool
|
Date-range detection enabled. |
Functions
extract
Extract txn blocks keyed by opening balance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw_lines |
Raw OCR text lines. |
required |
Returns:
| Type | Description |
|---|---|
|
Dict[float, List[str]]: Opening balance → block texts. |
AxisTxnDictsPort
Bases: ImplTxnDictsPort
Axis txn-dicts stage — pins the Axis transaction parser.
Functions
extract
Extract balance-chained txn dicts from blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
txn_blocks |
Opening balance → block texts. |
required |
Returns:
| Type | Description |
|---|---|
|
List of txn dicts. |