Skip to content

Impl

pipelines.extraction.shared.impl

Summary

Shared concrete implementations used by every extraction family.


Only genuinely family-agnostic ports live here:

  • ImplIngestPort : bytes/dict/Content/list/str -> content payload. This is what families receive as their first stage output.
  • ImplRawExpensePort : txn_dicts -> list[RawExpense] (terminal).

Every other implementation is homed in the family it belongs to (pdf/impl.py, email/impl.py, csv/impl.py, xlsx/impl.py).

Classes

ImplIngestPort

Bases: IngestPort

Materialize an ExtractionSource into a concrete content payload.

Attributes:

Name Type Description
source_type str

Source-type tag declared by the concrete root.

Functions
materialize
materialize(source)

Convert a raw source into a concrete content payload.

Parameters:

Name Type Description Default
source

Raw source (with raw, bytes, dict, list, or str).

required

Returns:

Type Description

Concrete payload: the source itself, {"raw": bytes}, a dict, a

list, or {"content": str} depending on the source shape.

ImplRawExpensePort

Bases: RawExpensePort

Build raw expense records from txn dicts (terminal stage).

Functions
build
build(txn_dicts)

Map structured txn dicts onto the raw-expense shape.

Parameters:

Name Type Description Default
txn_dicts

List of structured transaction dicts.

required

Returns:

Type Description

List of raw expense dicts keyed by date, amount, balance,

description, and direction.