Skip to content

Impl

pipelines.extraction.email.impl

Summary

Concrete email-family implementations.


Faithful port of the OG email adaptors (domain/extraction/banks/{axis,icici}/email.py): a BeautifulSoup flatten of each HTML message into one text blob, then a bank-specific regex parse into a single transaction. ImplMessageReaderPort is shared; ImplMessageParserPort carries the shared description-slicing helper and the per-bank modules subclass it with their own regex/date rules.

Classes

ImplEmailExtractionPipeline

Bases: EmailExtractionPipeline

Concrete email graph root.

Attributes:

Name Type Description
pipeline str

Pipeline tag ("heuristic").

ingest ImplIngestPort

Ingest stage.

message_reader ImplMessageReaderPort

Message-reading stage.

message_parser ImplMessageParserPort

Message-parsing stage.

raw_expense ImplRawExpensePort

Terminal raw-expense stage.

Functions
run
run(source)

Run the email extraction chain end-to-end.

Parameters:

Name Type Description Default
source

Raw extraction source.

required

Returns:

Type Description

List of raw expense records.

ImplMessageParserPort

Bases: MessageParserPort

Base email parser: shared description-slicing; banks implement parse.

Attributes:

Name Type Description
description_starts List[str]

Markers where descriptions begin.

description_ends List[str]

Markers where descriptions end.

Functions
parse
parse(message: str)

Parse one message into a txn dict.

Parameters:

Name Type Description Default
message str

Flattened message text.

required

Raises:

Type Description
NotImplementedError

Always; subclasses must implement parse.

ImplMessageReaderPort

Bases: MessageReaderPort

Concrete message reader — HTML flattens each message to text.

Functions
extract
extract(content) -> List[str]

Flatten each message source into text.

Parameters:

Name Type Description Default
content

Content, list/tuple of sources, or a single source.

required

Returns:

Type Description
List[str]

List[str]: Flattened message texts.