{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"domain","text":""},{"location":"#modules","title":"Modules","text":""},{"location":"domain/","title":"Domain","text":""},{"location":"domain/#domain","title":"domain","text":""},{"location":"domain/#domain--summary","title":"Summary","text":"

The Expenses Service domain layer: business knowledge, models, ports, enrichment and fetch pipelines, with zero I/O.

The domain package holds the rules of the Expenses Service: pydantic models, abstract ports, and the enrichment/fetch pipeline logic. No module here touches the network, the database, or user-facing HTTP; all external effects flow through ports implemented by the infrastructure layer and injected at the composition root.

"},{"location":"domain/#domain--installation","title":"Installation","text":"

Install the Expenses Service with its development tooling:

pip install -e \".[dev]\"\n
"},{"location":"domain/#domain--quick-start","title":"Quick start","text":"

Resolve the lazily cached entity enrichment pipeline and run it over a minimal state payload:

```python\nfrom domain.enrichment.entity.pipeline import get_entity_pipeline\n\npipeline = get_entity_pipeline()\nresult = pipeline.enrich({\"candidate\": {\"flags\": []}, \"tags\": []})\n```\n
"},{"location":"domain/#domain--core-concepts","title":"Core concepts","text":""},{"location":"domain/#domain--notes","title":"Notes","text":"

Guarantees:

Lifecycle:

"},{"location":"domain/account/","title":"Account","text":""},{"location":"domain/account/#domain.account","title":"domain.account","text":""},{"location":"domain/account/#domain.account--summary","title":"Summary","text":"

Account domain: the Account aggregate, its Mongo document schema, and CRUD service wiring.

"},{"location":"domain/account/models/","title":"Models","text":""},{"location":"domain/account/models/#domain.account.models","title":"domain.account.models","text":""},{"location":"domain/account/models/#domain.account.models--summary","title":"Summary","text":"

Define the Account aggregate model shared by the service and storage layers.

"},{"location":"domain/account/models/#domain.account.models-classes","title":"Classes","text":""},{"location":"domain/account/models/#domain.account.models.Account","title":"Account","text":"

Bases: BaseModel

Account aggregate: banking details plus the owning user.

Attributes:

Name Type Description name str

Display name of the account.

number str

Account number; empty when unknown.

type str

Account kind, e.g. \"bank\".

currency str

Currency code the account operates in, e.g. \"INR\".

owner User

User that owns the account.

"},{"location":"domain/account/ports/","title":"Ports","text":""},{"location":"domain/account/ports/#domain.account.ports","title":"domain.account.ports","text":""},{"location":"domain/account/ports/#domain.account.ports--summary","title":"Summary","text":"

Port wiring for the account aggregate: Mongo repository and CRUD service wiring.

"},{"location":"domain/account/ports/db/","title":"Db","text":""},{"location":"domain/account/ports/db/#domain.account.ports.db","title":"domain.account.ports.db","text":""},{"location":"domain/account/ports/db/#domain.account.ports.db--summary","title":"Summary","text":"

Mongo persistence for accounts: document schema and repository factory.

"},{"location":"domain/account/ports/db/#domain.account.ports.db-classes","title":"Classes","text":""},{"location":"domain/account/ports/db/#domain.account.ports.db.AccountDocument","title":"AccountDocument","text":"

Bases: Account, BaseDocument

Mongo document form of :class:Account with a populated owner reference.

Attributes:

Name Type Description owner UserDocument

Populated owner document stored as a reference.

"},{"location":"domain/account/ports/db/#domain.account.ports.db-functions","title":"Functions","text":""},{"location":"domain/account/ports/db/#domain.account.ports.db.create_account_repo","title":"create_account_repo","text":"
create_account_repo(user_repo: Any = None)\n

Create a Mongo-backed account repository wired for owner population.

Parameters:

Name Type Description Default user_repo Any

User repository used to populate the owner reference.

None

Returns:

Name Type Description Any

Mongo-backed account repository configured with a replace-owner population rule.

"},{"location":"domain/account/ports/service/","title":"Service","text":""},{"location":"domain/account/ports/service/#domain.account.ports.service","title":"domain.account.ports.service","text":""},{"location":"domain/account/ports/service/#domain.account.ports.service--summary","title":"Summary","text":"

CRUD service wiring for the account aggregate via the hexa container.

"},{"location":"domain/account/ports/service/#domain.account.ports.service-classes","title":"Classes","text":""},{"location":"domain/account/ports/service/#domain.account.ports.service.AccountCrudsService","title":"AccountCrudsService","text":"

Bases: CrudsServiceAdaptor[Account, AccountDocument]

Account CRUD service resolving :class:Account documents from a repo.

Notes

Instances are created by :func:get_account_service. The model and schema class attributes bind the domain model and its document type.

"},{"location":"domain/account/ports/service/#domain.account.ports.service-functions","title":"Functions","text":""},{"location":"domain/account/ports/service/#domain.account.ports.service.get_account_service","title":"get_account_service","text":"
get_account_service(repo) -> AccountCrudsService\n

Build an account CRUD service wired to repo.

Parameters:

Name Type Description Default repo Any

Mongo-backed account repository from :func:create_account_repo.

required

Returns:

Name Type Description AccountCrudsService AccountCrudsService

Ready-to-use account CRUD service.

"},{"location":"domain/enrichment/","title":"Enrichment","text":""},{"location":"domain/enrichment/#domain.enrichment","title":"domain.enrichment","text":""},{"location":"domain/enrichment/#domain.enrichment--summary","title":"Summary","text":"

Enrichment domain: rule-driven pipelines that resolve payee entities and tags from raw expense descriptions, backed by YAML pattern registries.

Provides the shared pattern data models (models), the registry-aware pipeline node base (nodes), and two pipeline families: entity (entity/payee resolution) and tags (flag and tag attachment).

"},{"location":"domain/enrichment/#domain.enrichment--notes","title":"Notes","text":"

Guarantees:

Lifecycle:

"},{"location":"domain/enrichment/exceptions/","title":"Exceptions","text":""},{"location":"domain/enrichment/exceptions/#domain.enrichment.exceptions","title":"domain.enrichment.exceptions","text":""},{"location":"domain/enrichment/exceptions/#domain.enrichment.exceptions--summary","title":"Summary","text":"

Exception types raised by the enrichment domain when a tag alias cannot be resolved to a seeded tag.

"},{"location":"domain/enrichment/exceptions/#domain.enrichment.exceptions--notes","title":"Notes","text":"

Guarantees:

"},{"location":"domain/enrichment/exceptions/#domain.enrichment.exceptions-classes","title":"Classes","text":""},{"location":"domain/enrichment/exceptions/#domain.enrichment.exceptions.NewTagFoundError","title":"NewTagFoundError","text":"
NewTagFoundError(tag_name: str)\n

Bases: Exception

Raised when an alias matches a tag name that has no seed entry.

Attributes:

Name Type Description tag_name str

The tag name that matched but was not found.

message str

The message text passed to the exception base class, prompting manual seeding.

"},{"location":"domain/enrichment/models/","title":"Models","text":""},{"location":"domain/enrichment/models/#domain.enrichment.models","title":"domain.enrichment.models","text":""},{"location":"domain/enrichment/models/#domain.enrichment.models--summary","title":"Summary","text":"

Pydantic models for enrichment patterns: a discriminated union of pattern payloads (Pattern) and a versioned PatternRegistry lookup table compiled by the pipeline loaders.

"},{"location":"domain/enrichment/models/#domain.enrichment.models--notes","title":"Notes","text":"

Guarantees:

Lifecycle:

"},{"location":"domain/enrichment/models/#domain.enrichment.models-classes","title":"Classes","text":""},{"location":"domain/enrichment/models/#domain.enrichment.models.ArrayPattern","title":"ArrayPattern","text":"

Bases: BasePattern

Ordered list pattern, e.g. negative candidate lists.

Attributes:

Name Type Description type Literal[ARRAY]

Constant marker for this shape.

array List

The ordered list payload.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.BasePattern","title":"BasePattern","text":"

Bases: BaseModel

Base class for all pattern payloads.

Attributes:

Name Type Description type PatternType

Discriminator identifying the concrete pattern shape.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.KeywordsPattern","title":"KeywordsPattern","text":"

Bases: BasePattern

Keyword list pattern.

Attributes:

Name Type Description type Literal[KEYWORDS]

Constant marker for this shape.

items List[str]

Keywords that match, in any order.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.MappingPattern","title":"MappingPattern","text":"

Bases: BasePattern

Key/value mapping pattern.

Attributes:

Name Type Description type Literal[MAPPING]

Constant marker for this shape.

mapping Dict[str, Union[str, MappingValue, List]]

Mapping keys to bare strings, structured values, or lists.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.MappingValue","title":"MappingValue","text":"

Bases: BaseModel

A single mapping entry value carrying an id and display name.

Attributes:

Name Type Description id str

Stable identifier for the mapped value.

name str

Human-readable display name.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry","title":"PatternRegistry","text":"

Bases: BaseModel

Versioned registry of named enrichment patterns.

Accessors dispatch on the runtime pattern type and raise TypeError when the stored pattern has a different shape than requested.

Attributes:

Name Type Description version int

Registry schema version.

patterns Dict[str, Pattern]

Named patterns keyed by their registry name.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry-functions","title":"Functions","text":""},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry.array","title":"array","text":"
array(name: str) -> List\n

Return the array payload of a named ArrayPattern.

Parameters:

Name Type Description Default name str

Registry name of the pattern.

required

Returns:

Name Type Description List List

The pattern's array payload.

Raises:

Type Description TypeError

If the stored pattern is not an ArrayPattern.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry.get","title":"get","text":"
get(name: str) -> Pattern\n

Return the pattern registered under name.

Parameters:

Name Type Description Default name str

Registry name of the pattern.

required

Returns:

Name Type Description Pattern Pattern

The stored pattern payload.

Raises:

Type Description KeyError

If no pattern is registered under name.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry.keywords","title":"keywords","text":"
keywords(name: str) -> List[str]\n

Return the keyword items of a named KeywordsPattern.

Parameters:

Name Type Description Default name str

Registry name of the pattern.

required

Returns:

Type Description List[str]

List[str]: The pattern's item keywords.

Raises:

Type Description TypeError

If the stored pattern is not a KeywordsPattern.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry.mapping","title":"mapping","text":"
mapping(name: str) -> Dict[str, str]\n

Return the mapping of a named MappingPattern.

Parameters:

Name Type Description Default name str

Registry name of the pattern.

required

Returns:

Type Description Dict[str, str]

Dict[str, str]: The pattern's key/value mapping.

Raises:

Type Description TypeError

If the stored pattern is not a MappingPattern.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry.regex","title":"regex","text":"
regex(name: str) -> re.Pattern\n

Return the compiled regex of a named RegexPattern.

Parameters:

Name Type Description Default name str

Registry name of the pattern.

required

Returns:

Type Description Pattern

re.Pattern: The pattern's compiled regex.

Raises:

Type Description TypeError

If the stored pattern is not a RegexPattern.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry.regex_list","title":"regex_list","text":"
regex_list(name: str) -> List[re.Pattern]\n

Return compiled regexes of a named RegexListPattern.

Parameters:

Name Type Description Default name str

Registry name of the pattern.

required

Returns:

Type Description List[Pattern]

List[re.Pattern]: The pattern's compiled regexes.

Raises:

Type Description TypeError

If the stored pattern is not a RegexListPattern.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry.regex_map","title":"regex_map","text":"
regex_map(name: str) -> List[Tuple[re.Pattern, str]]\n

Return compiled regex/value pairs of a RegexMapPattern.

Parameters:

Name Type Description Default name str

Registry name of the pattern.

required

Returns:

Type Description List[Tuple[Pattern, str]]

List[Tuple[re.Pattern, str]]: Compiled regex and value pairs.

Raises:

Type Description TypeError

If the stored pattern is not a RegexMapPattern.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry.rules","title":"rules","text":"
rules(name: str) -> List[Dict]\n

Return the rule list of a named RulesPattern.

Parameters:

Name Type Description Default name str

Registry name of the pattern.

required

Returns:

Type Description List[Dict]

List[Dict]: The pattern's rule dicts.

Raises:

Type Description TypeError

If the stored pattern is not a RulesPattern.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternRegistry.template","title":"template","text":"
template(name: str) -> str\n

Return the template string of a named TemplatePattern.

Parameters:

Name Type Description Default name str

Registry name of the pattern.

required

Returns:

Name Type Description str str

The pattern's template string.

Raises:

Type Description TypeError

If the stored pattern is not a TemplatePattern.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.PatternType","title":"PatternType","text":"

Bases: str, Enum

Discriminator values selecting a concrete pattern shape.

Attributes:

Name Type Description KEYWORDS PatternType

Keyword list pattern (KeywordsPattern).

MAPPING PatternType

Key/value mapping pattern (MappingPattern).

ARRAY PatternType

Plain array pattern (ArrayPattern).

RULES PatternType

Rule list pattern (RulesPattern).

REGEX PatternType

Single regex pattern (RegexPattern).

REGEX_LIST PatternType

List of regexes (RegexListPattern).

REGEX_MAP PatternType

Regex-to-value mapping (RegexMapPattern).

TEMPLATE PatternType

String template pattern (TemplatePattern).

"},{"location":"domain/enrichment/models/#domain.enrichment.models.RegexListPattern","title":"RegexListPattern","text":"

Bases: BasePattern

List of regular expressions pattern.

Attributes:

Name Type Description type Literal[REGEX_LIST]

Constant marker for this shape.

patterns List[str]

Regex sources compiled by compile_all.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.RegexListPattern-functions","title":"Functions","text":""},{"location":"domain/enrichment/models/#domain.enrichment.models.RegexListPattern.compile_all","title":"compile_all","text":"
compile_all(flags: int = re.IGNORECASE) -> List[re.Pattern]\n

Compile every regex source in this pattern.

Parameters:

Name Type Description Default flags int

Regex flags passed to re.compile; defaults to re.IGNORECASE.

IGNORECASE

Returns:

Type Description List[Pattern]

List[re.Pattern]: One compiled regex per source.

Raises:

Type Description error

If any source is not valid regex.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.RegexMapPattern","title":"RegexMapPattern","text":"

Bases: BasePattern

Regex-to-value mapping pattern.

Attributes:

Name Type Description type Literal[REGEX_MAP]

Constant marker for this shape.

mapping Dict[str, str]

Regex sources mapped to match values.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.RegexMapPattern-functions","title":"Functions","text":""},{"location":"domain/enrichment/models/#domain.enrichment.models.RegexMapPattern.compile_all","title":"compile_all","text":"
compile_all(\n    flags: int = re.IGNORECASE,\n) -> List[Tuple[re.Pattern, str]]\n

Compile every regex in the mapping paired with its value.

Parameters:

Name Type Description Default flags int

Regex flags passed to re.compile; defaults to re.IGNORECASE.

IGNORECASE

Returns:

Type Description List[Tuple[Pattern, str]]

List[Tuple[re.Pattern, str]]: Compiled regex and value pairs.

Raises:

Type Description error

If any source is not valid regex.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.RegexPattern","title":"RegexPattern","text":"

Bases: BasePattern

Single regular expression pattern.

Attributes:

Name Type Description type Literal[REGEX]

Constant marker for this shape.

pattern str

Regex source used to compile a matcher.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.RegexPattern-functions","title":"Functions","text":""},{"location":"domain/enrichment/models/#domain.enrichment.models.RegexPattern.compile","title":"compile","text":"
compile(flags: int = re.IGNORECASE) -> re.Pattern\n

Compile this pattern's regex source.

Parameters:

Name Type Description Default flags int

Regex flags passed to re.compile; defaults to re.IGNORECASE.

IGNORECASE

Returns:

Type Description Pattern

re.Pattern: The compiled regex.

Raises:

Type Description error

If pattern is not valid regex.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.RulesPattern","title":"RulesPattern","text":"

Bases: BasePattern

List of rule dictionaries pattern.

Attributes:

Name Type Description type Literal[RULES]

Constant marker for this shape.

rules List[Dict]

Rule dicts consumed by flag/tag rule evaluators.

"},{"location":"domain/enrichment/models/#domain.enrichment.models.TemplatePattern","title":"TemplatePattern","text":"

Bases: BasePattern

String template pattern.

Attributes:

Name Type Description type Literal[TEMPLATE]

Constant marker for this shape.

format str

Template string returned by the registry accessor.

"},{"location":"domain/enrichment/nodes/","title":"Nodes","text":""},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes","title":"domain.enrichment.nodes","text":""},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes--summary","title":"Summary","text":"

Shared dagpipe nodes for the enrichment pipelines: a registry-aware node base class plus the amount-based flag evaluator.

Nodes resolve pipeline state by forking into enriched states; concrete node sets live in the entity and tags subpackages.

"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes--notes","title":"Notes","text":"

Guarantees:

Lifecycle:

"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes-classes","title":"Classes","text":""},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.AmountBasedFlagNode","title":"AmountBasedFlagNode","text":"

Bases: RegistryNode

Attach amount-comparison flags derived from raw.amount.

Evaluates the configured amount-based flag mapping (an array of flag tokens such as amount_greater_than_500) against the absolute amount in the state and appends each matching flag to candidate.flags.

Notes

Flags already present on the candidate are left untouched. When new flags are added the node forks the state with the updated flag list; otherwise it yields the state unchanged. Encoded values use underscores for the decimal point (e.g. amount_equal_to_5_00).

"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.AmountBasedFlagNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.AmountBasedFlagNode.amount_based_flag_mapping","title":"amount_based_flag_mapping property","text":"
amount_based_flag_mapping\n

Return the configured amount-based flag tokens.

Returns:

Type Description

The array of flag tokens from the mapped registry pattern.

"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.AmountBasedFlagNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.AmountBasedFlagNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.AmountBasedFlagNode.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Evaluate amount-based flags and yield updated states.

Parameters:

Name Type Description Default state State

Pipeline state carrying raw.amount and candidate.flags.

required

Yields:

Name Type Description State Iterable[State]

The updated state with new amount flags, or the input

Iterable[State]

state unchanged when nothing matched.

"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.AmountBasedFlagNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.AmountBasedFlagNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.RegistryNode","title":"RegistryNode","text":"

Bases: Node, ABC

Base node for enrichment pipelines.

Subclasses receive a PatternRegistry and a node-specific config dict from the pipeline loader, and read their decision inputs through registry accessors.

Notes

set_registry and set_config install instance-level values; the class defaults them to None until a loader wires a node.

"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.RegistryNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.RegistryNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.RegistryNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.RegistryNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/nodes/#domain.enrichment.nodes.RegistryNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/entity/","title":"Entity","text":""},{"location":"domain/enrichment/entity/#domain.enrichment.entity","title":"domain.enrichment.entity","text":""},{"location":"domain/enrichment/entity/#domain.enrichment.entity--summary","title":"Summary","text":"

Entity enrichment: pipeline loading and entity resolution nodes.

The loader compiles the packaged pipeline.yaml and patterns/*.yaml resources into a cached dagpipe pipeline; the resolution nodes turn raw descriptions into a payee entity (id, name, type, logo) through aliases, normalized signals, candidates, and flag-driven rules.

"},{"location":"domain/enrichment/entity/identity/","title":"Identity","text":""},{"location":"domain/enrichment/entity/identity/#domain.enrichment.entity.identity","title":"domain.enrichment.entity.identity","text":""},{"location":"domain/enrichment/entity/identity/#domain.enrichment.entity.identity--summary","title":"Summary","text":"

Identity helpers for entity enrichment: text normalization, entity id derivation, candidate canonicalization, and entity state payload construction.

"},{"location":"domain/enrichment/entity/identity/#domain.enrichment.entity.identity-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/identity/#domain.enrichment.entity.identity.build_entity","title":"build_entity","text":"
build_entity(\n    name: str,\n    entity_type: str = \"merchant\",\n    entity_logo: str | None = None,\n) -> dict\n

Build the entity payload spread into pipeline state.

Parameters:

Name Type Description Default name str

Entity display name.

required entity_type str

Entity type, defaults to \"merchant\".

'merchant' entity_logo str | None

Logo URL/path, or None.

None

Returns:

Name Type Description dict dict

A payload mapping the entity.* keys accepted by

dict

dagpipe state forks.

"},{"location":"domain/enrichment/entity/identity/#domain.enrichment.entity.identity.canonicalize_candidate","title":"canonicalize_candidate","text":"
canonicalize_candidate(candidate: str | None) -> str | None\n

Canonicalize a candidate value for comparisons.

Parameters:

Name Type Description Default candidate str | None

Raw candidate string.

required

Returns:

Type Description str | None

str | None: The normalized candidate key, or None for falsy

str | None

input.

"},{"location":"domain/enrichment/entity/identity/#domain.enrichment.entity.identity.normalize_key","title":"normalize_key","text":"
normalize_key(text: str | None) -> str | None\n

Normalize arbitrary text to a comparison key.

Applies NFKC unicode normalization, lower-cases, and strips surrounding whitespace.

Parameters:

Name Type Description Default text str | None

Text to normalize; None passes through.

required

Returns:

Type Description str | None

str | None: The normalized key, or None for None input.

"},{"location":"domain/enrichment/entity/identity/#domain.enrichment.entity.identity.to_entity_id","title":"to_entity_id","text":"
to_entity_id(name: str | None) -> str | None\n

Derive a stable slug id from a name.

Empty/falsy names yield None. Non-alphanumeric runs are replaced with a single underscore and edge underscores are trimmed.

Parameters:

Name Type Description Default name str | None

Entity name to slugify.

required

Returns:

Type Description str | None

str | None: The slug id, or None when name is falsy.

"},{"location":"domain/enrichment/entity/pipeline/","title":"Pipeline","text":""},{"location":"domain/enrichment/entity/pipeline/#domain.enrichment.entity.pipeline","title":"domain.enrichment.entity.pipeline","text":""},{"location":"domain/enrichment/entity/pipeline/#domain.enrichment.entity.pipeline--summary","title":"Summary","text":"

Loader for the entity enrichment pipeline.

Compiles the packaged pipeline.yaml plus the patterns/*.yaml registries into a cached dagpipe pipeline, wiring every registry-aware node with its registry and node config.

"},{"location":"domain/enrichment/entity/pipeline/#domain.enrichment.entity.pipeline-classes","title":"Classes","text":""},{"location":"domain/enrichment/entity/pipeline/#domain.enrichment.entity.pipeline-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/pipeline/#domain.enrichment.entity.pipeline.get_entity_pipeline","title":"get_entity_pipeline","text":"
get_entity_pipeline()\n

Return the lazily cached entity pipeline.

Builds (once) and reuses the pipeline across calls.

Returns:

Type Description

The cached entity pipeline instance.

"},{"location":"domain/enrichment/entity/pipeline/#domain.enrichment.entity.pipeline.load","title":"load","text":"
load() -> Pipeline\n

Load and wire the entity enrichment pipeline.

Reads the packaged pipeline.yaml, builds the pipeline graph, and installs the merged pattern registry and per-node config onto each node that supports it.

Returns:

Name Type Description Pipeline Pipeline

The wired dagpipe pipeline.

Raises:

Type Description FileNotFoundError

If the packaged pipeline.yaml is missing.

"},{"location":"domain/enrichment/entity/resolver/","title":"Resolver","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver","title":"domain.enrichment.entity.resolver","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver--summary","title":"Summary","text":"

Entity resolution nodes for the enrichment pipeline.

Each node advances the entity candidate: alias-based entity assignment, description normalization, candidate extraction, flag-based candidate handling, flag-driven entity setting, and a final fallback.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver-classes","title":"Classes","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.CandidateBasedFlagsNode","title":"CandidateBasedFlagsNode","text":"

Bases: RegistryNode

Attach candidate-keyword flags derived from the candidate value.

For each flag in the configured mapping, when any keyword appears in the (lower-cased) candidate value and the flag is not already present, the flag is appended to candidate.flags.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.CandidateBasedFlagsNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.CandidateBasedFlagsNode.candidate_based_flag_mapping","title":"candidate_based_flag_mapping property","text":"
candidate_based_flag_mapping\n

Return the candidate-keyword flag mapping.

Returns:

Type Description

The mapping dict from the registry.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.CandidateBasedFlagsNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.CandidateBasedFlagsNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.CandidateBasedFlagsNode.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Append matched candidate-keyword flags to the state.

Parameters:

Name Type Description Default state State

Pipeline state with a candidate value and flags.

required

Yields:

Name Type Description State Iterable[State]

The updated state, or the input state when no flag

Iterable[State]

changed.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.CandidateBasedFlagsNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.CandidateBasedFlagsNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode","title":"EntityAliasNode","text":"

Bases: RegistryNode

Resolve an entity directly from alias regexes.

When entity.name is already set, or no candidate value exists, the state passes through unchanged. Otherwise the first alias regex that matches the candidate produces the entity payload with a confidence delta of -0.25 and the resolved_by=entity_alias metadata marker.

Notes

A fork is yielded immediately on the first matching alias; no further aliases are considered.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode.default_logo_mapping","title":"default_logo_mapping property","text":"
default_logo_mapping\n

Return the default logo mapping by entity type.

Returns:

Type Description

The mapping dict from the registry, defaulting to

ENTITY_DEFAULT_LOGO_MAPPING.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode.entity_alias_regex","title":"entity_alias_regex property","text":"
entity_alias_regex\n

Return the compiled alias regex/value pairs.

Returns:

Type Description

The compiled regex-map entries from the registry.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode.entity_type_mapping","title":"entity_type_mapping property","text":"
entity_type_mapping\n

Return the entity-type mapping for assigned entities.

Returns:

Type Description

The mapping dict from the registry, defaulting to

ENTITY_TYPE_MAPPING.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Assign the entity from the first alias matching the candidate.

Parameters:

Name Type Description Default state State

Pipeline state with candidate.value.

required

Yields:

Name Type Description State Iterable[State]

The forked state with the entity payload, or the input

Iterable[State]

state when nothing matched.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.EntityAliasNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.ExtractCandidatesNode","title":"ExtractCandidatesNode","text":"

Bases: RegistryNode

Extract entity candidates from the normalized signals.

Produces a candidate per regex match and per /-split part; when nothing matched, falls back to canonicalized space-split items and finally to an empty (-0.75) fork. Negative candidates are skipped throughout.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.ExtractCandidatesNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.ExtractCandidatesNode.candidate_regex","title":"candidate_regex property","text":"
candidate_regex\n

Return the compiled candidate extraction regexes.

Returns:

Type Description

The compiled regex list from the registry.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.ExtractCandidatesNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.ExtractCandidatesNode.negative_candidates","title":"negative_candidates property","text":"
negative_candidates\n

Return the negative candidate tokens to skip.

Returns:

Type Description

The array of negative candidate strings from the registry.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.ExtractCandidatesNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.ExtractCandidatesNode.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Yield one state fork per extracted candidate.

Parameters:

Name Type Description Default state State

Pipeline state with populated signals.

required

Yields:

Name Type Description State Iterable[State]

A forked state per candidate, each carrying

Iterable[State]

candidate.value; or a single -0.75 fork when no

Iterable[State]

candidate was found.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.ExtractCandidatesNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.ExtractCandidatesNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.FallbackNode","title":"FallbackNode","text":"

Bases: RegistryNode

Assign a last-resort entity when nothing resolved.

Valid candidates become the merchant (-0.25); otherwise the entity falls back to Unknown with type other (-0.50), using the default logo paths.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.FallbackNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.FallbackNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.FallbackNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.FallbackNode.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Fork the state with a fallback entity.

Parameters:

Name Type Description Default state State

Pipeline state with an optional candidate value.

required

Yields:

Name Type Description State Iterable[State]

The forked state with the fallback entity payload.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.FallbackNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.FallbackNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.NormalizeDescriptionNode","title":"NormalizeDescriptionNode","text":"

Bases: RegistryNode

Normalize the raw description into signal fields.

Removes the amount/balance number sequences from the description and populates signals.raw, signals.items (space-split) and signals.parts (slash-split) for downstream nodes.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.NormalizeDescriptionNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.NormalizeDescriptionNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.NormalizeDescriptionNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.NormalizeDescriptionNode.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Fork the state with the normalized description signals.

Parameters:

Name Type Description Default state State

Pipeline state with raw.description, raw.amount and raw.balance.

required

Yields:

Name Type Description State Iterable[State]

The forked state carrying the derived signals.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.NormalizeDescriptionNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.NormalizeDescriptionNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode","title":"SetEntityNode","text":"

Bases: RegistryNode

Set the entity from flag-based entity rules.

Each rule config may carry all/any conditions over the candidate flags; the first satisfied rule emits its payee as the entity with a resolved_by=set_entity marker. When no rule fires and no entity exists yet, a -0.25 fork is yielded.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode.default_logo_mapping","title":"default_logo_mapping property","text":"
default_logo_mapping\n

Return the default logo mapping by entity type.

Returns:

Type Description

The mapping dict from the registry, defaulting to

ENTITY_DEFAULT_LOGO_MAPPING.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode.entity_type_mapping","title":"entity_type_mapping property","text":"
entity_type_mapping\n

Return the entity-type mapping for assigned entities.

Returns:

Type Description

The mapping dict from the registry, defaulting to

ENTITY_TYPE_MAPPING.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode.flags_based_entity_rules","title":"flags_based_entity_rules property","text":"
flags_based_entity_rules\n

Return the flag-based entity rules.

Returns:

Type Description

The rule list from the registry.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Apply flag-based entity rules and fork the entity state.

Parameters:

Name Type Description Default state State

Pipeline state with candidate flags.

required

Yields:

Name Type Description State Iterable[State]

The forked state with the entity payload when a rule

Iterable[State]

fires; the input state when an entity already exists; or a

Iterable[State]

-0.25 fork otherwise.

"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver.SetEntityNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/entity/resolver/#domain.enrichment.entity.resolver-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/utils/","title":"Utils","text":""},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils","title":"domain.enrichment.entity.utils","text":""},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils--summary","title":"Summary","text":"

Text utilities for entity enrichment: description normalization, number sequence removal, candidate validity checks, and candidate extraction.

"},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils-functions","title":"Functions","text":""},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils.extract_candidates","title":"extract_candidates","text":"
extract_candidates(\n    description: str,\n    candidate_regexes: Iterable[re.Pattern],\n) -> List[str]\n

Extract validated payee candidates from a description.

For each regex, reads the payee named group, checks validity, and appends the normalized key.

Parameters:

Name Type Description Default description str

Description text to scan.

required candidate_regexes Iterable[Pattern]

Compiled regexes exposing a payee named group.

required

Returns:

Type Description List[str]

List[str]: Validated, normalized candidate keys.

"},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils.is_valid_candidate","title":"is_valid_candidate","text":"
is_valid_candidate(candidate: str) -> bool\n

Check whether a string is a plausible entity candidate.

Rejects empty/short strings, pure-hex strings, and pure digits (unless exactly 10 digits); requires at least one letter.

Parameters:

Name Type Description Default candidate str

Candidate string to validate.

required

Returns:

Name Type Description bool bool

True when the candidate is usable.

"},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils.lookup_mapping","title":"lookup_mapping","text":"
lookup_mapping(candidate: str, mapping: dict)\n

Look up candidate display names in a mapping.

A normalized exact key match returns the single mapped name; otherwise returns every mapped name whose key is a substring of the candidate. Falsy candidates return (None, None).

Parameters:

Name Type Description Default candidate str

Candidate to look up.

required mapping dict

Mapping of normalized keys to MappingValue entries.

required

Returns:

Type Description

A single matching name, a list of substring matches, or

(None, None) for falsy candidates.

"},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils.normalize_description","title":"normalize_description","text":"
normalize_description(text: str) -> str\n

Normalize a description for downstream matching.

Strips whitespace, drops page N of M markers, OCR hex blobs, separators, @ and ., collapses runs of spaces, and lower-cases the result.

Parameters:

Name Type Description Default text str

Raw description text.

required

Returns:

Name Type Description str str

The normalized, lower-cased description.

"},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils.normalize_money_str","title":"normalize_money_str","text":"
normalize_money_str(x) -> str\n

Format a number as a two-decimal string.

Parameters:

Name Type Description Default x

Value coercible to float.

required

Returns:

Name Type Description str str

The number formatted to two decimals.

"},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils.normalize_person_handle","title":"normalize_person_handle","text":"
normalize_person_handle(handle: str) -> str\n

Normalize a UPI-style handle into a display name.

Strips the @ suffix and trailing digits, capitalizes word pieces (preserving known acronyms), and removes bracket characters; returns \"\" when the result is purely hex-like.

Parameters:

Name Type Description Default handle str

Raw handle string.

required

Returns:

Name Type Description str str

The normalized person name (possibly empty).

"},{"location":"domain/enrichment/entity/utils/#domain.enrichment.entity.utils.remove_number_sequence","title":"remove_number_sequence","text":"
remove_number_sequence(\n    text: str, amt: str, bal: str\n) -> str\n

Strip digit runs that echo the amount/balance.

Builds a regex from the concatenated amount+balance digits and removes candidate runs within one edit of that digit string, collapsing the remaining whitespace.

Parameters:

Name Type Description Default text str

Description text to clean.

required amt str

Transaction amount, formatted via normalize_money_str.

required bal str

Balance, formatted via normalize_money_str.

required

Returns:

Name Type Description str str

The cleaned description with echoed numbers removed.

"},{"location":"domain/enrichment/tags/","title":"Tags","text":""},{"location":"domain/enrichment/tags/#domain.enrichment.tags","title":"domain.enrichment.tags","text":""},{"location":"domain/enrichment/tags/#domain.enrichment.tags--summary","title":"Summary","text":"

Tag enrichment: pipeline loading and flag/tag nodes.

The loader compiles the packaged tag pipeline and pattern resources; the nodes attach entity-based flags and apply flag-based tag rules to a resolved entity.

"},{"location":"domain/enrichment/tags/flags/","title":"Flags","text":""},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags","title":"domain.enrichment.tags.flags","text":""},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags--summary","title":"Summary","text":"

Flag and tag nodes for the tag enrichment pipeline.

Rules nodes derive entity-based flags from the resolved entity and apply flag-based rules to attach tags.

"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags-classes","title":"Classes","text":""},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.EntityBasedFlagsNode","title":"EntityBasedFlagsNode","text":"

Bases: RegistryNode

Attach entity-matched flags and reset the tag list.

Keeps only the amount_* candidate flags and, for each entity-based flag whose keyword equals the lower-cased entity name, appends the flag. Always forks with the final flag list and an empty tags list.

"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.EntityBasedFlagsNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.EntityBasedFlagsNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.EntityBasedFlagsNode.entity_based_flag_mapping","title":"entity_based_flag_mapping property","text":"
entity_based_flag_mapping\n

Return the entity-based flag mapping.

Returns:

Type Description

The mapping dict from the registry.

"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.EntityBasedFlagsNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.EntityBasedFlagsNode.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Apply entity-matched flags to the state.

Parameters:

Name Type Description Default state State

Pipeline state with an entity name and candidate flags.

required

Yields:

Name Type Description State Iterable[State]

The forked state with updated flags and empty tags.

"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.EntityBasedFlagsNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.EntityBasedFlagsNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.SetTagsNode","title":"SetTagsNode","text":"

Bases: RegistryNode

Assign tags from flag-based tag rules.

For each rule with all/any conditions satisfied by the candidate flags, appends the rule's emitted tags to the current tag list (avoiding duplicates) and forks when anything changed.

"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.SetTagsNode-attributes","title":"Attributes","text":""},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.SetTagsNode.config","title":"config property","text":"
config\n

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.SetTagsNode.flags_based_tags_rules","title":"flags_based_tags_rules property","text":"
flags_based_tags_rules\n

Return the flag-based tag rules.

Returns:

Type Description

The rule list from the registry.

"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.SetTagsNode-functions","title":"Functions","text":""},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.SetTagsNode.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Apply flag-based tag rules to the state.

Parameters:

Name Type Description Default state State

Pipeline state with candidate flags and current tags.

required

Yields:

Name Type Description State Iterable[State]

The updated state, or the input state when no tag

Iterable[State]

changed.

"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.SetTagsNode.set_config","title":"set_config","text":"
set_config(config)\n

Install the node-specific config on this node.

Parameters:

Name Type Description Default config

The config dict read from the pipeline YAML for this node's id.

required"},{"location":"domain/enrichment/tags/flags/#domain.enrichment.tags.flags.SetTagsNode.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Install the pattern registry on this node.

Parameters:

Name Type Description Default registry

The PatternRegistry instance to use for lookups.

required"},{"location":"domain/enrichment/tags/pipeline/","title":"Pipeline","text":""},{"location":"domain/enrichment/tags/pipeline/#domain.enrichment.tags.pipeline","title":"domain.enrichment.tags.pipeline","text":""},{"location":"domain/enrichment/tags/pipeline/#domain.enrichment.tags.pipeline--summary","title":"Summary","text":"

Loader for the tag enrichment pipeline.

Compiles the packaged tag pipeline.yaml plus patterns/*.yaml registries into a cached dagpipe pipeline, wiring every registry-aware node with its registry and node config.

"},{"location":"domain/enrichment/tags/pipeline/#domain.enrichment.tags.pipeline-classes","title":"Classes","text":""},{"location":"domain/enrichment/tags/pipeline/#domain.enrichment.tags.pipeline-functions","title":"Functions","text":""},{"location":"domain/enrichment/tags/pipeline/#domain.enrichment.tags.pipeline.get_tag_pipeline","title":"get_tag_pipeline","text":"
get_tag_pipeline()\n

Return the lazily cached tag pipeline.

Builds (once) and reuses the pipeline across calls.

Returns:

Type Description

The cached tag pipeline instance.

"},{"location":"domain/enrichment/tags/pipeline/#domain.enrichment.tags.pipeline.load","title":"load","text":"
load() -> Pipeline\n

Load and wire the tag enrichment pipeline.

Reads the packaged pipeline.yaml, builds the pipeline graph, and installs the merged pattern registry and per-node config onto each node that supports it.

Returns:

Name Type Description Pipeline Pipeline

The wired dagpipe pipeline.

Raises:

Type Description FileNotFoundError

If the packaged pipeline.yaml is missing.

"},{"location":"domain/entity/","title":"Entity","text":""},{"location":"domain/entity/#domain.entity","title":"domain.entity","text":""},{"location":"domain/entity/#domain.entity--summary","title":"Summary","text":"

Entity domain: the Entity aggregate, its Mongo document schema, enrichment adaptor, and CRUD service wiring.

"},{"location":"domain/entity/models/","title":"Models","text":""},{"location":"domain/entity/models/#domain.entity.models","title":"domain.entity.models","text":""},{"location":"domain/entity/models/#domain.entity.models--summary","title":"Summary","text":"

Define the Entity aggregate model with default-logo resolution.

"},{"location":"domain/entity/models/#domain.entity.models-classes","title":"Classes","text":""},{"location":"domain/entity/models/#domain.entity.models.Entity","title":"Entity","text":"

Bases: BaseModel

Entity (payee) model: a merchant, person, transfer, or other kind.

Attributes:

Name Type Description name str

Display name of the entity.

type str

Entity kind used to pick the default logo, e.g. \"merchant\".

logo str | None

Logo URL/path; filled with a per-type default when unset.

Notes

Guarantees: After validation, logo is always a non-empty value; a missing logo is replaced using :data:DEFAULT_LOGO_MAP keyed by type.

"},{"location":"domain/entity/ports/","title":"Ports","text":""},{"location":"domain/entity/ports/#domain.entity.ports","title":"domain.entity.ports","text":""},{"location":"domain/entity/ports/#domain.entity.ports--summary","title":"Summary","text":"

Port wiring for the entity aggregate: Mongo repository, enrichment adaptor, and CRUD service wiring.

"},{"location":"domain/entity/ports/db/","title":"Db","text":""},{"location":"domain/entity/ports/db/#domain.entity.ports.db","title":"domain.entity.ports.db","text":""},{"location":"domain/entity/ports/db/#domain.entity.ports.db--summary","title":"Summary","text":"

Mongo persistence for entities: document schema with an in-memory cache.

"},{"location":"domain/entity/ports/db/#domain.entity.ports.db-classes","title":"Classes","text":""},{"location":"domain/entity/ports/db/#domain.entity.ports.db.EntityDocument","title":"EntityDocument","text":"

Bases: Entity, BaseDocument

Mongo document form of :class:Entity read through an in-memory cache.

"},{"location":"domain/entity/ports/db/#domain.entity.ports.db-functions","title":"Functions","text":""},{"location":"domain/entity/ports/db/#domain.entity.ports.db.create_entity_repo","title":"create_entity_repo","text":"
create_entity_repo()\n

Create a Mongo-backed entity repository with an in-memory cache.

Returns:

Name Type Description Any

Mongo-backed entity repository using an in-memory cache backend.

"},{"location":"domain/entity/ports/enrichment/","title":"Enrichment","text":""},{"location":"domain/entity/ports/enrichment/#domain.entity.ports.enrichment","title":"domain.entity.ports.enrichment","text":""},{"location":"domain/entity/ports/enrichment/#domain.entity.ports.enrichment--summary","title":"Summary","text":"

Entity enrichment port: expose the shared entity enrichment pipeline as an async callable.

"},{"location":"domain/entity/ports/enrichment/#domain.entity.ports.enrichment-classes","title":"Classes","text":""},{"location":"domain/entity/ports/enrichment/#domain.entity.ports.enrichment.EntityEnrichmentAdaptor","title":"EntityEnrichmentAdaptor","text":"
EntityEnrichmentAdaptor(**kwargs)\n

Adaptor exposing the entity enrichment pipeline as an async callable.

Initialize the adaptor with the shared entity pipeline.

Parameters:

Name Type Description Default **kwargs dict

Ignored; kept for dependency-injection compatibility.

{}"},{"location":"domain/entity/ports/enrichment/#domain.entity.ports.enrichment.EntityEnrichmentAdaptor-functions","title":"Functions","text":""},{"location":"domain/entity/ports/enrichment/#domain.entity.ports.enrichment.EntityEnrichmentAdaptor.__call__","title":"__call__ async","text":"
__call__(payload: dict) -> dict\n

Run the entity enrichment pipeline on payload.

Parameters:

Name Type Description Default payload dict

Enrichment input, e.g. payee text and hints.

required

Returns:

Name Type Description dict dict

Enriched payload carrying the resolved entity information.

"},{"location":"domain/entity/ports/enrichment/#domain.entity.ports.enrichment-functions","title":"Functions","text":""},{"location":"domain/entity/ports/enrichment/#domain.entity.ports.enrichment.get_entity_enrichment_svc","title":"get_entity_enrichment_svc","text":"
get_entity_enrichment_svc(\n    **kwargs,\n) -> EntityEnrichmentAdaptor\n

Build an entity enrichment service adaptor.

Parameters:

Name Type Description Default **kwargs dict

Passed through to the adaptor constructor.

{}

Returns:

Name Type Description EntityEnrichmentAdaptor EntityEnrichmentAdaptor

Ready-to-use entity enrichment adaptor.

"},{"location":"domain/entity/ports/service/","title":"Service","text":""},{"location":"domain/entity/ports/service/#domain.entity.ports.service","title":"domain.entity.ports.service","text":""},{"location":"domain/entity/ports/service/#domain.entity.ports.service--summary","title":"Summary","text":"

CRUD service wiring for the entity aggregate via the hexa container.

"},{"location":"domain/entity/ports/service/#domain.entity.ports.service-classes","title":"Classes","text":""},{"location":"domain/entity/ports/service/#domain.entity.ports.service.EntityCrudsService","title":"EntityCrudsService","text":"

Bases: CrudsServiceAdaptor[Entity, EntityDocument]

Entity CRUD service resolving :class:Entity documents from a repo.

Notes

Instances are created by :func:get_entity_service. The model and schema class attributes bind the domain model and its document type.

"},{"location":"domain/entity/ports/service/#domain.entity.ports.service-functions","title":"Functions","text":""},{"location":"domain/entity/ports/service/#domain.entity.ports.service.get_entity_service","title":"get_entity_service","text":"
get_entity_service(repo) -> EntityCrudsService\n

Build an entity CRUD service wired to repo.

Parameters:

Name Type Description Default repo Any

Mongo-backed entity repository from :func:create_entity_repo.

required

Returns:

Name Type Description EntityCrudsService EntityCrudsService

Ready-to-use entity CRUD service.

"},{"location":"domain/expense/","title":"Expense","text":""},{"location":"domain/expense/#domain.expense","title":"domain.expense","text":""},{"location":"domain/expense/#domain.expense--summary","title":"Summary","text":"

Expense domain: the Expense aggregate, converters, Mongo document schema, and CRUD service wiring.

"},{"location":"domain/expense/models/","title":"Models","text":""},{"location":"domain/expense/models/#domain.expense.models","title":"domain.expense.models","text":""},{"location":"domain/expense/models/#domain.expense.models--summary","title":"Summary","text":"

Define the Expense aggregate model (entity, account, tags, and amount) shared across layers.

"},{"location":"domain/expense/models/#domain.expense.models-classes","title":"Classes","text":""},{"location":"domain/expense/models/#domain.expense.models.Expense","title":"Expense","text":"

Bases: BaseModel

Expense transaction linking an entity, account, and tags.

Attributes:

Name Type Description entity Entity

Payee entity the expense was incurred with.

amount float

Transaction amount.

account Account

Account the expense was paid from.

tags List[Tag]

Tags classified against the expense.

occurred_at str

Date the expense occurred, as DD-MM-YYYY.

fetch_request Optional[str]

ID of the fetch request that produced the expense; None when not sourced from a request.

"},{"location":"domain/expense/ports/","title":"Ports","text":""},{"location":"domain/expense/ports/#domain.expense.ports","title":"domain.expense.ports","text":""},{"location":"domain/expense/ports/#domain.expense.ports--summary","title":"Summary","text":"

Port wiring for expenses: converters, Mongo repository, and CRUD service wiring.

"},{"location":"domain/expense/ports/converters/","title":"Converters","text":""},{"location":"domain/expense/ports/converters/#domain.expense.ports.converters","title":"domain.expense.ports.converters","text":""},{"location":"domain/expense/ports/converters/#domain.expense.ports.converters--summary","title":"Summary","text":"

Converters bridging enriched fetch-request output and Expense aggregates for MongoDB storage.

"},{"location":"domain/expense/ports/converters/#domain.expense.ports.converters-classes","title":"Classes","text":""},{"location":"domain/expense/ports/converters/#domain.expense.ports.converters-functions","title":"Functions","text":""},{"location":"domain/expense/ports/converters/#domain.expense.ports.converters.enriched_to_expenses","title":"enriched_to_expenses async","text":"
enriched_to_expenses(\n    enriched_list: List[EnrichedExpense],\n    fetch_request: FetchRequest,\n    entity_svc,\n    tag_svc,\n    fetch_request_id: Optional[str] = None,\n) -> List[Expense]\n

Convert enriched expenses into Expense aggregates ready for storage.

Each enriched expense is expanded into an Expense referencing the account of fetch_request and resolved entity and tag objects.

Parameters:

Name Type Description Default enriched_list List[EnrichedExpense]

Enriched expenses to convert.

required fetch_request FetchRequest

Fetch request providing the source account.

required entity_svc Any

Entity CRUD service used to resolve or create payees.

required tag_svc Any

Tag CRUD service used to resolve tags by name.

required fetch_request_id Optional[str]

Fetch request ID recorded on expenses; falls back to fetch_request.id when omitted.

None

Returns:

Type Description List[Expense]

List[Expense]: Converted expense aggregates.

Raises:

Type Description ValueError

When an enriched tag name does not exist.

"},{"location":"domain/expense/ports/converters/#domain.expense.ports.converters.expense_to_storage","title":"expense_to_storage","text":"
expense_to_storage(expense: Expense) -> None\n

Convert Expense FK fields to ObjectIds in-place for MongoDB storage.

Raises ValueError if any FK field lacks an ObjectId \u2014 prevents storing embedded subdocuments instead of references.

Parameters:

Name Type Description Default expense Expense

Expense to normalize for storage.

required

Raises:

Type Description ValueError

When entity, account, or any tag lacks an ObjectId.

"},{"location":"domain/expense/ports/db/","title":"Db","text":""},{"location":"domain/expense/ports/db/#domain.expense.ports.db","title":"domain.expense.ports.db","text":""},{"location":"domain/expense/ports/db/#domain.expense.ports.db--summary","title":"Summary","text":"

Mongo persistence for expenses: document schema with populated references and repository factory.

"},{"location":"domain/expense/ports/db/#domain.expense.ports.db-classes","title":"Classes","text":""},{"location":"domain/expense/ports/db/#domain.expense.ports.db.ExpenseDocument","title":"ExpenseDocument","text":"

Bases: Expense, BaseDocument

Mongo document form of :class:Expense with populated references.

Attributes:

Name Type Description entity EntityDocument

Populated payee entity document.

account AccountDocument

Populated account document.

tags List[TagDocument]

Populated tag documents.

"},{"location":"domain/expense/ports/db/#domain.expense.ports.db-functions","title":"Functions","text":""},{"location":"domain/expense/ports/db/#domain.expense.ports.db.create_expense_repo","title":"create_expense_repo","text":"
create_expense_repo(\n    entity_repo: Any, account_repo: Any, tag_repo: Any\n)\n

Create a Mongo-backed expense repository wired for reference population.

Parameters:

Name Type Description Default entity_repo Any

Entity repository used to populate entity.

required account_repo Any

Account repository used to populate account.

required tag_repo Any

Tag repository used to populate tags.

required

Returns:

Name Type Description Any

Mongo-backed expense repository configured with entity, account, and tag population rules.

"},{"location":"domain/expense/ports/service/","title":"Service","text":""},{"location":"domain/expense/ports/service/#domain.expense.ports.service","title":"domain.expense.ports.service","text":""},{"location":"domain/expense/ports/service/#domain.expense.ports.service--summary","title":"Summary","text":"

CRUD service wiring for the expense aggregate via the hexa container.

"},{"location":"domain/expense/ports/service/#domain.expense.ports.service-classes","title":"Classes","text":""},{"location":"domain/expense/ports/service/#domain.expense.ports.service.ExpenseCrudsService","title":"ExpenseCrudsService","text":"

Bases: CrudsServiceAdaptor[Expense, ExpenseDocument]

Expense CRUD service resolving :class:Expense documents from a repo.

Notes

Instances are created by :func:get_expense_service. The model and schema class attributes bind the domain model and its document type.

"},{"location":"domain/expense/ports/service/#domain.expense.ports.service-functions","title":"Functions","text":""},{"location":"domain/expense/ports/service/#domain.expense.ports.service.get_expense_service","title":"get_expense_service","text":"
get_expense_service(repo) -> ExpenseCrudsService\n

Build an expense CRUD service wired to repo.

Parameters:

Name Type Description Default repo Any

Mongo-backed expense repository from :func:create_expense_repo.

required

Returns:

Name Type Description ExpenseCrudsService ExpenseCrudsService

Ready-to-use expense CRUD service.

"},{"location":"domain/fetch_pipeline/","title":"Fetch Pipeline","text":""},{"location":"domain/fetch_pipeline/#domain.fetch_pipeline","title":"domain.fetch_pipeline","text":""},{"location":"domain/fetch_pipeline/#domain.fetch_pipeline--summary","title":"Summary","text":"

Fetch pipeline domain: orchestrates expense extraction from bank statement sources.

Covers extraction-stage driving (pdf, email, tabular, llama), ambiguity pausing, enrichment, expense persistence, and progress-event streaming, plus the models and ports the orchestrator depends on.

"},{"location":"domain/fetch_pipeline/models/","title":"Models","text":""},{"location":"domain/fetch_pipeline/models/#domain.fetch_pipeline.models","title":"domain.fetch_pipeline.models","text":""},{"location":"domain/fetch_pipeline/models/#domain.fetch_pipeline.models--summary","title":"Summary","text":"

Data models for fetch pipeline progress reporting and ambiguity resolution.

"},{"location":"domain/fetch_pipeline/models/#domain.fetch_pipeline.models-classes","title":"Classes","text":""},{"location":"domain/fetch_pipeline/models/#domain.fetch_pipeline.models.Ambiguity","title":"Ambiguity","text":"

Bases: BaseModel

Record of an ambiguity pause awaiting resolution.

Attributes:

Name Type Description fetch_request_id PyObjectId

Owning fetch request.

step_index int

Pipeline stage index at which the pause occurred.

line str

Raw OCR line that triggered the ambiguity.

ocr_amount float

Amount read from the OCR line.

ocr_balance float

Balance read from the OCR line.

prev_balance float

Balance carried into the ambiguous transaction.

candidates List[AmbiguityCandidate]

Amount/balance candidates offered for resolution.

chosen Optional[AmbiguityCandidate]

Candidate selected by the resolver, if any.

resolved_at Optional[str]

ISO timestamp of resolution, if resolved.

status str

Lifecycle status, defaulting to \"pending\".

"},{"location":"domain/fetch_pipeline/models/#domain.fetch_pipeline.models.AmbiguityCandidate","title":"AmbiguityCandidate","text":"

Bases: BaseModel

Amount/balance pair offered as a resolution candidate.

Attributes:

Name Type Description amount float

Candidate transaction amount.

balance float

Candidate balance after the transaction.

"},{"location":"domain/fetch_pipeline/models/#domain.fetch_pipeline.models.ProgressEvent","title":"ProgressEvent","text":"

Bases: BaseModel

SSE progress event emitted while a fetch request runs.

Attributes:

Name Type Description fetch_request_id str

Owning fetch request id.

step str

Progress step name.

status str

Progress status value.

message ProgressMessage

Detail payload; defaults to an empty message.

timestamp str

ISO timestamp of the event.

"},{"location":"domain/fetch_pipeline/models/#domain.fetch_pipeline.models.ProgressMessage","title":"ProgressMessage","text":"

Bases: BaseModel

Optional detail payload attached to a progress event.

Attributes:

Name Type Description lines Optional[int]

Count of raw lines processed.

blocks Optional[int]

Count of transaction blocks produced.

count Optional[int]

Count of items at the current step.

unit Optional[str]

Unit label for count.

raw_ocr_line Optional[str]

Raw OCR line, e.g. the ambiguous line.

error Optional[str]

Error message when the step failed.

"},{"location":"domain/fetch_pipeline/models/#domain.fetch_pipeline.models.ProgressStatus","title":"ProgressStatus","text":"

Bases: str, Enum

Lifecycle status values for a progress step.

Attributes:

Name Type Description STARTED ProgressStatus

Step began.

COMPLETED ProgressStatus

Step finished.

SKIPPED ProgressStatus

Step was not needed.

PAUSED ProgressStatus

Step paused for ambiguity resolution.

PROGRESS ProgressStatus

Step is in progress.

FAILED ProgressStatus

Step failed.

"},{"location":"domain/fetch_pipeline/models/#domain.fetch_pipeline.models.ProgressStep","title":"ProgressStep","text":"

Bases: str, Enum

Pipeline stage names used in progress events.

Attributes:

Name Type Description RAW_LINES ProgressStep

Raw OCR line extraction step.

TXN_BLOCKS ProgressStep

Transaction block grouping step.

TXN_DICTS ProgressStep

Transaction dict construction step.

RESUME_EXTRACT ProgressStep

Resume-from-saved-stages step.

EXTRACT ProgressStep

Continued extraction step.

PAUSED ProgressStep

Ambiguity pause state.

RAW_EXPENSES ProgressStep

Raw expense materialization step.

ENRICH_ENTITY ProgressStep

Entity enrichment step.

ENRICH_TAGS ProgressStep

Tag enrichment step.

SAVE_EXPENSES ProgressStep

Expense persistence step.

"},{"location":"domain/fetch_pipeline/ports/","title":"Ports","text":""},{"location":"domain/fetch_pipeline/ports/#domain.fetch_pipeline.ports","title":"domain.fetch_pipeline.ports","text":""},{"location":"domain/fetch_pipeline/ports/#domain.fetch_pipeline.ports--summary","title":"Summary","text":"

Ports for the fetch pipeline domain.

Thin adaptors and factories binding persistence, enrichment, messaging and service infrastructure to the domain models.

"},{"location":"domain/fetch_pipeline/ports/db/","title":"Db","text":""},{"location":"domain/fetch_pipeline/ports/db/#domain.fetch_pipeline.ports.db","title":"domain.fetch_pipeline.ports.db","text":""},{"location":"domain/fetch_pipeline/ports/db/#domain.fetch_pipeline.ports.db--summary","title":"Summary","text":"

Persistence port for fetch pipeline ambiguity records.

Maps the Ambiguity model to a Mongo-backed document and exposes a repo factory for the ambiguities collection.

"},{"location":"domain/fetch_pipeline/ports/db/#domain.fetch_pipeline.ports.db-classes","title":"Classes","text":""},{"location":"domain/fetch_pipeline/ports/db/#domain.fetch_pipeline.ports.db.AmbiguityDocument","title":"AmbiguityDocument","text":"

Bases: Ambiguity, BaseDocument

Mongo document for ambiguity records.

Combines the domain Ambiguity model with the mongo_ops document base for repository persistence.

"},{"location":"domain/fetch_pipeline/ports/db/#domain.fetch_pipeline.ports.db-functions","title":"Functions","text":""},{"location":"domain/fetch_pipeline/ports/db/#domain.fetch_pipeline.ports.db.create_ambiguity_repo","title":"create_ambiguity_repo","text":"
create_ambiguity_repo()\n

Create the ambiguity repository backed by Mongo.

Returns:

Type Description

Repository over the ambiguities collection.

"},{"location":"domain/fetch_pipeline/ports/enrichment/","title":"Enrichment","text":""},{"location":"domain/fetch_pipeline/ports/enrichment/#domain.fetch_pipeline.ports.enrichment","title":"domain.fetch_pipeline.ports.enrichment","text":""},{"location":"domain/fetch_pipeline/ports/enrichment/#domain.fetch_pipeline.ports.enrichment--summary","title":"Summary","text":"

Enrichment port for the fetch pipeline: orchestrates entity and tag pipelines over raw expenses.

Adapts the domain fetch-request models to the enrichment pipeline state payloads and back to enriched expenses.

"},{"location":"domain/fetch_pipeline/ports/enrichment/#domain.fetch_pipeline.ports.enrichment-classes","title":"Classes","text":""},{"location":"domain/fetch_pipeline/ports/enrichment/#domain.fetch_pipeline.ports.enrichment.EnrichmentOrchestratorAdaptor","title":"EnrichmentOrchestratorAdaptor","text":"
EnrichmentOrchestratorAdaptor(\n    *, entity_pipeline=None, tags_pipeline=None\n)\n

Drive entity and tag enrichment for raw expenses.

Runs the entity pipeline over a raw expense state payload, builds an EnrichedExpense, then runs the tags pipeline over its payload and fills the tag list.

Attributes:

Name Type Description entity_pipeline

Pipeline resolving the payee entity; defaults to the cached entity pipeline.

tags_pipeline

Pipeline resolving tags; defaults to the cached tags pipeline.

"},{"location":"domain/fetch_pipeline/ports/enrichment/#domain.fetch_pipeline.ports.enrichment.EnrichmentOrchestratorAdaptor-functions","title":"Functions","text":""},{"location":"domain/fetch_pipeline/ports/enrichment/#domain.fetch_pipeline.ports.enrichment.EnrichmentOrchestratorAdaptor.enrich","title":"enrich async","text":"
enrich(raw: RawExpense) -> EnrichedExpense\n

Enrich a raw expense into an enriched expense.

Parameters:

Name Type Description Default raw RawExpense

Raw expense parsed from the statement.

required

Returns:

Name Type Description EnrichedExpense EnrichedExpense

The enriched expense with payee, entity

EnrichedExpense

metadata and tags.

"},{"location":"domain/fetch_pipeline/ports/enrichment/#domain.fetch_pipeline.ports.enrichment-functions","title":"Functions","text":""},{"location":"domain/fetch_pipeline/ports/enrichment/#domain.fetch_pipeline.ports.enrichment.get_enrichment_orchestrator","title":"get_enrichment_orchestrator","text":"
get_enrichment_orchestrator(\n    **kwargs,\n) -> EnrichmentOrchestratorAdaptor\n

Build an enrichment orchestrator adaptor.

Parameters:

Name Type Description Default **kwargs

Optional entity_pipeline / tags_pipeline overrides.

{}

Returns:

Name Type Description EnrichmentOrchestratorAdaptor EnrichmentOrchestratorAdaptor

A configured orchestrator.

"},{"location":"domain/fetch_pipeline/ports/messaging/","title":"Messaging","text":""},{"location":"domain/fetch_pipeline/ports/messaging/#domain.fetch_pipeline.ports.messaging","title":"domain.fetch_pipeline.ports.messaging","text":""},{"location":"domain/fetch_pipeline/ports/messaging/#domain.fetch_pipeline.ports.messaging--summary","title":"Summary","text":"

Messaging port for fetch pipeline progress events.

Wraps the SSE in-memory bus used to stream progress to connected clients.

"},{"location":"domain/fetch_pipeline/ports/messaging/#domain.fetch_pipeline.ports.messaging-classes","title":"Classes","text":""},{"location":"domain/fetch_pipeline/ports/messaging/#domain.fetch_pipeline.ports.messaging.ProgressEventBus","title":"ProgressEventBus","text":"
ProgressEventBus()\n

Publish and replay progress events for a fetch request.

Notes

Backed by an SSEInMemoryBus[ProgressEvent]; events are kept in memory only.

"},{"location":"domain/fetch_pipeline/ports/messaging/#domain.fetch_pipeline.ports.messaging.ProgressEventBus-functions","title":"Functions","text":""},{"location":"domain/fetch_pipeline/ports/messaging/#domain.fetch_pipeline.ports.messaging.ProgressEventBus.get_events","title":"get_events","text":"
get_events(fr_id: str) -> List[ProgressEvent]\n

Return the events published for a fetch request.

Parameters:

Name Type Description Default fr_id str

Fetch request id.

required

Returns:

Type Description List[ProgressEvent]

List[ProgressEvent]: Events seen for that request.

"},{"location":"domain/fetch_pipeline/ports/messaging/#domain.fetch_pipeline.ports.messaging.ProgressEventBus.publish","title":"publish async","text":"
publish(event: ProgressEvent) -> None\n

Publish a progress event to subscribers.

Parameters:

Name Type Description Default event ProgressEvent

The event to broadcast.

required

Returns:

Name Type Description None None

Nothing.

"},{"location":"domain/fetch_pipeline/ports/service/","title":"Service","text":""},{"location":"domain/fetch_pipeline/ports/service/#domain.fetch_pipeline.ports.service","title":"domain.fetch_pipeline.ports.service","text":""},{"location":"domain/fetch_pipeline/ports/service/#domain.fetch_pipeline.ports.service--summary","title":"Summary","text":"

Service port for fetch pipeline ambiguity CRUD.

Exposes a Hexa-built CRUD service over the ambiguity model/document.

"},{"location":"domain/fetch_pipeline/ports/service/#domain.fetch_pipeline.ports.service-classes","title":"Classes","text":""},{"location":"domain/fetch_pipeline/ports/service/#domain.fetch_pipeline.ports.service.AmbiguityCrudsService","title":"AmbiguityCrudsService","text":"

Bases: CrudsServiceAdaptor[Ambiguity, AmbiguityDocument]

CRUD service for ambiguity records.

Attributes:

Name Type Description model Ambiguity

Domain model class.

schema AmbiguityDocument

Persistence document class.

"},{"location":"domain/fetch_pipeline/ports/service/#domain.fetch_pipeline.ports.service-functions","title":"Functions","text":""},{"location":"domain/fetch_pipeline/ports/service/#domain.fetch_pipeline.ports.service.get_ambiguity_service","title":"get_ambiguity_service","text":"
get_ambiguity_service(repo) -> AmbiguityCrudsService\n

Build the ambiguity CRUD service bound to a repo.

Parameters:

Name Type Description Default repo

Repository instance used for persistence.

required

Returns:

Name Type Description AmbiguityCrudsService AmbiguityCrudsService

The wired service.

"},{"location":"domain/fetch_pipeline/utils/","title":"Utils","text":""},{"location":"domain/fetch_pipeline/utils/#domain.fetch_pipeline.utils","title":"domain.fetch_pipeline.utils","text":""},{"location":"domain/fetch_pipeline/utils/#domain.fetch_pipeline.utils--summary","title":"Summary","text":"

Utility helpers for the fetch pipeline: OCR text handling and pipeline stage driving.

"},{"location":"domain/fetch_pipeline/utils/ocr/","title":"Ocr","text":""},{"location":"domain/fetch_pipeline/utils/ocr/#domain.fetch_pipeline.utils.ocr","title":"domain.fetch_pipeline.utils.ocr","text":""},{"location":"domain/fetch_pipeline/utils/ocr/#domain.fetch_pipeline.utils.ocr--summary","title":"Summary","text":"

OCR helpers for statement images and PDFs.

Covers number cleaning, tesseract text normalization, PDF rasterization, and per-page OCR with optional binarization.

"},{"location":"domain/fetch_pipeline/utils/ocr/#domain.fetch_pipeline.utils.ocr-functions","title":"Functions","text":""},{"location":"domain/fetch_pipeline/utils/ocr/#domain.fetch_pipeline.utils.ocr.clean_num","title":"clean_num","text":"
clean_num(s: str) -> float\n

Parse a numeric token into a float amount.

Strips non-digits and divides by the correct power of ten based on the recorded decimal part; a token without digits yields 0.0.

Parameters:

Name Type Description Default s str

Raw numeric string.

required

Returns:

Name Type Description float float

Parsed value.

"},{"location":"domain/fetch_pipeline/utils/ocr/#domain.fetch_pipeline.utils.ocr.normalize","title":"normalize","text":"
normalize(text: str) -> str\n

Normalize a raw OCR string for parsing.

Fixes a tesseract digit misread, expands pipes to spaces, trims stray punctuation from the leading edge (including the replacement character), and removes commas.

Parameters:

Name Type Description Default text str

Raw OCR output.

required

Returns:

Name Type Description str str

Normalized text.

"},{"location":"domain/fetch_pipeline/utils/ocr/#domain.fetch_pipeline.utils.ocr.ocr_all_pages","title":"ocr_all_pages","text":"
ocr_all_pages(\n    pdf_bytes: bytes, covert_to_image: bool = None\n) -> list\n

OCR every page of a PDF in a temporary directory.

With covert_to_image pages are binarized and OCRed with the numeric-mode OEM 3 config; otherwise they are OCRed with the default PSM 6 config.

Parameters:

Name Type Description Default pdf_bytes bytes

Raw PDF content.

required covert_to_image bool

When truthy, binarize pages to images before OCR.

None

Returns:

Name Type Description list list

OCR text, one string per page.

"},{"location":"domain/fetch_pipeline/utils/ocr/#domain.fetch_pipeline.utils.ocr.rasterize_pdf","title":"rasterize_pdf","text":"
rasterize_pdf(\n    pdf_bytes: bytes, out_dir: str, dpi: int = 300\n) -> list\n

Rasterize a PDF into per-page JPEGs.

Writes the bytes as input.pdf in out_dir and invokes pdftoppm at the requested DPI.

Parameters:

Name Type Description Default pdf_bytes bytes

Raw PDF content.

required out_dir str

Directory used to write the PDF and JPEG outputs.

required dpi int

Rasterization resolution, defaults to 300.

300

Returns:

Name Type Description list list

Sorted list of JPEG path strings.

Raises:

Type Description CalledProcessError

If pdftoppm fails.

"},{"location":"domain/fetch_pipeline/utils/pipeline/","title":"Pipeline","text":""},{"location":"domain/fetch_pipeline/utils/pipeline/#domain.fetch_pipeline.utils.pipeline","title":"domain.fetch_pipeline.utils.pipeline","text":""},{"location":"domain/fetch_pipeline/utils/pipeline/#domain.fetch_pipeline.utils.pipeline--summary","title":"Summary","text":"

Pipeline orchestration for fetch requests.

Drives extraction stages (pdf, email, tabular, llama), persists partial output on every stage, pauses on ambiguity, enriches raw expenses, saves expense documents, and emits SSE progress events. The orchestrator depends on injected services and the fetch pipeline ports.

"},{"location":"domain/fetch_pipeline/utils/pipeline/#domain.fetch_pipeline.utils.pipeline--notes","title":"Notes","text":"

Guarantees:

Lifecycle:

"},{"location":"domain/fetch_pipeline/utils/pipeline/#domain.fetch_pipeline.utils.pipeline-classes","title":"Classes","text":""},{"location":"domain/fetch_pipeline/utils/pipeline/#domain.fetch_pipeline.utils.pipeline.PipelineOrchestrator","title":"PipelineOrchestrator","text":"
PipelineOrchestrator(\n    fr_svc,\n    ambiguity_svc,\n    expense_svc,\n    pdf_fetcher: PdfFetcher,\n    email_fetcher: EmailFetcher,\n    xlsx_fetcher: XlsxFetcher,\n    csv_fetcher: CsvFetcher,\n    sse: ProgressEventBus,\n    pause_on_ambiguity: bool = True,\n    resolver: Optional[Callable] = None,\n    resolved_choices: Optional[dict] = None,\n    entity_svc=None,\n    tag_svc=None,\n    cache_store=None,\n)\n

Orchestrate extraction, enrichment and persistence for a fetch request.

Drives the extraction root over fetched content, persists partial stage output, pauses on ambiguity, enriches raw expenses, saves expense documents through the injected services, and streams progress events via the SSE bus.

Attributes:

Name Type Description fr_svc

Fetch request service used to read and save the request.

ambiguity_svc

Service persisting ambiguity records.

expense_svc

Service creating expense documents.

pdf_fetcher PdfFetcher

Fetcher for PDF sources.

email_fetcher EmailFetcher

Fetcher for email sources.

xlsx_fetcher XlsxFetcher

Fetcher for xlsx sources.

csv_fetcher CsvFetcher

Fetcher for csv sources.

sse ProgressEventBus

Bus streaming progress events.

pause_on_ambiguity bool

Whether ambiguity is paused for resolution.

resolver

Optional ambiguity resolver callback.

resolved_choices dict

Pre-chosen ambiguity resolutions.

entity_svc

Optional entity service used for expense creation.

tag_svc

Optional tag service used for expense creation.

cache_store

Optional read-cache store invalidated after saving.

"},{"location":"domain/fetch_pipeline/utils/pipeline/#domain.fetch_pipeline.utils.pipeline.PipelineOrchestrator-functions","title":"Functions","text":""},{"location":"domain/fetch_pipeline/utils/pipeline/#domain.fetch_pipeline.utils.pipeline.PipelineOrchestrator.run_pipeline","title":"run_pipeline async","text":"
run_pipeline(fr_id: str) -> None\n

Run the full fetch pipeline for a request.

Reads the request, builds the extractor, fetches content, extracts raw expenses, enriches them, and persists expense documents.

Parameters:

Name Type Description Default fr_id str

Fetch request id.

required

Returns:

Name Type Description None None

Nothing.

Notes

An ambiguity pause is re-raised as PauseForResolution after the paused state has been saved.

"},{"location":"domain/fetch_pipeline/utils/pipeline/#domain.fetch_pipeline.utils.pipeline-functions","title":"Functions","text":""},{"location":"domain/fetch_request/","title":"Fetch Request","text":""},{"location":"domain/fetch_request/#domain.fetch_request","title":"domain.fetch_request","text":""},{"location":"domain/fetch_request/#domain.fetch_request--summary","title":"Summary","text":"

Fetch request domain: models and ports describing statement fetch requests.

Covers the fetch request aggregate (source, account, pipeline, trust fallback), raw/enriched expense models, and the persistence and service ports used by the fetch pipeline.

"},{"location":"domain/fetch_request/models/","title":"Models","text":""},{"location":"domain/fetch_request/models/#domain.fetch_request.models","title":"domain.fetch_request.models","text":""},{"location":"domain/fetch_request/models/#domain.fetch_request.models--summary","title":"Summary","text":"

Models for fetch requests: source variety, direction and pipeline enums, raw/enriched expenses, and the fetch request aggregate.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models-classes","title":"Classes","text":""},{"location":"domain/fetch_request/models/#domain.fetch_request.models.Bank","title":"Bank","text":"

Bases: str, Enum

Supported statement banks.

Attributes:

Name Type Description AXIS Bank

Axis Bank.

ICICI Bank

ICICI Bank.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.CsvSource","title":"CsvSource","text":"

Bases: FileSource

CSV file source.

Attributes:

Name Type Description type Literal[CSV]

Constant source type marker.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.Direction","title":"Direction","text":"

Bases: str, Enum

Cashflow direction of a transaction.

Attributes:

Name Type Description DEBIT Direction

Money out of the account.

CREDIT Direction

Money into the account.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.EmailSource","title":"EmailSource","text":"

Bases: Source

Email statement source.

Attributes:

Name Type Description from_email str

Sender address filter.

subject str

Subject line filter.

raw_terms List[str]

Free-text search terms.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.EnrichedExpense","title":"EnrichedExpense","text":"

Bases: BaseModel

Raw expense with enrichment results attached.

Attributes:

Name Type Description raw_expense RawExpense

The source raw expense.

payee str

Resolved payee/entity name.

entity_type str

Entity type, defaulting to merchant.

entity_logo str | None

Logo path/url, if any.

tags List[str]

Resolved tags.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.FetchRequest","title":"FetchRequest","text":"

Bases: BaseModel

A request to fetch and process a statement.

Attributes:

Name Type Description source Union[EmailSource, PdfSource, XlsxSource, CsvSource, FileSource]

Statement source describing how to fetch the data.

account Account

Account the statement belongs to.

start_date datetime

Statement window start.

end_date datetime

Statement window end.

status str

Processing status, defaulting to pending.

pipeline Pipeline

Extraction pipeline to use.

trust_fallback Optional[TrustFallback]

Optional balance-chain trust policy.

fingerprint str

Deduplication fingerprint for the request.

completed_at Optional[datetime]

Completion timestamp, if finished.

error_message Optional[str]

Failure message, if failed.

retry_count int

Number of retries attempted.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.FileSource","title":"FileSource","text":"

Bases: Source

File-based statement source.

Attributes:

Name Type Description path str

Path to the uploaded file.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.PdfSource","title":"PdfSource","text":"

Bases: FileSource

PDF file source.

Attributes:

Name Type Description type Literal[PDF]

Constant source type marker.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.Pipeline","title":"Pipeline","text":"

Bases: str, Enum

Extraction pipeline choice for a fetch request.

Attributes:

Name Type Description HEURISTIC Pipeline

Rule/heuristic extraction pipeline.

LLM Pipeline

LLM-assisted extraction pipeline.

LLAMA_PARSE Pipeline

LlamaParse table-direct extraction pipeline.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.RawExpense","title":"RawExpense","text":"

Bases: BaseModel

A single transaction parsed from a statement.

Attributes:

Name Type Description date str

Expense date as DD-MM-YYYY.

amount float

Transaction amount.

balance float

Account balance after transaction.

description str

Complete reconstructed transaction description.

raw_lines List[str]

Raw OCR/text lines that form this transaction.

direction Direction

Either Direction.DEBIT or Direction.CREDIT.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.Source","title":"Source","text":"

Bases: BaseModel

Base statement source carrying extraction progress state.

Attributes:

Name Type Description bank Bank

Statement bank, defaulting to Bank.ICICI.

type SourceType

Source kind discriminator.

raw_lines List[str]

Raw OCR/text lines extracted so far.

txn_blocks Dict[str, Any]

Transaction blocks keyed by order id.

txn_dicts List[RawExpense]

Parsed raw expenses.

enrichment_dicts List[EnrichedExpense]

Enriched expenses.

txn_dicts_count int

Number of parsed raw expenses.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.SourceType","title":"SourceType","text":"

Bases: str, Enum

Statement source kinds.

Attributes:

Name Type Description FILE SourceType

Generic file source.

EMAIL SourceType

Email source.

PDF SourceType

PDF file source.

XLSX SourceType

Spreadsheet source.

CSV SourceType

CSV source.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.TrustFallback","title":"TrustFallback","text":"

Bases: str, Enum

Per-FetchRequest policy for broken balance chains.

When set, resolution skips OCR-style candidate guesswork entirely and always trusts the configured column: - AMOUNT: keep the transaction amount, derive balance as prev \u00b1 amount. - BALANCE: keep the stated balance, derive amount from the balance delta.

Attributes:

Name Type Description AMOUNT TrustFallback

Trust the transaction amount; balance is derived as prev \u00b1 amount.

BALANCE TrustFallback

Trust the stated balance; amount is derived from the balance delta.

"},{"location":"domain/fetch_request/models/#domain.fetch_request.models.XlsxSource","title":"XlsxSource","text":"

Bases: FileSource

XLSX file source.

Attributes:

Name Type Description type Literal[XLSX]

Constant source type marker.

"},{"location":"domain/fetch_request/ports/","title":"Ports","text":""},{"location":"domain/fetch_request/ports/#domain.fetch_request.ports","title":"domain.fetch_request.ports","text":""},{"location":"domain/fetch_request/ports/#domain.fetch_request.ports--summary","title":"Summary","text":"

Ports for the fetch request domain.

Thin adaptors and factories binding the Mongo-backed fetch request document and the Hexa-built CRUD service to the domain model.

"},{"location":"domain/fetch_request/ports/db/","title":"Db","text":""},{"location":"domain/fetch_request/ports/db/#domain.fetch_request.ports.db","title":"domain.fetch_request.ports.db","text":""},{"location":"domain/fetch_request/ports/db/#domain.fetch_request.ports.db--summary","title":"Summary","text":"

Persistence port for fetch requests.

Maps the FetchRequest model (with a populated account reference) to a Mongo-backed document and exposes the repo factory with population rules.

"},{"location":"domain/fetch_request/ports/db/#domain.fetch_request.ports.db-classes","title":"Classes","text":""},{"location":"domain/fetch_request/ports/db/#domain.fetch_request.ports.db.FetchRequestDocument","title":"FetchRequestDocument","text":"

Bases: FetchRequest, BaseDocument

Mongo document for fetch requests.

Attributes:

Name Type Description account AccountDocument

Populated account reference.

"},{"location":"domain/fetch_request/ports/db/#domain.fetch_request.ports.db-functions","title":"Functions","text":""},{"location":"domain/fetch_request/ports/db/#domain.fetch_request.ports.db.create_fetch_request_repo","title":"create_fetch_request_repo","text":"
create_fetch_request_repo(\n    account_repo: Any = None, user_repo: Any = None\n)\n

Create the fetch request repository with account population.

Parameters:

Name Type Description Default account_repo Any

Repository used to populate account references.

None user_repo Any

Reserved for user population; currently unused.

None

Returns:

Type Description

Repository over the fetch_requests collection configured with

population rules.

"},{"location":"domain/fetch_request/ports/service/","title":"Service","text":""},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service","title":"domain.fetch_request.ports.service","text":""},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service--summary","title":"Summary","text":"

Service port for fetch requests.

Exposes a Hexa-built CRUD service with stage-saving helpers used by the fetch pipeline orchestrator.

"},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service-classes","title":"Classes","text":""},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service.FetchRequestCrudsService","title":"FetchRequestCrudsService","text":"

Bases: CrudsServiceAdaptor[FetchRequest, FetchRequestDocument]

CRUD service for fetch requests with pipeline stage helpers.

Attributes:

Name Type Description model FetchRequest

Domain model class.

schema FetchRequestDocument

Persistence document class.

"},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service.FetchRequestCrudsService-functions","title":"Functions","text":""},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service.FetchRequestCrudsService.save_enrichment","title":"save_enrichment async","text":"
save_enrichment(\n    id: PyObjectId, enrichment_dicts: list\n) -> None\n

Persist the enriched expense dicts on the request source.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required enrichment_dicts list

Enriched expense dicts.

required

Returns:

Name Type Description None None

Nothing.

"},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service.FetchRequestCrudsService.save_raw_lines","title":"save_raw_lines async","text":"
save_raw_lines(id: PyObjectId, raw_lines: list) -> None\n

Persist the extracted raw lines on the request source.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required raw_lines list

Raw OCR/text lines.

required

Returns:

Name Type Description None None

Nothing.

"},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service.FetchRequestCrudsService.save_txn_blocks","title":"save_txn_blocks async","text":"
save_txn_blocks(id: PyObjectId, txn_blocks: dict) -> None\n

Persist the extracted transaction blocks on the request source.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required txn_blocks dict

Transaction blocks keyed by order id.

required

Returns:

Name Type Description None None

Nothing.

"},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service.FetchRequestCrudsService.save_txn_dicts","title":"save_txn_dicts async","text":"
save_txn_dicts(\n    id: PyObjectId, txn_dicts: list, txn_dicts_count: int\n) -> None\n

Persist the parsed transaction dicts and count on the request source.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required txn_dicts list

Raw expense dicts.

required txn_dicts_count int

Number of parsed transaction dicts.

required

Returns:

Name Type Description None None

Nothing.

"},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service.FetchRequestCrudsService.update_status","title":"update_status async","text":"
update_status(\n    id: PyObjectId,\n    status: str,\n    error_message: Optional[str] = None,\n    retry_count: Optional[int] = None,\n) -> bool\n

Update the request status, optionally carrying failure detail.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required status str

New status value.

required error_message Optional[str]

Message recorded when failing.

None retry_count Optional[int]

Retry counter recorded when failing.

None

Returns:

Name Type Description bool bool

True when a document was patched.

Raises:

Type Description ValueError

If status == \"failed\" and either error_message or retry_count is None.

"},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service-functions","title":"Functions","text":""},{"location":"domain/fetch_request/ports/service/#domain.fetch_request.ports.service.get_fetch_request_service","title":"get_fetch_request_service","text":"
get_fetch_request_service(repo) -> FetchRequestCrudsService\n

Build the fetch request CRUD service bound to a repo.

Parameters:

Name Type Description Default repo

Repository instance used for persistence.

required

Returns:

Name Type Description FetchRequestCrudsService FetchRequestCrudsService

The wired service.

"},{"location":"domain/fetcher/","title":"Fetcher","text":""},{"location":"domain/fetcher/#domain.fetcher","title":"domain.fetcher","text":""},{"location":"domain/fetcher/#domain.fetcher--summary","title":"Summary","text":"

Fetcher domain: adaptors that pull raw statements from email, spreadsheet, and PDF sources.

"},{"location":"domain/fetcher/ports/","title":"Ports","text":""},{"location":"domain/fetcher/ports/#domain.fetcher.ports","title":"domain.fetcher.ports","text":""},{"location":"domain/fetcher/ports/#domain.fetcher.ports--summary","title":"Summary","text":"

Port wiring for the fetcher domain: email, spreadsheet, and PDF fetchers.

"},{"location":"domain/fetcher/ports/email/","title":"Email","text":""},{"location":"domain/fetcher/ports/email/#domain.fetcher.ports.email","title":"domain.fetcher.ports.email","text":""},{"location":"domain/fetcher/ports/email/#domain.fetcher.ports.email--summary","title":"Summary","text":"

Email fetcher: pull statement messages from Gmail and convert them to omniread content.

"},{"location":"domain/fetcher/ports/email/#domain.fetcher.ports.email-classes","title":"Classes","text":""},{"location":"domain/fetcher/ports/email/#domain.fetcher.ports.email.EmailFetcher","title":"EmailFetcher","text":"
EmailFetcher(\n    credentials_path: str,\n    token_path: str,\n    scopes: List[str],\n)\n

Fetch emails through Gmail and convert each message to :class:Content.

Notes

Lifecycle: Construction performs OAuth credential resolution once; a missing or expired token is refreshed automatically by the credential store.

Initialize the Gmail-backed email reader.

Parameters:

Name Type Description Default credentials_path str

Path to the OAuth client credentials JSON.

required token_path str

Path to the persisted OAuth token pickle.

required scopes List[str]

OAuth scopes to request.

required"},{"location":"domain/fetcher/ports/email/#domain.fetcher.ports.email.EmailFetcher-functions","title":"Functions","text":""},{"location":"domain/fetcher/ports/email/#domain.fetcher.ports.email.EmailFetcher.fetch","title":"fetch","text":"
fetch(query: str) -> List[Content]\n

Return every message matching the Gmail query as content.

Parameters:

Name Type Description Default query str

Gmail search query, e.g. from:x label:statements.

required

Returns:

Type Description List[Content]

List[Content]: HTML content per matching message.

"},{"location":"domain/fetcher/ports/file/","title":"File","text":""},{"location":"domain/fetcher/ports/file/#domain.fetcher.ports.file","title":"domain.fetcher.ports.file","text":""},{"location":"domain/fetcher/ports/file/#domain.fetcher.ports.file--summary","title":"Summary","text":"

File fetchers: read spreadsheet statements (XLSX, CSV) into omniread content.

"},{"location":"domain/fetcher/ports/file/#domain.fetcher.ports.file-classes","title":"Classes","text":""},{"location":"domain/fetcher/ports/file/#domain.fetcher.ports.file.CsvFetcher","title":"CsvFetcher","text":"
CsvFetcher()\n

Fetch a statement from a CSV file through a filesystem scraper.

"},{"location":"domain/fetcher/ports/file/#domain.fetcher.ports.file.CsvFetcher-functions","title":"Functions","text":""},{"location":"domain/fetcher/ports/file/#domain.fetcher.ports.file.CsvFetcher.fetch","title":"fetch async","text":"
fetch(csv_path: Path) -> Content\n

Read the statement content of csv_path.

Parameters:

Name Type Description Default csv_path Path

Filesystem path to the CSV file.

required

Returns:

Name Type Description Content Content

Extracted statement content.

"},{"location":"domain/fetcher/ports/file/#domain.fetcher.ports.file.XlsxFetcher","title":"XlsxFetcher","text":"
XlsxFetcher()\n

Fetch a statement from an XLSX file through a filesystem scraper.

"},{"location":"domain/fetcher/ports/file/#domain.fetcher.ports.file.XlsxFetcher-functions","title":"Functions","text":""},{"location":"domain/fetcher/ports/file/#domain.fetcher.ports.file.XlsxFetcher.fetch","title":"fetch async","text":"
fetch(xlsx_path: Path) -> Content\n

Read the statement content of xlsx_path.

Parameters:

Name Type Description Default xlsx_path Path

Filesystem path to the XLSX file.

required

Returns:

Name Type Description Content Content

Extracted statement content.

"},{"location":"domain/fetcher/ports/pdf/","title":"Pdf","text":""},{"location":"domain/fetcher/ports/pdf/#domain.fetcher.ports.pdf","title":"domain.fetcher.ports.pdf","text":""},{"location":"domain/fetcher/ports/pdf/#domain.fetcher.ports.pdf--summary","title":"Summary","text":"

PDF fetcher: read statement PDFs into omniread content.

"},{"location":"domain/fetcher/ports/pdf/#domain.fetcher.ports.pdf-classes","title":"Classes","text":""},{"location":"domain/fetcher/ports/pdf/#domain.fetcher.ports.pdf.PdfFetcher","title":"PdfFetcher","text":"
PdfFetcher()\n

Fetch a statement from a PDF file through a filesystem scraper.

"},{"location":"domain/fetcher/ports/pdf/#domain.fetcher.ports.pdf.PdfFetcher-functions","title":"Functions","text":""},{"location":"domain/fetcher/ports/pdf/#domain.fetcher.ports.pdf.PdfFetcher.fetch","title":"fetch async","text":"
fetch(pdf_path: Path) -> Content\n

Read the statement content of pdf_path.

Parameters:

Name Type Description Default pdf_path Path

Filesystem path to the PDF file.

required

Returns:

Name Type Description Content Content

Extracted statement content.

"},{"location":"domain/report/","title":"Report","text":""},{"location":"domain/report/#domain.report","title":"domain.report","text":""},{"location":"domain/report/#domain.report--summary","title":"Summary","text":"

Report domain: snapshot query and cube models, sparse cube store, and the report service.

"},{"location":"domain/report/models/","title":"Models","text":""},{"location":"domain/report/models/#domain.report.models","title":"domain.report.models","text":""},{"location":"domain/report/models/#domain.report.models--summary","title":"Summary","text":"

Report domain models: snapshot query, cube series, and API response.

Pure models plus date/period helpers consumed by the report service. Functions here are side-effect free; they only parse, normalize, and validate report definitions and period labels.

"},{"location":"domain/report/models/#domain.report.models-classes","title":"Classes","text":""},{"location":"domain/report/models/#domain.report.models.Report","title":"Report","text":"

Bases: BaseModel

API response for a sliced report view.

Attributes:

Name Type Description id str

Snapshot ID the view was served from.

name str

Snapshot name.

query ReportQuery

Normalized query the snapshot was built from.

generated_at str

ISO-8601 timestamp of cube generation.

created_at str

ISO-8601 timestamp of snapshot creation.

flow str

Flow the view was sliced to.

granularities List[str]

Granularities present in the view.

period_ids List[str]

All period IDs available, sorted chronologically.

payees List[str]

Every payee present in the cube.

tags List[str]

Every tag path present in the cube.

buckets List[ReportBucket]

Buckets forming the sliced view.

"},{"location":"domain/report/models/#domain.report.models.ReportBucket","title":"ReportBucket","text":"

Bases: BaseModel

A flow x group-dimension slice of a report, keyed per granularity.

Attributes:

Name Type Description flow str

Flow this bucket covers, e.g. \"inflows\".

group_key Dict[str, List[str]]

Dimension filters defining the bucket.

series Dict[str, List[ReportPeriod]]

Periods per granularity.

"},{"location":"domain/report/models/#domain.report.models.ReportMetrics","title":"ReportMetrics","text":"

Bases: BaseModel

Aggregated metrics over a slice of transactions.

Attributes:

Name Type Description outflows float

Sum of absolute negative amounts.

inflows float

Sum of positive amounts.

sum float

Net total of all amounts.

count int

Number of transactions contributing amounts.

avg float

Mean transaction amount.

min float

Minimum transaction amount.

max float

Maximum transaction amount.

first_date Optional[str]

Earliest transaction date, DD-MM-YYYY.

last_date Optional[str]

Latest transaction date, DD-MM-YYYY.

cadence Optional[float]

Mean gap in days between consecutive dates.

frequency Optional[float]

Frequency per day derived from cadence.

"},{"location":"domain/report/models/#domain.report.models.ReportPeriod","title":"ReportPeriod","text":"

Bases: BaseModel

One period slice of a cube level: metrics plus the contributing transactions.

Attributes:

Name Type Description period_id str

Canonical period label.

start Optional[str]

Inclusive ISO start boundary.

end Optional[str]

Exclusive ISO end boundary.

metrics ReportMetrics

Aggregated metrics for the period.

txns List[Any]

Transactions contributing to the period.

"},{"location":"domain/report/models/#domain.report.models.ReportQuery","title":"ReportQuery","text":"

Bases: BaseModel

Definition of a report snapshot. Bounds the data set; dimensions are sliced at read time.

Attributes:

Name Type Description name str

Snapshot name; empty for an auto-generated name.

granularities List[str]

Granularities to precompute in the cube.

group_dims List[str]

Dimensions to group by, e.g. \"payee\", \"tag\".

flow str

Flow filter: inflows, outflows, or both.

accounts Optional[List[str]]

Account names to include; all when None.

ignore_self bool

Exclude self-transfer tagged expenses.

start_date str

Inclusive start boundary, DD-MM-YYYY.

end_date str

Inclusive end boundary, DD-MM-YYYY.

min_amount Optional[float]

Minimum absolute amount to include.

max_amount Optional[float]

Maximum absolute amount to include.

"},{"location":"domain/report/models/#domain.report.models.ReportSnapshot","title":"ReportSnapshot","text":"

Bases: BaseModel

Stored metadata for a precomputed report cube.

Attributes:

Name Type Description name str

Snapshot name.

query ReportQuery

Normalized query the cube was built from.

signature str

Canonical fingerprint of the normalized query.

generated_at str

ISO-8601 timestamp of cube generation.

"},{"location":"domain/report/models/#domain.report.models-functions","title":"Functions","text":""},{"location":"domain/report/models/#domain.report.models.compute_metrics","title":"compute_metrics","text":"
compute_metrics(txns: List[dict]) -> ReportMetrics\n

Compute aggregate metrics over a list of transaction dicts.

Parameters:

Name Type Description Default txns List[dict]

Transactions with amount and occurred_at keys.

required

Returns:

Name Type Description ReportMetrics ReportMetrics

Aggregated metrics; empty (zeroed) metrics when no amounts are present.

"},{"location":"domain/report/models/#domain.report.models.expand_tag_hierarchy","title":"expand_tag_hierarchy","text":"
expand_tag_hierarchy(tag_path: str) -> List[str]\n

Given 'food,restaurants' return ['food', 'food,restaurants'] (every ancestor prefix).

Parameters:

Name Type Description Default tag_path str

Comma-joined tag hierarchy path, or \"untagged\".

required

Returns:

Type Description List[str]

List[str]: Every ancestor prefix of the path, or [\"untagged\"].

"},{"location":"domain/report/models/#domain.report.models.normalize_date","title":"normalize_date","text":"
normalize_date(value: str) -> str\n

Canonicalize a date to the DD-MM-YYYY format (no time).

Parameters:

Name Type Description Default value str

Date string in any supported input format.

required

Returns:

Name Type Description str str

Date in canonical DD-MM-YYYY form.

Raises:

Type Description ValueError

When the value cannot be parsed as a date.

"},{"location":"domain/report/models/#domain.report.models.normalize_granularities","title":"normalize_granularities","text":"
normalize_granularities(\n    values: Optional[Union[str, Sequence[str]]] = None,\n) -> List[str]\n

Canonicalize + validate the granularities to precompute. Empty/default -> all period types.

Parameters:

Name Type Description Default values Optional[Union[str, Sequence[str]]]

Granularity names, a single name, or None for the defaults.

None

Returns:

Type Description List[str]

List[str]: Deduplicated, canonical granularity names.

Raises:

Type Description ValueError

When a value is not a supported granularity.

"},{"location":"domain/report/models/#domain.report.models.normalize_period_label","title":"normalize_period_label","text":"
normalize_period_label(value: str, granularity: str) -> str\n

Canonicalize a period label to the period_key format for a granularity.

Parameters:

Name Type Description Default value str

Raw period label, e.g. W03-2024 or Q2-2024.

required granularity str

Granularity the label belongs to.

required

Returns:

Name Type Description str str

Canonical period label, or the input unchanged when it cannot be normalized.

"},{"location":"domain/report/models/#domain.report.models.parse_date","title":"parse_date","text":"
parse_date(value: str) -> Optional[datetime.date]\n

Parse a date string into a date, else None.

Parameters:

Name Type Description Default value str

Date string in DD-MM-YYYY, YYYY-MM-DD, or DD/MM/YYYY form.

required

Returns:

Type Description Optional[date]

Optional[datetime.date]: The parsed date, or None when unparseable.

"},{"location":"domain/report/models/#domain.report.models.period_bounds","title":"period_bounds","text":"
period_bounds(dt: datetime.date, period_type: str)\n

Calendar (start, end) boundaries for a period, as dates. end is exclusive.

Parameters:

Name Type Description Default dt date

Any date inside the period.

required period_type str

Granularity: daily, weekly, monthly, quarterly, or yearly.

required

Returns:

Name Type Description tuple

(start, end) date boundaries; end is exclusive.

Raises:

Type Description ValueError

When the period type is unknown.

"},{"location":"domain/report/models/#domain.report.models.period_key","title":"period_key","text":"
period_key(dt: datetime.date, period_type: str) -> str\n

Return the period label containing dt for a granularity.

Parameters:

Name Type Description Default dt date

Date to bucket.

required period_type str

Granularity: daily, weekly, monthly, quarterly, yearly, or all.

required

Returns:

Name Type Description str str

Canonical period label for the given granularity.

Raises:

Type Description ValueError

When the period type is unknown.

"},{"location":"domain/report/models/#domain.report.models.period_sort_key","title":"period_sort_key","text":"
period_sort_key(label: str)\n

Chronological sort key for a concrete period label (within one granularity).

Parameters:

Name Type Description Default label str

Period label, e.g. 2024-W03, 2024-Jun, or 2024.

required

Returns:

Name Type Description tuple

Sort key of (year, sub) where sub ranks within the year.

"},{"location":"domain/report/models/#domain.report.models.quarterly_label","title":"quarterly_label","text":"
quarterly_label(year: int, quarter: int) -> str\n

Build the canonical label for a calendar quarter.

Parameters:

Name Type Description Default year int

Four-digit calendar year.

required quarter int

Quarter number in 1..4.

required

Returns:

Name Type Description str str

Quarterly label, e.g. 2024-Apr-Jun.

"},{"location":"domain/report/models/#domain.report.models.range_label","title":"range_label","text":"
range_label(\n    start_date: str = \"\", end_date: str = \"\"\n) -> str\n

Build the start:end range label for a date window ('' when unbounded).

Parameters:

Name Type Description Default start_date str

Start boundary date; empty for unbounded start.

'' end_date str

End boundary date; empty for unbounded end.

''

Returns:

Name Type Description str str

start:end label, or an empty string when both bounds are empty.

Raises:

Type Description ValueError

When the start date is after the end date.

"},{"location":"domain/report/ports/","title":"Ports","text":""},{"location":"domain/report/ports/#domain.report.ports","title":"domain.report.ports","text":""},{"location":"domain/report/ports/#domain.report.ports--summary","title":"Summary","text":"

Port wiring for reports: Mongo repository, cube store, and the report service.

"},{"location":"domain/report/ports/db/","title":"Db","text":""},{"location":"domain/report/ports/db/#domain.report.ports.db","title":"domain.report.ports.db","text":""},{"location":"domain/report/ports/db/#domain.report.ports.db--summary","title":"Summary","text":"

Mongo persistence for report snapshots: document schema and repository factory.

"},{"location":"domain/report/ports/db/#domain.report.ports.db-classes","title":"Classes","text":""},{"location":"domain/report/ports/db/#domain.report.ports.db.ReportSnapshotDocument","title":"ReportSnapshotDocument","text":"

Bases: ReportSnapshot, BaseDocument

Mongo document form of :class:ReportSnapshot storing the cube metadata.

"},{"location":"domain/report/ports/db/#domain.report.ports.db-functions","title":"Functions","text":""},{"location":"domain/report/ports/db/#domain.report.ports.db.create_report_repo","title":"create_report_repo","text":"
create_report_repo()\n

Create a Mongo-backed report snapshot repository.

Returns:

Name Type Description Any

Mongo-backed report snapshot repository.

"},{"location":"domain/report/ports/service/","title":"Service","text":""},{"location":"domain/report/ports/service/#domain.report.ports.service","title":"domain.report.ports.service","text":""},{"location":"domain/report/ports/service/#domain.report.ports.service--summary","title":"Summary","text":"

Report service: validate snapshot queries, precompute sparse cubes, and synthesize sliced report views.

A snapshot is keyed by the canonical signature of its normalized query; the sparse cube data lives in the configured :class:ReportStore while snapshot metadata is persisted through the report repository.

"},{"location":"domain/report/ports/service/#domain.report.ports.service-classes","title":"Classes","text":""},{"location":"domain/report/ports/service/#domain.report.ports.service.ReportService","title":"ReportService","text":"
ReportService(\n    expense_svc: ExpenseCrudsService,\n    tag_svc: TagCrudsService,\n    store: ReportStore,\n    report_repo=None,\n)\n

Build, persist, and serve precomputed report snapshots.

Notes

Instances are created by :func:get_report_service. The service scans expenses in batches, expands tag hierarchies, and persists period series into the configured :class:ReportStore.

Initialize the report service with its dependencies.

Parameters:

Name Type Description Default expense_svc ExpenseCrudsService

Expense CRUD service used as the cube source.

required tag_svc TagCrudsService

Tag CRUD service used to expand tag hierarchies and resolve ignore tags.

required store ReportStore

Key-value store for cube period data.

required report_repo Any

Report snapshot repository; defaults to :func:create_report_repo when omitted.

None"},{"location":"domain/report/ports/service/#domain.report.ports.service.ReportService-functions","title":"Functions","text":""},{"location":"domain/report/ports/service/#domain.report.ports.service.ReportService.delete_snapshot","title":"delete_snapshot async","text":"
delete_snapshot(report_id: str) -> bool\n

Delete a snapshot and all of its cube keys from the store.

Parameters:

Name Type Description Default report_id str

Snapshot ID to delete.

required

Returns:

Name Type Description bool bool

True when the snapshot existed and was deleted.

"},{"location":"domain/report/ports/service/#domain.report.ports.service.ReportService.fetch_report","title":"fetch_report async","text":"
fetch_report(\n    report_id: str,\n    granularities: Optional[List[str]] = None,\n    period_ids: Optional[List[str]] = None,\n    flow: str = \"outflows\",\n    payees: Optional[List[str]] = None,\n    tags: Optional[List[str]] = None,\n) -> Optional[Report]\n

Slice a stored snapshot into a report API response.

\"*\" in payees or tags expands to every value stored in the cube meta.

Parameters:

Name Type Description Default report_id str

Snapshot ID to slice.

required granularities Optional[List[str]]

Granularities to include; defaults to the snapshot's own.

None period_ids Optional[List[str]]

Period labels to filter to.

None flow str

Flow to serve; both includes inflows and outflows.

'outflows' payees Optional[List[str]]

Payee filters applied per bucket.

None tags Optional[List[str]]

Tag path filters applied per bucket.

None

Returns:

Type Description Optional[Report]

Optional[Report]: The sliced report view, or None when the snapshot does not exist.

"},{"location":"domain/report/ports/service/#domain.report.ports.service.ReportService.generate_snapshot","title":"generate_snapshot async","text":"
generate_snapshot(\n    query: ReportQuery,\n) -> ReportSnapshotDocument\n

Validate a query and return an existing or newly built snapshot.

If a snapshot with the same canonical signature already exists it is returned directly; otherwise a fresh cube is built and persisted.

Parameters:

Name Type Description Default query ReportQuery

Raw snapshot definition.

required

Returns:

Name Type Description ReportSnapshotDocument ReportSnapshotDocument

The existing or newly created snapshot.

"},{"location":"domain/report/ports/service/#domain.report.ports.service.ReportService.list_snapshots","title":"list_snapshots async","text":"
list_snapshots(\n    offset: int = 0, limit: int = DEFAULT_LIMIT\n) -> List[ReportSnapshotDocument]\n

List stored snapshots, newest first.

Parameters:

Name Type Description Default offset int

Number of snapshots to skip.

0 limit int

Maximum number of snapshots to return.

DEFAULT_LIMIT

Returns:

Type Description List[ReportSnapshotDocument]

List[ReportSnapshotDocument]: Snapshots ordered by creation time, newest first.

"},{"location":"domain/report/ports/service/#domain.report.ports.service-functions","title":"Functions","text":""},{"location":"domain/report/ports/service/#domain.report.ports.service.get_report_service","title":"get_report_service","text":"
get_report_service(\n    expense_svc, tag_svc, store, report_repo=None\n) -> ReportService\n

Build a report service with the given dependencies.

Parameters:

Name Type Description Default expense_svc Any

Expense CRUD service used as the cube source.

required tag_svc Any

Tag CRUD service used to expand tag hierarchies.

required store Any

Report store backing cube data.

required report_repo Any

Report snapshot repository; defaults to :func:create_report_repo when omitted.

None

Returns:

Name Type Description ReportService ReportService

Ready-to-use report service.

"},{"location":"domain/report/ports/service/#domain.report.ports.service.query_signature","title":"query_signature","text":"
query_signature(query: ReportQuery) -> str\n

Canonical fingerprint of a snapshot definition (list order-insensitive).

Parameters:

Name Type Description Default query ReportQuery

Snapshot definition to fingerprint.

required

Returns:

Name Type Description str str

SHA-256 hex digest of the normalized definition.

"},{"location":"domain/report/ports/store/","title":"Store","text":""},{"location":"domain/report/ports/store/#domain.report.ports.store","title":"domain.report.ports.store","text":""},{"location":"domain/report/ports/store/#domain.report.ports.store--summary","title":"Summary","text":"

Sparse key-value store that backs precomputed report cubes outside Mongo.

Implementations should map each method onto a persistent backend (e.g. Redis); every method below raises NotImplementedError in the base class until overridden.

"},{"location":"domain/report/ports/store/#domain.report.ports.store-classes","title":"Classes","text":""},{"location":"domain/report/ports/store/#domain.report.ports.store.ReportStore","title":"ReportStore","text":"

String key-value store used to persist report cube data.

Methods are asynchronous; all raise NotImplementedError in this base class and are expected to be overridden by concrete backends.

"},{"location":"domain/report/ports/store/#domain.report.ports.store.ReportStore-functions","title":"Functions","text":""},{"location":"domain/report/ports/store/#domain.report.ports.store.ReportStore.clear","title":"clear async","text":"
clear() -> None\n

Remove every entry this store holds.

Raises:

Type Description NotImplementedError

Base class contract.

"},{"location":"domain/report/ports/store/#domain.report.ports.store.ReportStore.close","title":"close async","text":"
close() -> None\n

Release any resources held by the store.

Raises:

Type Description NotImplementedError

Base class contract.

"},{"location":"domain/report/ports/store/#domain.report.ports.store.ReportStore.delete","title":"delete async","text":"
delete(key: str) -> None\n

Remove the entry stored under key.

Parameters:

Name Type Description Default key str

Storage key to remove.

required

Raises:

Type Description NotImplementedError

Base class contract.

"},{"location":"domain/report/ports/store/#domain.report.ports.store.ReportStore.get","title":"get async","text":"
get(key: str) -> Optional[str]\n

Return the value stored under key, or None when absent.

Parameters:

Name Type Description Default key str

Storage key.

required

Returns:

Type Description Optional[str]

Optional[str]: Stored value, or None.

Raises:

Type Description NotImplementedError

Base class contract.

"},{"location":"domain/report/ports/store/#domain.report.ports.store.ReportStore.scan","title":"scan async","text":"
scan(pattern: str) -> List[str]\n

Return every stored key matching pattern.

Parameters:

Name Type Description Default pattern str

Key pattern, e.g. cube:abc:*.

required

Returns:

Type Description List[str]

List[str]: Matching keys.

Raises:

Type Description NotImplementedError

Base class contract.

"},{"location":"domain/report/ports/store/#domain.report.ports.store.ReportStore.set","title":"set async","text":"
set(key: str, value: str) -> None\n

Store value under key, overwriting any existing entry.

Parameters:

Name Type Description Default key str

Storage key.

required value str

Value to store.

required

Raises:

Type Description NotImplementedError

Base class contract.

"},{"location":"domain/tag/","title":"Tag","text":""},{"location":"domain/tag/#domain.tag","title":"domain.tag","text":""},{"location":"domain/tag/#domain.tag--summary","title":"Summary","text":"

Tag domain: the Tag aggregate, Mongo document schema, enrichment adaptor, and CRUD service wiring.

"},{"location":"domain/tag/models/","title":"Models","text":""},{"location":"domain/tag/models/#domain.tag.models","title":"domain.tag.models","text":""},{"location":"domain/tag/models/#domain.tag.models--summary","title":"Summary","text":"

Define the Tag aggregate model shared by the service and storage layers.

"},{"location":"domain/tag/models/#domain.tag.models-classes","title":"Classes","text":""},{"location":"domain/tag/models/#domain.tag.models.Tag","title":"Tag","text":"

Bases: BaseModel

Tag aggregate: a named classification label, optionally nested.

Attributes:

Name Type Description name str

Tag name, e.g. \"food\".

icon str

Icon key rendered for the tag.

parent_id Optional[str]

ID of the parent tag; None for a root tag.

"},{"location":"domain/tag/ports/","title":"Ports","text":""},{"location":"domain/tag/ports/#domain.tag.ports","title":"domain.tag.ports","text":""},{"location":"domain/tag/ports/#domain.tag.ports--summary","title":"Summary","text":"

Port wiring for the tag aggregate: Mongo repository, enrichment adaptor, and CRUD service wiring.

"},{"location":"domain/tag/ports/db/","title":"Db","text":""},{"location":"domain/tag/ports/db/#domain.tag.ports.db","title":"domain.tag.ports.db","text":""},{"location":"domain/tag/ports/db/#domain.tag.ports.db--summary","title":"Summary","text":"

Mongo persistence for tags: document schema with an in-memory cache.

"},{"location":"domain/tag/ports/db/#domain.tag.ports.db-classes","title":"Classes","text":""},{"location":"domain/tag/ports/db/#domain.tag.ports.db.TagDocument","title":"TagDocument","text":"

Bases: Tag, BaseDocument

Mongo document form of :class:Tag read through an in-memory cache.

"},{"location":"domain/tag/ports/db/#domain.tag.ports.db-functions","title":"Functions","text":""},{"location":"domain/tag/ports/db/#domain.tag.ports.db.create_tag_repo","title":"create_tag_repo","text":"
create_tag_repo()\n

Create a Mongo-backed tag repository with an in-memory cache.

Returns:

Name Type Description Any

Mongo-backed tag repository using an in-memory cache backend.

"},{"location":"domain/tag/ports/enrichment/","title":"Enrichment","text":""},{"location":"domain/tag/ports/enrichment/#domain.tag.ports.enrichment","title":"domain.tag.ports.enrichment","text":""},{"location":"domain/tag/ports/enrichment/#domain.tag.ports.enrichment--summary","title":"Summary","text":"

Tag enrichment port: expose the shared tag enrichment pipeline as an async callable.

"},{"location":"domain/tag/ports/enrichment/#domain.tag.ports.enrichment-classes","title":"Classes","text":""},{"location":"domain/tag/ports/enrichment/#domain.tag.ports.enrichment.TagEnrichmentAdaptor","title":"TagEnrichmentAdaptor","text":"
TagEnrichmentAdaptor(**kwargs)\n

Adaptor exposing the tag enrichment pipeline as an async callable.

Initialize the adaptor with the shared tags pipeline.

Parameters:

Name Type Description Default **kwargs dict

Ignored; kept for dependency-injection compatibility.

{}"},{"location":"domain/tag/ports/enrichment/#domain.tag.ports.enrichment.TagEnrichmentAdaptor-functions","title":"Functions","text":""},{"location":"domain/tag/ports/enrichment/#domain.tag.ports.enrichment.TagEnrichmentAdaptor.__call__","title":"__call__ async","text":"
__call__(payload: dict) -> dict\n

Run the tag enrichment pipeline on payload.

Defaults the tags key to [\"misc\"] when the pipeline produces nothing.

Parameters:

Name Type Description Default payload dict

Enrichment input, e.g. expense text and hints.

required

Returns:

Name Type Description dict dict

Enriched payload whose tags list is always non-empty.

"},{"location":"domain/tag/ports/enrichment/#domain.tag.ports.enrichment-functions","title":"Functions","text":""},{"location":"domain/tag/ports/enrichment/#domain.tag.ports.enrichment.get_tag_enrichment_svc","title":"get_tag_enrichment_svc","text":"
get_tag_enrichment_svc(**kwargs) -> TagEnrichmentAdaptor\n

Build a tag enrichment service adaptor.

Parameters:

Name Type Description Default **kwargs dict

Passed through to the adaptor constructor.

{}

Returns:

Name Type Description TagEnrichmentAdaptor TagEnrichmentAdaptor

Ready-to-use tag enrichment adaptor.

"},{"location":"domain/tag/ports/service/","title":"Service","text":""},{"location":"domain/tag/ports/service/#domain.tag.ports.service","title":"domain.tag.ports.service","text":""},{"location":"domain/tag/ports/service/#domain.tag.ports.service--summary","title":"Summary","text":"

CRUD service wiring for the tag aggregate via the hexa container.

"},{"location":"domain/tag/ports/service/#domain.tag.ports.service-classes","title":"Classes","text":""},{"location":"domain/tag/ports/service/#domain.tag.ports.service.TagCrudsService","title":"TagCrudsService","text":"

Bases: CrudsServiceAdaptor[Tag, TagDocument]

Tag CRUD service resolving :class:Tag documents from a repo.

Notes

Instances are created by :func:get_tag_service. The model and schema class attributes bind the domain model and its document type. An additional lookup helper get_by_names is provided.

"},{"location":"domain/tag/ports/service/#domain.tag.ports.service.TagCrudsService-functions","title":"Functions","text":""},{"location":"domain/tag/ports/service/#domain.tag.ports.service.TagCrudsService.get_by_names","title":"get_by_names async","text":"
get_by_names(names: list[str])\n

Return tags whose names match any of the provided values.

Parameters:

Name Type Description Default names list[str]

Tag names to look up.

required

Returns:

Name Type Description list

Matching tag documents.

"},{"location":"domain/tag/ports/service/#domain.tag.ports.service-functions","title":"Functions","text":""},{"location":"domain/tag/ports/service/#domain.tag.ports.service.get_tag_service","title":"get_tag_service","text":"
get_tag_service(repo) -> TagCrudsService\n

Build a tag CRUD service wired to repo.

Parameters:

Name Type Description Default repo Any

Mongo-backed tag repository from :func:create_tag_repo.

required

Returns:

Name Type Description TagCrudsService TagCrudsService

Ready-to-use tag CRUD service.

"},{"location":"domain/upload/","title":"Upload","text":""},{"location":"domain/upload/#domain.upload","title":"domain.upload","text":""},{"location":"domain/upload/#domain.upload--summary","title":"Summary","text":"

Upload domain: the UploadResult model, Mongo document schema, and CRUD service wiring.

"},{"location":"domain/upload/models/","title":"Models","text":""},{"location":"domain/upload/models/#domain.upload.models","title":"domain.upload.models","text":""},{"location":"domain/upload/models/#domain.upload.models--summary","title":"Summary","text":"

Define the UploadResult model returned after storing an uploaded file.

"},{"location":"domain/upload/models/#domain.upload.models-classes","title":"Classes","text":""},{"location":"domain/upload/models/#domain.upload.models.UploadResult","title":"UploadResult","text":"

Bases: BaseModel

Metadata describing a stored file upload.

Attributes:

Name Type Description original_filename str

Name of the file as uploaded by the client.

saved_as str

Name the file was stored under on disk.

content_type str

MIME type of the uploaded file.

url str

Public URL serving the stored file.

absolute_path str

Absolute filesystem path of the stored file.

"},{"location":"domain/upload/ports/","title":"Ports","text":""},{"location":"domain/upload/ports/#domain.upload.ports","title":"domain.upload.ports","text":""},{"location":"domain/upload/ports/#domain.upload.ports--summary","title":"Summary","text":"

Port wiring for uploads: Mongo repository and CRUD service wiring.

"},{"location":"domain/upload/ports/db/","title":"Db","text":""},{"location":"domain/upload/ports/db/#domain.upload.ports.db","title":"domain.upload.ports.db","text":""},{"location":"domain/upload/ports/db/#domain.upload.ports.db--summary","title":"Summary","text":"

Mongo persistence for upload results: document schema and repository factory.

"},{"location":"domain/upload/ports/db/#domain.upload.ports.db-classes","title":"Classes","text":""},{"location":"domain/upload/ports/db/#domain.upload.ports.db.UploadResultDocument","title":"UploadResultDocument","text":"

Bases: UploadResult, BaseDocument

Mongo document form of :class:UploadResult.

"},{"location":"domain/upload/ports/db/#domain.upload.ports.db-functions","title":"Functions","text":""},{"location":"domain/upload/ports/db/#domain.upload.ports.db.create_upload_repo","title":"create_upload_repo","text":"
create_upload_repo()\n

Create a Mongo-backed upload result repository.

Returns:

Name Type Description Any

Mongo-backed upload result repository.

"},{"location":"domain/upload/ports/service/","title":"Service","text":""},{"location":"domain/upload/ports/service/#domain.upload.ports.service","title":"domain.upload.ports.service","text":""},{"location":"domain/upload/ports/service/#domain.upload.ports.service--summary","title":"Summary","text":"

CRUD service wiring for upload results via the hexa container.

"},{"location":"domain/upload/ports/service/#domain.upload.ports.service-classes","title":"Classes","text":""},{"location":"domain/upload/ports/service/#domain.upload.ports.service.UploadCrudsService","title":"UploadCrudsService","text":"

Bases: CrudsServiceAdaptor[UploadResult, UploadResultDocument]

Upload result CRUD service resolving :class:UploadResult documents.

Notes

Instances are created by :func:get_upload_service. The model and schema class attributes bind the domain model and its document type.

"},{"location":"domain/upload/ports/service/#domain.upload.ports.service-functions","title":"Functions","text":""},{"location":"domain/upload/ports/service/#domain.upload.ports.service.get_upload_service","title":"get_upload_service","text":"
get_upload_service(repo) -> UploadCrudsService\n

Build an upload result CRUD service wired to repo.

Parameters:

Name Type Description Default repo Any

Mongo-backed upload repository from :func:create_upload_repo.

required

Returns:

Name Type Description UploadCrudsService UploadCrudsService

Ready-to-use upload result CRUD service.

"},{"location":"domain/user/","title":"User","text":""},{"location":"domain/user/#domain.user","title":"domain.user","text":""},{"location":"domain/user/#domain.user--summary","title":"Summary","text":"

User domain: the User aggregate, Mongo document schema, and CRUD service wiring.

"},{"location":"domain/user/models/","title":"Models","text":""},{"location":"domain/user/models/#domain.user.models","title":"domain.user.models","text":""},{"location":"domain/user/models/#domain.user.models--summary","title":"Summary","text":"

Define the User aggregate model shared by the service and storage layers.

"},{"location":"domain/user/models/#domain.user.models-classes","title":"Classes","text":""},{"location":"domain/user/models/#domain.user.models.User","title":"User","text":"

Bases: BaseModel

User aggregate: identity information for an account owner.

Attributes:

Name Type Description name str

Display name of the user; empty when unknown.

username str

Unique username of the user.

email str

Email address of the user.

"},{"location":"domain/user/ports/","title":"Ports","text":""},{"location":"domain/user/ports/#domain.user.ports","title":"domain.user.ports","text":""},{"location":"domain/user/ports/#domain.user.ports--summary","title":"Summary","text":"

Port wiring for the user aggregate: Mongo repository and CRUD service wiring.

"},{"location":"domain/user/ports/db/","title":"Db","text":""},{"location":"domain/user/ports/db/#domain.user.ports.db","title":"domain.user.ports.db","text":""},{"location":"domain/user/ports/db/#domain.user.ports.db--summary","title":"Summary","text":"

Mongo persistence for users: document schema and repository factory.

"},{"location":"domain/user/ports/db/#domain.user.ports.db-classes","title":"Classes","text":""},{"location":"domain/user/ports/db/#domain.user.ports.db.UserDocument","title":"UserDocument","text":"

Bases: User, BaseDocument

Mongo document form of :class:User.

"},{"location":"domain/user/ports/db/#domain.user.ports.db-functions","title":"Functions","text":""},{"location":"domain/user/ports/db/#domain.user.ports.db.create_user_repo","title":"create_user_repo","text":"
create_user_repo()\n

Create a Mongo-backed user repository.

Returns:

Name Type Description Any

Mongo-backed user repository.

"},{"location":"domain/user/ports/service/","title":"Service","text":""},{"location":"domain/user/ports/service/#domain.user.ports.service","title":"domain.user.ports.service","text":""},{"location":"domain/user/ports/service/#domain.user.ports.service--summary","title":"Summary","text":"

CRUD service wiring for the user aggregate via the hexa container.

"},{"location":"domain/user/ports/service/#domain.user.ports.service-classes","title":"Classes","text":""},{"location":"domain/user/ports/service/#domain.user.ports.service.UserCrudsService","title":"UserCrudsService","text":"

Bases: CrudsServiceAdaptor[User, UserDocument]

User CRUD service resolving :class:User documents from a repo.

Notes

Instances are created by :func:get_user_service. The model and schema class attributes bind the domain model and its document type.

"},{"location":"domain/user/ports/service/#domain.user.ports.service-functions","title":"Functions","text":""},{"location":"domain/user/ports/service/#domain.user.ports.service.get_user_service","title":"get_user_service","text":"
get_user_service(repo) -> UserCrudsService\n

Build a user CRUD service wired to repo.

Parameters:

Name Type Description Default repo Any

Mongo-backed user repository from :func:create_user_repo.

required

Returns:

Name Type Description UserCrudsService UserCrudsService

Ready-to-use user CRUD service.

"},{"location":"infra/","title":"Infra","text":""},{"location":"infra/#infra","title":"infra","text":""},{"location":"infra/#infra--summary","title":"Summary","text":"

Infrastructure layer for the Expenses Service.

Provide adapters, database repositories, and LLM provider pools that implement the ports declared by the domain layer.

"},{"location":"infra/http_cache/","title":"Http Cache","text":""},{"location":"infra/http_cache/#infra.http_cache","title":"infra.http_cache","text":""},{"location":"infra/http_cache/#infra.http_cache--summary","title":"Summary","text":"

Domain-agnostic HTTP response cache.

A thin Redis-backed response cache that wraps route handlers as a decorator.

Example
from infra.http_cache import cache_response\n\n@cache_response(ttl=60)\nasync def list_entities(request, skip: int = 0, limit: int = 100):\n    ...\n
Notes

The cache is independent of the report cache (apicache:* vs report:* key namespaces) and of Mongo's cached repositories \u2014 it operates directly on the endpoint. Cached responses expire via TTL (default settings.cache_ttl). When no http_cache_store is wired on request.app.state.db_resources the decorator is a no-op pass-through, so applying/removing it is safe and trivial.

"},{"location":"infra/http_cache/#infra.http_cache-classes","title":"Classes","text":""},{"location":"infra/http_cache/#infra.http_cache.HttpCacheStore","title":"HttpCacheStore","text":"
HttpCacheStore(\n    url: str = \"redis://localhost:6379/0\",\n    decode_responses: bool = True,\n)\n

Store string responses in Redis with TTL under the apicache: key space.

Attributes:

Name Type Description _redis Redis

Asynchronous Redis client bound to the configured URL.

Initialize the store with a Redis connection.

Parameters:

Name Type Description Default url str

Redis connection URL.

'redis://localhost:6379/0' decode_responses bool

Whether Redis returns decoded strings.

True"},{"location":"infra/http_cache/#infra.http_cache.HttpCacheStore-functions","title":"Functions","text":""},{"location":"infra/http_cache/#infra.http_cache.HttpCacheStore.close","title":"close async","text":"
close() -> None\n

Close the underlying Redis connection.

"},{"location":"infra/http_cache/#infra.http_cache.HttpCacheStore.delete","title":"delete async","text":"
delete(key: str) -> None\n

Delete the value stored at key.

Parameters:

Name Type Description Default key str

Cache key to remove.

required"},{"location":"infra/http_cache/#infra.http_cache.HttpCacheStore.generation","title":"generation async","text":"
generation(resource: str) -> str\n

Return the current generation counter for a resource namespace.

Parameters:

Name Type Description Default resource str

Resource namespace to read.

required

Returns:

Name Type Description str str

Generation counter, or \"0\" when unset.

"},{"location":"infra/http_cache/#infra.http_cache.HttpCacheStore.get","title":"get async","text":"
get(key: str) -> Optional[str]\n

Read the value stored at key.

Parameters:

Name Type Description Default key str

Cache key to read.

required

Returns:

Type Description Optional[str]

Optional[str]: Cached value, or None when absent.

"},{"location":"infra/http_cache/#infra.http_cache.HttpCacheStore.invalidate","title":"invalidate async","text":"
invalidate(*resources: str) -> None\n

Invalidate all cached responses for the given resource namespaces.

Parameters:

Name Type Description Default *resources str

Resource namespaces to invalidate.

() Notes

Bumps each namespace's generation counter so existing entries become unreachable immediately; Redis reclaims them at TTL expiry.

"},{"location":"infra/http_cache/#infra.http_cache.HttpCacheStore.set","title":"set async","text":"
set(key: str, value: str, ttl: int) -> None\n

Store value at key with a TTL.

Parameters:

Name Type Description Default key str

Cache key to write.

required value str

Serialized value to persist.

required ttl int

Lifetime in seconds.

required"},{"location":"infra/http_cache/#infra.http_cache-functions","title":"Functions","text":""},{"location":"infra/http_cache/#infra.http_cache.cache_response","title":"cache_response","text":"
cache_response(ttl: Optional[int] = None) -> Callable\n

Decorate a GET-style route handler to cache its JSON response.

Parameters:

Name Type Description Default ttl Optional[int]

Cache lifetime in seconds; defaults to settings.cache_ttl.

None

Returns:

Name Type Description Callable Callable

Decorator that wraps the route handler.

Notes

The wrapped handler must accept a request: Request parameter (as every openapi_first handler does). Responses that are already a fastapi.Response (for example 204) are returned untouched and never cached. When no http_cache_store is wired on request.app.state.db_resources the decorator passes through to the handler without caching.

"},{"location":"infra/adapters/","title":"Adapters","text":""},{"location":"infra/adapters/#infra.adapters","title":"infra.adapters","text":""},{"location":"infra/adapters/#infra.adapters--summary","title":"Summary","text":"

Infrastructure adapters for the Expenses Service.

Group concrete adapter implementations for report storage, CRUD services, and in-memory SSE event publication.

"},{"location":"infra/adapters/redis/","title":"Redis","text":""},{"location":"infra/adapters/redis/#infra.adapters.redis","title":"infra.adapters.redis","text":""},{"location":"infra/adapters/redis/#infra.adapters.redis--summary","title":"Summary","text":"

Redis-backed implementation of the report store port.

Persist and scan report payloads in Redis under the report:* key space.

"},{"location":"infra/adapters/redis/#infra.adapters.redis-classes","title":"Classes","text":""},{"location":"infra/adapters/redis/#infra.adapters.redis.RedisStoreAdaptor","title":"RedisStoreAdaptor","text":"
RedisStoreAdaptor(\n    url: str = \"redis://localhost:6379/0\",\n    decode_responses: bool = True,\n)\n

Bases: ReportStore

Adapt a Redis client to the report store port.

Attributes:

Name Type Description _redis Redis

Asynchronous Redis client bound to the configured URL.

Initialize the adaptor with a Redis connection.

Parameters:

Name Type Description Default url str

Redis connection URL.

'redis://localhost:6379/0' decode_responses bool

Whether Redis returns decoded strings.

True"},{"location":"infra/adapters/redis/#infra.adapters.redis.RedisStoreAdaptor-functions","title":"Functions","text":""},{"location":"infra/adapters/redis/#infra.adapters.redis.RedisStoreAdaptor.clear","title":"clear async","text":"
clear() -> None\n

Delete every report key from the store.

Notes

Scans REPORT_PREFIX and removes all matching keys in one call.

"},{"location":"infra/adapters/redis/#infra.adapters.redis.RedisStoreAdaptor.close","title":"close async","text":"
close() -> None\n

Close the underlying Redis connection.

"},{"location":"infra/adapters/redis/#infra.adapters.redis.RedisStoreAdaptor.delete","title":"delete async","text":"
delete(key: str) -> None\n

Delete the value stored at key.

Parameters:

Name Type Description Default key str

Redis key to remove.

required"},{"location":"infra/adapters/redis/#infra.adapters.redis.RedisStoreAdaptor.get","title":"get async","text":"
get(key: str) -> Optional[str]\n

Read the value stored at key.

Parameters:

Name Type Description Default key str

Redis key to read.

required

Returns:

Type Description Optional[str]

Optional[str]: Stored value, or None when the key is absent.

"},{"location":"infra/adapters/redis/#infra.adapters.redis.RedisStoreAdaptor.scan","title":"scan async","text":"
scan(pattern: str) -> List[str]\n

List keys matching pattern.

Parameters:

Name Type Description Default pattern str

Glob-style key pattern.

required

Returns:

Type Description List[str]

List[str]: Matching keys.

"},{"location":"infra/adapters/redis/#infra.adapters.redis.RedisStoreAdaptor.set","title":"set async","text":"
set(key: str, value: str) -> None\n

Store value at key.

Parameters:

Name Type Description Default key str

Redis key to write.

required value str

Serialized value to persist.

required"},{"location":"infra/adapters/service/","title":"Service","text":""},{"location":"infra/adapters/service/#infra.adapters.service","title":"infra.adapters.service","text":""},{"location":"infra/adapters/service/#infra.adapters.service--summary","title":"Summary","text":"

Generic CRUD service adaptor over a Mongo repository.

Bridge pydantic models and mongo-ops documents, exposing create, read, update, patch, delete, and search operations for every domain that needs them.

"},{"location":"infra/adapters/service/#infra.adapters.service-classes","title":"Classes","text":""},{"location":"infra/adapters/service/#infra.adapters.service.CrudsServiceAdaptor","title":"CrudsServiceAdaptor","text":"
CrudsServiceAdaptor(*, repo=None)\n

Bases: Generic[Model, Schema]

Adapt a generic Mongo repository to a model/schema CRUD service.

Attributes:

Name Type Description repo BaseRepository

Repository backing all CRUD operations.

model Type[Model]

Pydantic model type handled by this service.

schema Type[Schema]

Document schema type persisted by the repository.

Initialize the adaptor with a backing repository.

Parameters:

Name Type Description Default repo BaseRepository

Repository used for all operations.

None"},{"location":"infra/adapters/service/#infra.adapters.service.CrudsServiceAdaptor-functions","title":"Functions","text":""},{"location":"infra/adapters/service/#infra.adapters.service.CrudsServiceAdaptor.create","title":"create async","text":"
create(data: Model | dict) -> Schema\n

Create a document from a model or raw mapping.

Parameters:

Name Type Description Default data Model | dict

Model instance or field mapping to persist.

required

Returns:

Name Type Description Schema Schema

Persisted document.

"},{"location":"infra/adapters/service/#infra.adapters.service.CrudsServiceAdaptor.delete","title":"delete async","text":"
delete(id: PyObjectId) -> bool\n

Delete a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Name Type Description bool bool

True when a document was deleted.

"},{"location":"infra/adapters/service/#infra.adapters.service.CrudsServiceAdaptor.model_to_dict","title":"model_to_dict staticmethod","text":"
model_to_dict(model_obj: Model) -> dict\n

Serialize a model into a sparse dictionary.

Parameters:

Name Type Description Default model_obj Model

Model instance to serialize.

required

Returns:

Name Type Description dict dict

Fields that are set and not None.

"},{"location":"infra/adapters/service/#infra.adapters.service.CrudsServiceAdaptor.patch","title":"patch async","text":"
patch(id: PyObjectId, data: dict) -> Schema | None\n

Partially update a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data dict

Fields to patch.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"infra/adapters/service/#infra.adapters.service.CrudsServiceAdaptor.read","title":"read async","text":"
read(id: PyObjectId) -> Schema | None\n

Read a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Type Description Schema | None

Schema | None: Matching document, or None when absent.

"},{"location":"infra/adapters/service/#infra.adapters.service.CrudsServiceAdaptor.search","title":"search async","text":"
search(\n    filter: dict | None = None, *args, **kwargs\n) -> list[Schema]\n

List documents matching an optional filter.

Parameters:

Name Type Description Default filter dict | None

Query filter passed to the repository.

None

Returns:

Type Description list[Schema]

list[Schema]: Matching documents.

Notes

Extra positional and keyword arguments are forwarded to the repository.

"},{"location":"infra/adapters/service/#infra.adapters.service.CrudsServiceAdaptor.update","title":"update async","text":"
update(id: PyObjectId, data: Model | dict) -> Schema | None\n

Replace a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data Model | dict

Replacement model or field mapping.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"infra/adapters/sse/","title":"Sse","text":""},{"location":"infra/adapters/sse/#infra.adapters.sse","title":"infra.adapters.sse","text":""},{"location":"infra/adapters/sse/#infra.adapters.sse--summary","title":"Summary","text":"

SSEInMemoryBus \u2014 in-memory event bus for SSE progress events.

Buffer published progress events so they can be replayed per fetch request.

"},{"location":"infra/adapters/sse/#infra.adapters.sse-classes","title":"Classes","text":""},{"location":"infra/adapters/sse/#infra.adapters.sse.SSEInMemoryBus","title":"SSEInMemoryBus","text":"
SSEInMemoryBus()\n

Bases: Generic[T]

Buffer SSE progress events in memory.

Attributes:

Name Type Description _events List[T]

Events published since the last clear.

Initialize an empty event buffer.

"},{"location":"infra/adapters/sse/#infra.adapters.sse.SSEInMemoryBus-functions","title":"Functions","text":""},{"location":"infra/adapters/sse/#infra.adapters.sse.SSEInMemoryBus.clear","title":"clear","text":"
clear() -> None\n

Remove all buffered events.

"},{"location":"infra/adapters/sse/#infra.adapters.sse.SSEInMemoryBus.get_events","title":"get_events","text":"
get_events(fr_id: str) -> List[T]\n

Return buffered events for a fetch request.

Parameters:

Name Type Description Default fr_id str

Fetch request identifier to filter by.

required

Returns:

Type Description List[T]

List[T]: Events whose fetch_request_id equals fr_id.

"},{"location":"infra/adapters/sse/#infra.adapters.sse.SSEInMemoryBus.publish","title":"publish async","text":"
publish(event: T) -> None\n

Append an event to the buffer.

Parameters:

Name Type Description Default event T

Event to append.

required"},{"location":"infra/db/","title":"Db","text":""},{"location":"infra/db/#infra.db","title":"infra.db","text":""},{"location":"infra/db/#infra.db--summary","title":"Summary","text":"

Database infrastructure for the Expenses Service.

Bundle connection setup and generic repository factories used by the infrastructure adapters.

"},{"location":"infra/db/setup/","title":"Setup","text":""},{"location":"infra/db/setup/#infra.db.setup","title":"infra.db.setup","text":""},{"location":"infra/db/setup/#infra.db.setup--summary","title":"Summary","text":"

Database setup \u2014 connection lifecycle only. No domain imports.

Connect and disconnect the shared Mongo connection manager at application startup and shutdown.

"},{"location":"infra/db/setup/#infra.db.setup-functions","title":"Functions","text":""},{"location":"infra/db/setup/#infra.db.setup.setup_database","title":"setup_database async","text":"
setup_database(uri: str, db_name: str)\n

Connect the shared Mongo connection manager.

Parameters:

Name Type Description Default uri str

Mongo connection URI.

required db_name str

Target database name.

required"},{"location":"infra/db/setup/#infra.db.setup.shutdown_database","title":"shutdown_database async","text":"
shutdown_database()\n

Disconnect the shared Mongo connection manager.

"},{"location":"infra/db/repos/","title":"Repos","text":""},{"location":"infra/db/repos/#infra.db.repos","title":"infra.db.repos","text":""},{"location":"infra/db/repos/#infra.db.repos--summary","title":"Summary","text":"

Generic database repository factories.

Expose the MongoDB repository factory and a PostgreSQL placeholder used by domain adapters.

"},{"location":"infra/db/repos/mongo/","title":"Mongo","text":""},{"location":"infra/db/repos/mongo/#infra.db.repos.mongo","title":"infra.db.repos.mongo","text":""},{"location":"infra/db/repos/mongo/#infra.db.repos.mongo--summary","title":"Summary","text":"

Generic MongoDB CRUD repo \u2014 single implementation for all domains.

Select a concrete mongo-ops repository (base, cached, or populating) from the options supplied to the factory.

"},{"location":"infra/db/repos/pgsql/","title":"Pgsql","text":""},{"location":"infra/db/repos/pgsql/#infra.db.repos.pgsql","title":"infra.db.repos.pgsql","text":""},{"location":"infra/db/repos/pgsql/#infra.db.repos.pgsql--summary","title":"Summary","text":"

Generic PostGres CRUD repo \u2014 single implementation for all domains.

Placeholder factory for future PostgreSQL repository support.

"},{"location":"infra/llm/","title":"Llm","text":""},{"location":"infra/llm/#infra.llm","title":"infra.llm","text":""},{"location":"infra/llm/#infra.llm--summary","title":"Summary","text":"

LLM infrastructure for the Expenses Service.

Provide HTTP client ports, retry pools, provider configuration, and statement parsing adaptors.

"},{"location":"infra/llm/httpx_client/","title":"Httpx Client","text":""},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client","title":"infra.llm.httpx_client","text":""},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client--summary","title":"Summary","text":"

HTTP client ports for OpenAI-compatible chat completion endpoints.

Provide synchronous and asynchronous httpx wrappers that issue chat completion requests with bearer authentication.

"},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client-classes","title":"Classes","text":""},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client.AsyncClientPort","title":"AsyncClientPort","text":"
AsyncClientPort(\n    api_key: str = \"\",\n    endpoint: str = \"\",\n    timeout: float = 60.0,\n)\n

Asynchronous httpx client for chat completion APIs.

Attributes:

Name Type Description api_key str

Bearer token used for authentication.

endpoint str

Base URL of the completions API.

timeout float

Request timeout in seconds.

_http_client AsyncClient

Underlying asynchronous HTTP client.

Initialize the asynchronous client.

Parameters:

Name Type Description Default api_key str

Bearer token used for authentication.

'' endpoint str

Base URL of the completions API.

'' timeout float

Request timeout in seconds.

60.0"},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client.AsyncClientPort-functions","title":"Functions","text":""},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client.AsyncClientPort.aclose","title":"aclose async","text":"
aclose()\n

Close the underlying asynchronous HTTP client.

"},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client.AsyncClientPort.chat_completion","title":"chat_completion async","text":"
chat_completion(\n    model: str,\n    messages: list,\n    temperature: float = 0.0,\n    max_tokens: int = 4096,\n) -> dict\n

Send an asynchronous chat completion request.

Parameters:

Name Type Description Default model str

Model identifier to invoke.

required messages list

Chat messages in API format.

required temperature float

Sampling temperature.

0.0 max_tokens int

Maximum tokens to generate.

4096

Returns:

Name Type Description dict dict

Decoded JSON response body.

"},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client.SyncClientPort","title":"SyncClientPort","text":"
SyncClientPort(\n    api_key: str = \"\",\n    endpoint: str = \"\",\n    timeout: float = 60.0,\n)\n

Synchronous httpx client for chat completion APIs.

Attributes:

Name Type Description api_key str

Bearer token used for authentication.

endpoint str

Base URL of the completions API.

timeout float

Request timeout in seconds.

_client Client

Underlying synchronous HTTP client.

Initialize the synchronous client.

Parameters:

Name Type Description Default api_key str

Bearer token used for authentication.

'' endpoint str

Base URL of the completions API.

'' timeout float

Request timeout in seconds.

60.0"},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client.SyncClientPort-functions","title":"Functions","text":""},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client.SyncClientPort.chat_completion","title":"chat_completion","text":"
chat_completion(\n    model: str,\n    messages: list,\n    temperature: float = 0.0,\n    max_tokens: int = 4096,\n) -> dict\n

Send a chat completion request.

Parameters:

Name Type Description Default model str

Model identifier to invoke.

required messages list

Chat messages in API format.

required temperature float

Sampling temperature.

0.0 max_tokens int

Maximum tokens to generate.

4096

Returns:

Name Type Description dict dict

Decoded JSON response body.

"},{"location":"infra/llm/httpx_client/#infra.llm.httpx_client.SyncClientPort.close","title":"close","text":"
close()\n

Close the underlying HTTP client.

"},{"location":"infra/llm/model/","title":"Model","text":""},{"location":"infra/llm/model/#infra.llm.model","title":"infra.llm.model","text":""},{"location":"infra/llm/model/#infra.llm.model--summary","title":"Summary","text":"

Dataclass describing an LLM model and its retry policy.

Carry the model identifier, provider name, and the retry, rate-limit, token, and timeout settings used by the pool retry loop.

"},{"location":"infra/llm/model/#infra.llm.model-classes","title":"Classes","text":""},{"location":"infra/llm/model/#infra.llm.model.ModelPort","title":"ModelPort dataclass","text":"
ModelPort(\n    name: str,\n    provider: str,\n    max_retries: int = 3,\n    retry_delay: float = 2.0,\n    rate_limit_delay: float = 1.0,\n    max_tokens: int = 4096,\n    timeout: float = 120.0,\n)\n

Describe an LLM model and its request policy.

Attributes:

Name Type Description name str

Provider-specific model identifier.

provider str

Provider key (for example groq).

max_retries int

Number of retry attempts per request.

retry_delay float

Seconds to wait between attempts.

rate_limit_delay float

Seconds to wait before each call.

max_tokens int

Maximum tokens to request from the model.

timeout float

Request timeout in seconds.

"},{"location":"infra/llm/pool/","title":"Pool","text":""},{"location":"infra/llm/pool/#infra.llm.pool","title":"infra.llm.pool","text":""},{"location":"infra/llm/pool/#infra.llm.pool--summary","title":"Summary","text":"

LLM pool adaptors with retry, rotation, and HTTP error handling.

Rotate through configured model ports, retrying failed chat completions and translating provider errors into RuntimeError failures.

"},{"location":"infra/llm/pool/#infra.llm.pool-classes","title":"Classes","text":""},{"location":"infra/llm/pool/#infra.llm.pool.AsyncPoolAdaptor","title":"AsyncPoolAdaptor","text":"
AsyncPoolAdaptor(**kwargs)\n

Asynchronous LLM pool with model rotation.

Attributes:

Name Type Description httpx_client AsyncClientPort

Client used for requests.

models list

Model ports available for rotation.

Initialize the pool from keyword configuration.

Parameters:

Name Type Description Default **kwargs

Configuration; httpx_client and models are consumed, remaining keys become instance attributes.

{}"},{"location":"infra/llm/pool/#infra.llm.pool.AsyncPoolAdaptor-functions","title":"Functions","text":""},{"location":"infra/llm/pool/#infra.llm.pool.AsyncPoolAdaptor.aclose","title":"aclose async","text":"
aclose()\n

Close the underlying asynchronous HTTP client.

"},{"location":"infra/llm/pool/#infra.llm.pool.AsyncPoolAdaptor.generate","title":"generate async","text":"
generate(\n    prompt: str,\n    system_prompt: Optional[str] = None,\n    max_tokens: Optional[int] = None,\n    models: Optional[list] = None,\n) -> str\n

Generate text for a prompt asynchronously.

Parameters:

Name Type Description Default prompt str

User prompt text.

required system_prompt Optional[str]

Optional system instruction.

None max_tokens Optional[int]

Token cap overriding model defaults.

None models Optional[list]

Model ports overriding the pool defaults.

None

Returns:

Name Type Description str str

Generated content.

"},{"location":"infra/llm/pool/#infra.llm.pool.PoolAdaptor","title":"PoolAdaptor","text":"
PoolAdaptor(**kwargs)\n

Synchronous LLM pool with model rotation.

Attributes:

Name Type Description httpx_client SyncClientPort

Client used for requests.

models list

Model ports available for rotation.

Initialize the pool from keyword configuration.

Parameters:

Name Type Description Default **kwargs

Configuration; httpx_client and models are consumed, remaining keys become instance attributes.

{}"},{"location":"infra/llm/pool/#infra.llm.pool.PoolAdaptor-functions","title":"Functions","text":""},{"location":"infra/llm/pool/#infra.llm.pool.PoolAdaptor.close","title":"close","text":"
close()\n

Close the underlying HTTP client.

"},{"location":"infra/llm/pool/#infra.llm.pool.PoolAdaptor.generate","title":"generate","text":"
generate(\n    prompt: str,\n    system_prompt: Optional[str] = None,\n    max_tokens: Optional[int] = None,\n    models: Optional[list] = None,\n) -> str\n

Generate text for a prompt.

Parameters:

Name Type Description Default prompt str

User prompt text.

required system_prompt Optional[str]

Optional system instruction.

None max_tokens Optional[int]

Token cap overriding model defaults.

None models Optional[list]

Model ports overriding the pool defaults.

None

Returns:

Name Type Description str str

Generated content.

"},{"location":"infra/llm/setup/","title":"Setup","text":""},{"location":"infra/llm/setup/#infra.llm.setup","title":"infra.llm.setup","text":""},{"location":"infra/llm/setup/#infra.llm.setup--summary","title":"Summary","text":"

LLM pool factories resolved from configuration.

Import and instantiate the provider-specific synchronous or asynchronous pool selected by the LLM_PROVIDER environment variable.

"},{"location":"infra/llm/setup/#infra.llm.setup-classes","title":"Classes","text":""},{"location":"infra/llm/setup/#infra.llm.setup-functions","title":"Functions","text":""},{"location":"infra/llm/setup/#infra.llm.setup.setup_async_pool","title":"setup_async_pool","text":"
setup_async_pool(provider: str = None) -> AsyncPoolAdaptor\n

Build an asynchronous pool for the selected provider.

Parameters:

Name Type Description Default provider str

Provider key; defaults to LLM_PROVIDER or open_router.

None

Returns:

Name Type Description AsyncPoolAdaptor AsyncPoolAdaptor

Configured asynchronous pool.

"},{"location":"infra/llm/setup/#infra.llm.setup.setup_sync_pool","title":"setup_sync_pool","text":"
setup_sync_pool(provider: str = None) -> PoolAdaptor\n

Build a synchronous pool for the selected provider.

Parameters:

Name Type Description Default provider str

Provider key; defaults to LLM_PROVIDER or open_router.

None

Returns:

Name Type Description PoolAdaptor PoolAdaptor

Configured synchronous pool.

"},{"location":"infra/llm/providers/","title":"Providers","text":""},{"location":"infra/llm/providers/#infra.llm.providers","title":"infra.llm.providers","text":""},{"location":"infra/llm/providers/#infra.llm.providers--summary","title":"Summary","text":"

LLM provider integrations.

Namespace for provider-specific configuration, model ports, and pool adaptors.

"},{"location":"infra/llm/providers/groq/","title":"Groq","text":""},{"location":"infra/llm/providers/groq/#infra.llm.providers.groq","title":"infra.llm.providers.groq","text":""},{"location":"infra/llm/providers/groq/#infra.llm.providers.groq--summary","title":"Summary","text":"

Groq LLM provider integration.

Expose Groq configuration, model ports, and synchronous/asynchronous pools.

"},{"location":"infra/llm/providers/groq/config/","title":"Config","text":""},{"location":"infra/llm/providers/groq/config/#infra.llm.providers.groq.config","title":"infra.llm.providers.groq.config","text":""},{"location":"infra/llm/providers/groq/config/#infra.llm.providers.groq.config--summary","title":"Summary","text":"

Groq provider configuration loaded from the environment.

Read the Groq API key and endpoint used by the Groq pool adaptors.

"},{"location":"infra/llm/providers/groq/config/#infra.llm.providers.groq.config-classes","title":"Classes","text":""},{"location":"infra/llm/providers/groq/config/#infra.llm.providers.groq.config.GroqConfig","title":"GroqConfig","text":"
GroqConfig()\n

Hold Groq provider credentials and endpoint.

Attributes:

Name Type Description api_key str

Groq API key from GROQ_API_KEY or LLM_API_KEY.

endpoint str

Groq API base URL.

Load Groq configuration from environment variables.

"},{"location":"infra/llm/providers/groq/config/#infra.llm.providers.groq.config.GroqConfig-functions","title":"Functions","text":""},{"location":"infra/llm/providers/groq/models/","title":"Models","text":""},{"location":"infra/llm/providers/groq/models/#infra.llm.providers.groq.models","title":"infra.llm.providers.groq.models","text":""},{"location":"infra/llm/providers/groq/models/#infra.llm.providers.groq.models--summary","title":"Summary","text":"

Groq model port definitions.

Expose the default Groq model identifiers used by the Groq pool adaptors.

"},{"location":"infra/llm/providers/groq/models/#infra.llm.providers.groq.models-classes","title":"Classes","text":""},{"location":"infra/llm/providers/groq/models/#infra.llm.providers.groq.models-functions","title":"Functions","text":""},{"location":"infra/llm/providers/groq/models/#infra.llm.providers.groq.models.create_model_ports","title":"create_model_ports","text":"
create_model_ports()\n

Create the default Groq model ports.

Returns:

Name Type Description list

Model ports for the supported Groq models.

"},{"location":"infra/llm/providers/groq/pool/","title":"Pool","text":""},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool","title":"infra.llm.providers.groq.pool","text":""},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool--summary","title":"Summary","text":"

Groq pool adaptors.

Wire Groq configuration and model ports into the synchronous and asynchronous LLM pool adaptors.

"},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool-classes","title":"Classes","text":""},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool.AsyncGroqPool","title":"AsyncGroqPool","text":"
AsyncGroqPool(**kwargs)\n

Bases: AsyncPoolAdaptor

Asynchronous LLM pool backed by Groq.

Initialize the pool with Groq defaults.

Parameters:

Name Type Description Default **kwargs

Overrides for the client and model ports.

{}"},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool.AsyncGroqPool-functions","title":"Functions","text":""},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool.AsyncGroqPool.aclose","title":"aclose async","text":"
aclose()\n

Close the underlying asynchronous HTTP client.

"},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool.AsyncGroqPool.generate","title":"generate async","text":"
generate(\n    prompt: str,\n    system_prompt: Optional[str] = None,\n    max_tokens: Optional[int] = None,\n    models: Optional[list] = None,\n) -> str\n

Generate text for a prompt asynchronously.

Parameters:

Name Type Description Default prompt str

User prompt text.

required system_prompt Optional[str]

Optional system instruction.

None max_tokens Optional[int]

Token cap overriding model defaults.

None models Optional[list]

Model ports overriding the pool defaults.

None

Returns:

Name Type Description str str

Generated content.

"},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool.SyncGroqPool","title":"SyncGroqPool","text":"
SyncGroqPool(**kwargs)\n

Bases: PoolAdaptor

Synchronous LLM pool backed by Groq.

Initialize the pool with Groq defaults.

Parameters:

Name Type Description Default **kwargs

Overrides for the client and model ports.

{}"},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool.SyncGroqPool-functions","title":"Functions","text":""},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool.SyncGroqPool.close","title":"close","text":"
close()\n

Close the underlying HTTP client.

"},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool.SyncGroqPool.generate","title":"generate","text":"
generate(\n    prompt: str,\n    system_prompt: Optional[str] = None,\n    max_tokens: Optional[int] = None,\n    models: Optional[list] = None,\n) -> str\n

Generate text for a prompt.

Parameters:

Name Type Description Default prompt str

User prompt text.

required system_prompt Optional[str]

Optional system instruction.

None max_tokens Optional[int]

Token cap overriding model defaults.

None models Optional[list]

Model ports overriding the pool defaults.

None

Returns:

Name Type Description str str

Generated content.

"},{"location":"infra/llm/providers/groq/pool/#infra.llm.providers.groq.pool-functions","title":"Functions","text":""},{"location":"infra/llm/providers/llama_parser/","title":"Llama Parser","text":""},{"location":"infra/llm/providers/llama_parser/#infra.llm.providers.llama_parser","title":"infra.llm.providers.llama_parser","text":""},{"location":"infra/llm/providers/llama_parser/#infra.llm.providers.llama_parser--summary","title":"Summary","text":"

LlamaCloud statement parser integration.

Expose parser configuration, extraction models, and the parser pool adaptor.

"},{"location":"infra/llm/providers/llama_parser/config/","title":"Config","text":""},{"location":"infra/llm/providers/llama_parser/config/#infra.llm.providers.llama_parser.config","title":"infra.llm.providers.llama_parser.config","text":""},{"location":"infra/llm/providers/llama_parser/config/#infra.llm.providers.llama_parser.config--summary","title":"Summary","text":"

LlamaCloud parser configuration loaded from the environment.

Read the LlamaCloud API key used by the parser adaptor.

"},{"location":"infra/llm/providers/llama_parser/config/#infra.llm.providers.llama_parser.config-classes","title":"Classes","text":""},{"location":"infra/llm/providers/llama_parser/config/#infra.llm.providers.llama_parser.config.LlamaParserConfig","title":"LlamaParserConfig","text":"
LlamaParserConfig()\n

Hold LlamaCloud parser credentials.

Attributes:

Name Type Description api_key str

LlamaCloud API key from LLAMA_CLOUD_API_KEY.

Load parser configuration from environment variables.

"},{"location":"infra/llm/providers/llama_parser/config/#infra.llm.providers.llama_parser.config.LlamaParserConfig-functions","title":"Functions","text":""},{"location":"infra/llm/providers/llama_parser/models/","title":"Models","text":""},{"location":"infra/llm/providers/llama_parser/models/#infra.llm.providers.llama_parser.models","title":"infra.llm.providers.llama_parser.models","text":""},{"location":"infra/llm/providers/llama_parser/models/#infra.llm.providers.llama_parser.models--summary","title":"Summary","text":"

Pydantic models for statement extraction results.

Define the transaction schema returned by LlamaCloud extraction and the default extraction configuration.

"},{"location":"infra/llm/providers/llama_parser/models/#infra.llm.providers.llama_parser.models-classes","title":"Classes","text":""},{"location":"infra/llm/providers/llama_parser/models/#infra.llm.providers.llama_parser.models.Direction","title":"Direction","text":"

Bases: str, Enum

Transaction direction.

Attributes:

Name Type Description DEBIT str

Debit transaction direction.

CREDIT str

Credit transaction direction.

"},{"location":"infra/llm/providers/llama_parser/models/#infra.llm.providers.llama_parser.models.RawExpense","title":"RawExpense","text":"

Bases: BaseModel

A single extracted statement transaction.

Attributes:

Name Type Description date str

Expense date as DD-MM-YYYY.

amount float

Transaction amount.

balance float

Account balance after transaction.

description str

Complete reconstructed transaction description.

raw_lines List[str]

Raw OCR/text lines that form this transaction.

direction Direction

Either DEBIT or CREDIT.

"},{"location":"infra/llm/providers/llama_parser/models/#infra.llm.providers.llama_parser.models.Statement","title":"Statement","text":"

Bases: BaseModel

Extraction result containing parsed transactions.

Attributes:

Name Type Description transactions List[RawExpense]

Extracted transactions.

"},{"location":"infra/llm/providers/llama_parser/pool/","title":"Pool","text":""},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool","title":"infra.llm.providers.llama_parser.pool","text":""},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool--summary","title":"Summary","text":"

LlamaCloud statement parser adaptor.

Upload a statement PDF to LlamaCloud for extraction, or replay a cached CSV, returning normalized transaction dictionaries.

"},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool-classes","title":"Classes","text":""},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.AsyncLlamaParserPool","title":"AsyncLlamaParserPool","text":"
AsyncLlamaParserPool(**kwargs)\n

Bases: LlamaParserAdaptor

LLM parser pool configured from the environment.

Initialize the pool with configuration defaults.

Parameters:

Name Type Description Default **kwargs

Overrides passed to the parser adaptor.

{}"},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.AsyncLlamaParserPool-attributes","title":"Attributes","text":""},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.AsyncLlamaParserPool.client","title":"client property","text":"
client: AsyncLlamaCloud\n

Return the lazily initialized LlamaCloud client.

Returns:

Name Type Description AsyncLlamaCloud AsyncLlamaCloud

Authenticated LlamaCloud client.

Raises:

Type Description ValueError

When no API key is configured.

"},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.AsyncLlamaParserPool-functions","title":"Functions","text":""},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.AsyncLlamaParserPool.aclose","title":"aclose async","text":"
aclose()\n

Close the LlamaCloud client if it was created.

"},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.AsyncLlamaParserPool.generate_statement","title":"generate_statement async","text":"
generate_statement(\n    filepath: Union[str, os.PathLike],\n    cached: Optional[Union[str, os.PathLike]] = None,\n) -> List[dict]\n

Extract transactions from a statement PDF.

When cached points to a CSV previously exported by scripts/llama_txns_extractor.py, read it and validate each row into RawExpense models instead of calling LlamaCloud.

Parameters:

Name Type Description Default filepath Union[str, PathLike]

Path to the statement PDF.

required cached Optional[Union[str, PathLike]]

Path to a cached CSV export.

None

Returns:

Type Description List[dict]

List[dict]: Extracted transaction dictionaries.

"},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.LlamaParserAdaptor","title":"LlamaParserAdaptor","text":"
LlamaParserAdaptor(**kwargs)\n

Extract transactions through the LlamaCloud API.

Attributes:

Name Type Description api_key str

LlamaCloud API key.

extract_config dict

Extraction configuration payload.

_client Optional[AsyncLlamaCloud]

Lazily created API client.

Initialize the parser adaptor.

Parameters:

Name Type Description Default **kwargs

Configuration; api_key and extract_config are consumed, remaining keys become instance attributes.

{}"},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.LlamaParserAdaptor-attributes","title":"Attributes","text":""},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.LlamaParserAdaptor.client","title":"client property","text":"
client: AsyncLlamaCloud\n

Return the lazily initialized LlamaCloud client.

Returns:

Name Type Description AsyncLlamaCloud AsyncLlamaCloud

Authenticated LlamaCloud client.

Raises:

Type Description ValueError

When no API key is configured.

"},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.LlamaParserAdaptor-functions","title":"Functions","text":""},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.LlamaParserAdaptor.aclose","title":"aclose async","text":"
aclose()\n

Close the LlamaCloud client if it was created.

"},{"location":"infra/llm/providers/llama_parser/pool/#infra.llm.providers.llama_parser.pool.LlamaParserAdaptor.generate_statement","title":"generate_statement async","text":"
generate_statement(\n    filepath: Union[str, os.PathLike],\n    cached: Optional[Union[str, os.PathLike]] = None,\n) -> List[dict]\n

Extract transactions from a statement PDF.

When cached points to a CSV previously exported by scripts/llama_txns_extractor.py, read it and validate each row into RawExpense models instead of calling LlamaCloud.

Parameters:

Name Type Description Default filepath Union[str, PathLike]

Path to the statement PDF.

required cached Optional[Union[str, PathLike]]

Path to a cached CSV export.

None

Returns:

Type Description List[dict]

List[dict]: Extracted transaction dictionaries.

"},{"location":"infra/llm/providers/open_ai/","title":"Open Ai","text":""},{"location":"infra/llm/providers/open_ai/#infra.llm.providers.open_ai","title":"infra.llm.providers.open_ai","text":""},{"location":"infra/llm/providers/open_ai/#infra.llm.providers.open_ai--summary","title":"Summary","text":"

OpenAI LLM provider integration.

Expose OpenAI configuration, model ports, and synchronous/asynchronous pools.

"},{"location":"infra/llm/providers/open_ai/config/","title":"Config","text":""},{"location":"infra/llm/providers/open_ai/config/#infra.llm.providers.open_ai.config","title":"infra.llm.providers.open_ai.config","text":""},{"location":"infra/llm/providers/open_ai/config/#infra.llm.providers.open_ai.config--summary","title":"Summary","text":"

OpenAI provider configuration loaded from the environment.

Read the OpenAI API key and endpoint used by the OpenAI pool adaptors.

"},{"location":"infra/llm/providers/open_ai/config/#infra.llm.providers.open_ai.config-classes","title":"Classes","text":""},{"location":"infra/llm/providers/open_ai/config/#infra.llm.providers.open_ai.config.OpenAiConfig","title":"OpenAiConfig","text":"
OpenAiConfig()\n

Hold OpenAI provider credentials and endpoint.

Attributes:

Name Type Description api_key str

OpenAI API key from OPENAI_API_KEY.

endpoint str

OpenAI API base URL.

Load OpenAI configuration from environment variables.

"},{"location":"infra/llm/providers/open_ai/config/#infra.llm.providers.open_ai.config.OpenAiConfig-functions","title":"Functions","text":""},{"location":"infra/llm/providers/open_ai/models/","title":"Models","text":""},{"location":"infra/llm/providers/open_ai/models/#infra.llm.providers.open_ai.models","title":"infra.llm.providers.open_ai.models","text":""},{"location":"infra/llm/providers/open_ai/models/#infra.llm.providers.open_ai.models--summary","title":"Summary","text":"

OpenAI model port definitions.

Expose the default OpenAI model identifiers used by the OpenAI pool adaptors.

"},{"location":"infra/llm/providers/open_ai/models/#infra.llm.providers.open_ai.models-classes","title":"Classes","text":""},{"location":"infra/llm/providers/open_ai/models/#infra.llm.providers.open_ai.models-functions","title":"Functions","text":""},{"location":"infra/llm/providers/open_ai/models/#infra.llm.providers.open_ai.models.create_model_ports","title":"create_model_ports","text":"
create_model_ports()\n

Create the default OpenAI model ports.

Returns:

Name Type Description list

Model ports for the supported OpenAI models.

"},{"location":"infra/llm/providers/open_ai/pool/","title":"Pool","text":""},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool","title":"infra.llm.providers.open_ai.pool","text":""},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool--summary","title":"Summary","text":"

OpenAI pool adaptors.

Wire OpenAI configuration and model ports into the synchronous and asynchronous LLM pool adaptors.

"},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool-classes","title":"Classes","text":""},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool.AsyncOpenAiPool","title":"AsyncOpenAiPool","text":"
AsyncOpenAiPool(**kwargs)\n

Bases: AsyncPoolAdaptor

Asynchronous LLM pool backed by OpenAI.

Initialize the pool with OpenAI defaults.

Parameters:

Name Type Description Default **kwargs

Overrides for the client and model ports.

{}"},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool.AsyncOpenAiPool-functions","title":"Functions","text":""},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool.AsyncOpenAiPool.aclose","title":"aclose async","text":"
aclose()\n

Close the underlying asynchronous HTTP client.

"},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool.AsyncOpenAiPool.generate","title":"generate async","text":"
generate(\n    prompt: str,\n    system_prompt: Optional[str] = None,\n    max_tokens: Optional[int] = None,\n    models: Optional[list] = None,\n) -> str\n

Generate text for a prompt asynchronously.

Parameters:

Name Type Description Default prompt str

User prompt text.

required system_prompt Optional[str]

Optional system instruction.

None max_tokens Optional[int]

Token cap overriding model defaults.

None models Optional[list]

Model ports overriding the pool defaults.

None

Returns:

Name Type Description str str

Generated content.

"},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool.SyncOpenAiPool","title":"SyncOpenAiPool","text":"
SyncOpenAiPool(**kwargs)\n

Bases: PoolAdaptor

Synchronous LLM pool backed by OpenAI.

Initialize the pool with OpenAI defaults.

Parameters:

Name Type Description Default **kwargs

Overrides for the client and model ports.

{}"},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool.SyncOpenAiPool-functions","title":"Functions","text":""},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool.SyncOpenAiPool.close","title":"close","text":"
close()\n

Close the underlying HTTP client.

"},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool.SyncOpenAiPool.generate","title":"generate","text":"
generate(\n    prompt: str,\n    system_prompt: Optional[str] = None,\n    max_tokens: Optional[int] = None,\n    models: Optional[list] = None,\n) -> str\n

Generate text for a prompt.

Parameters:

Name Type Description Default prompt str

User prompt text.

required system_prompt Optional[str]

Optional system instruction.

None max_tokens Optional[int]

Token cap overriding model defaults.

None models Optional[list]

Model ports overriding the pool defaults.

None

Returns:

Name Type Description str str

Generated content.

"},{"location":"infra/llm/providers/open_ai/pool/#infra.llm.providers.open_ai.pool-functions","title":"Functions","text":""},{"location":"infra/llm/providers/open_router/","title":"Open Router","text":""},{"location":"infra/llm/providers/open_router/#infra.llm.providers.open_router","title":"infra.llm.providers.open_router","text":""},{"location":"infra/llm/providers/open_router/#infra.llm.providers.open_router--summary","title":"Summary","text":"

OpenRouter LLM provider integration.

Expose OpenRouter configuration, model ports, and synchronous/asynchronous pools.

"},{"location":"infra/llm/providers/open_router/config/","title":"Config","text":""},{"location":"infra/llm/providers/open_router/config/#infra.llm.providers.open_router.config","title":"infra.llm.providers.open_router.config","text":""},{"location":"infra/llm/providers/open_router/config/#infra.llm.providers.open_router.config--summary","title":"Summary","text":"

OpenRouter provider configuration loaded from the environment.

Read the OpenRouter API key and endpoint used by the OpenRouter pool adaptors.

"},{"location":"infra/llm/providers/open_router/config/#infra.llm.providers.open_router.config-classes","title":"Classes","text":""},{"location":"infra/llm/providers/open_router/config/#infra.llm.providers.open_router.config.OpenRouterConfig","title":"OpenRouterConfig","text":"
OpenRouterConfig()\n

Hold OpenRouter provider credentials and endpoint.

Attributes:

Name Type Description api_key str

OpenRouter API key from OPENROUTER_API_KEY or LLM_API_KEY.

endpoint str

OpenRouter API base URL.

Load OpenRouter configuration from environment variables.

"},{"location":"infra/llm/providers/open_router/config/#infra.llm.providers.open_router.config.OpenRouterConfig-functions","title":"Functions","text":""},{"location":"infra/llm/providers/open_router/models/","title":"Models","text":""},{"location":"infra/llm/providers/open_router/models/#infra.llm.providers.open_router.models","title":"infra.llm.providers.open_router.models","text":""},{"location":"infra/llm/providers/open_router/models/#infra.llm.providers.open_router.models--summary","title":"Summary","text":"

OpenRouter model port definitions.

Expose the default OpenRouter model identifiers used by the OpenRouter pool adaptors.

"},{"location":"infra/llm/providers/open_router/models/#infra.llm.providers.open_router.models-classes","title":"Classes","text":""},{"location":"infra/llm/providers/open_router/models/#infra.llm.providers.open_router.models-functions","title":"Functions","text":""},{"location":"infra/llm/providers/open_router/models/#infra.llm.providers.open_router.models.create_model_ports","title":"create_model_ports","text":"
create_model_ports()\n

Create the default OpenRouter model ports.

Returns:

Name Type Description list

Model ports for the supported OpenRouter models.

"},{"location":"infra/llm/providers/open_router/pool/","title":"Pool","text":""},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool","title":"infra.llm.providers.open_router.pool","text":""},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool--summary","title":"Summary","text":"

OpenRouter pool adaptors.

Wire OpenRouter configuration and model ports into the synchronous and asynchronous LLM pool adaptors.

"},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool-classes","title":"Classes","text":""},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool.AsyncOpenRouterPool","title":"AsyncOpenRouterPool","text":"
AsyncOpenRouterPool(**kwargs)\n

Bases: AsyncPoolAdaptor

Asynchronous LLM pool backed by OpenRouter.

Initialize the pool with OpenRouter defaults.

Parameters:

Name Type Description Default **kwargs

Overrides for the client and model ports.

{}"},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool.AsyncOpenRouterPool-functions","title":"Functions","text":""},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool.AsyncOpenRouterPool.aclose","title":"aclose async","text":"
aclose()\n

Close the underlying asynchronous HTTP client.

"},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool.AsyncOpenRouterPool.generate","title":"generate async","text":"
generate(\n    prompt: str,\n    system_prompt: Optional[str] = None,\n    max_tokens: Optional[int] = None,\n    models: Optional[list] = None,\n) -> str\n

Generate text for a prompt asynchronously.

Parameters:

Name Type Description Default prompt str

User prompt text.

required system_prompt Optional[str]

Optional system instruction.

None max_tokens Optional[int]

Token cap overriding model defaults.

None models Optional[list]

Model ports overriding the pool defaults.

None

Returns:

Name Type Description str str

Generated content.

"},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool.SyncOpenRouterPool","title":"SyncOpenRouterPool","text":"
SyncOpenRouterPool(**kwargs)\n

Bases: PoolAdaptor

Synchronous LLM pool backed by OpenRouter.

Initialize the pool with OpenRouter defaults.

Parameters:

Name Type Description Default **kwargs

Overrides for the client and model ports.

{}"},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool.SyncOpenRouterPool-functions","title":"Functions","text":""},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool.SyncOpenRouterPool.close","title":"close","text":"
close()\n

Close the underlying HTTP client.

"},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool.SyncOpenRouterPool.generate","title":"generate","text":"
generate(\n    prompt: str,\n    system_prompt: Optional[str] = None,\n    max_tokens: Optional[int] = None,\n    models: Optional[list] = None,\n) -> str\n

Generate text for a prompt.

Parameters:

Name Type Description Default prompt str

User prompt text.

required system_prompt Optional[str]

Optional system instruction.

None max_tokens Optional[int]

Token cap overriding model defaults.

None models Optional[list]

Model ports overriding the pool defaults.

None

Returns:

Name Type Description str str

Generated content.

"},{"location":"infra/llm/providers/open_router/pool/#infra.llm.providers.open_router.pool-functions","title":"Functions","text":""},{"location":"interfaces/","title":"Interfaces","text":""},{"location":"interfaces/#interfaces","title":"interfaces","text":""},{"location":"interfaces/#interfaces--summary","title":"Summary","text":"

Thin entry points for the Aetoskia Expenses Service: FastAPI route handlers wired to openapi.yaml operationIds, SSE handlers, and CLI commands. Handlers stay thin and delegate to domain services; business logic lives in the domain layer.

"},{"location":"interfaces/auth/","title":"Auth","text":""},{"location":"interfaces/auth/#interfaces.auth","title":"interfaces.auth","text":""},{"location":"interfaces/auth/#interfaces.auth--summary","title":"Summary","text":"

Auth interface: thin FastAPI entry points related to authentication, wired to openapi.yaml operationIds by the OpenAPI-first router.

"},{"location":"interfaces/openapi/","title":"Openapi","text":""},{"location":"interfaces/openapi/#interfaces.openapi","title":"interfaces.openapi","text":""},{"location":"interfaces/openapi/#interfaces.openapi--summary","title":"Summary","text":"

All handler functions \u2014 names must match openapi.yaml operationId values. The OpenAPI-first router resolves each operation to a handler by name, so this module re-exports every route handler from the subpackages into one flat namespace.

"},{"location":"interfaces/openapi/#interfaces.openapi-classes","title":"Classes","text":""},{"location":"interfaces/openapi/#interfaces.openapi.AccountCrudsService","title":"AccountCrudsService","text":"
AccountCrudsService(*, repo=None)\n

Bases: CrudsServiceAdaptor[Account, AccountDocument]

Account CRUD service resolving :class:Account documents from a repo.

Notes

Instances are created by :func:get_account_service. The model and schema class attributes bind the domain model and its document type.

Initialize the adaptor with a backing repository.

Parameters:

Name Type Description Default repo BaseRepository

Repository used for all operations.

None"},{"location":"interfaces/openapi/#interfaces.openapi.AccountCrudsService-functions","title":"Functions","text":""},{"location":"interfaces/openapi/#interfaces.openapi.AccountCrudsService.create","title":"create async","text":"
create(data: Model | dict) -> Schema\n

Create a document from a model or raw mapping.

Parameters:

Name Type Description Default data Model | dict

Model instance or field mapping to persist.

required

Returns:

Name Type Description Schema Schema

Persisted document.

"},{"location":"interfaces/openapi/#interfaces.openapi.AccountCrudsService.delete","title":"delete async","text":"
delete(id: PyObjectId) -> bool\n

Delete a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Name Type Description bool bool

True when a document was deleted.

"},{"location":"interfaces/openapi/#interfaces.openapi.AccountCrudsService.model_to_dict","title":"model_to_dict staticmethod","text":"
model_to_dict(model_obj: Model) -> dict\n

Serialize a model into a sparse dictionary.

Parameters:

Name Type Description Default model_obj Model

Model instance to serialize.

required

Returns:

Name Type Description dict dict

Fields that are set and not None.

"},{"location":"interfaces/openapi/#interfaces.openapi.AccountCrudsService.patch","title":"patch async","text":"
patch(id: PyObjectId, data: dict) -> Schema | None\n

Partially update a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data dict

Fields to patch.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.AccountCrudsService.read","title":"read async","text":"
read(id: PyObjectId) -> Schema | None\n

Read a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Type Description Schema | None

Schema | None: Matching document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.AccountCrudsService.search","title":"search async","text":"
search(\n    filter: dict | None = None, *args, **kwargs\n) -> list[Schema]\n

List documents matching an optional filter.

Parameters:

Name Type Description Default filter dict | None

Query filter passed to the repository.

None

Returns:

Type Description list[Schema]

list[Schema]: Matching documents.

Notes

Extra positional and keyword arguments are forwarded to the repository.

"},{"location":"interfaces/openapi/#interfaces.openapi.AccountCrudsService.update","title":"update async","text":"
update(id: PyObjectId, data: Model | dict) -> Schema | None\n

Replace a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data Model | dict

Replacement model or field mapping.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.EntityCrudsService","title":"EntityCrudsService","text":"
EntityCrudsService(*, repo=None)\n

Bases: CrudsServiceAdaptor[Entity, EntityDocument]

Entity CRUD service resolving :class:Entity documents from a repo.

Notes

Instances are created by :func:get_entity_service. The model and schema class attributes bind the domain model and its document type.

Initialize the adaptor with a backing repository.

Parameters:

Name Type Description Default repo BaseRepository

Repository used for all operations.

None"},{"location":"interfaces/openapi/#interfaces.openapi.EntityCrudsService-functions","title":"Functions","text":""},{"location":"interfaces/openapi/#interfaces.openapi.EntityCrudsService.create","title":"create async","text":"
create(data: Model | dict) -> Schema\n

Create a document from a model or raw mapping.

Parameters:

Name Type Description Default data Model | dict

Model instance or field mapping to persist.

required

Returns:

Name Type Description Schema Schema

Persisted document.

"},{"location":"interfaces/openapi/#interfaces.openapi.EntityCrudsService.delete","title":"delete async","text":"
delete(id: PyObjectId) -> bool\n

Delete a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Name Type Description bool bool

True when a document was deleted.

"},{"location":"interfaces/openapi/#interfaces.openapi.EntityCrudsService.model_to_dict","title":"model_to_dict staticmethod","text":"
model_to_dict(model_obj: Model) -> dict\n

Serialize a model into a sparse dictionary.

Parameters:

Name Type Description Default model_obj Model

Model instance to serialize.

required

Returns:

Name Type Description dict dict

Fields that are set and not None.

"},{"location":"interfaces/openapi/#interfaces.openapi.EntityCrudsService.patch","title":"patch async","text":"
patch(id: PyObjectId, data: dict) -> Schema | None\n

Partially update a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data dict

Fields to patch.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.EntityCrudsService.read","title":"read async","text":"
read(id: PyObjectId) -> Schema | None\n

Read a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Type Description Schema | None

Schema | None: Matching document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.EntityCrudsService.search","title":"search async","text":"
search(\n    filter: dict | None = None, *args, **kwargs\n) -> list[Schema]\n

List documents matching an optional filter.

Parameters:

Name Type Description Default filter dict | None

Query filter passed to the repository.

None

Returns:

Type Description list[Schema]

list[Schema]: Matching documents.

Notes

Extra positional and keyword arguments are forwarded to the repository.

"},{"location":"interfaces/openapi/#interfaces.openapi.EntityCrudsService.update","title":"update async","text":"
update(id: PyObjectId, data: Model | dict) -> Schema | None\n

Replace a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data Model | dict

Replacement model or field mapping.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.ExpenseCrudsService","title":"ExpenseCrudsService","text":"
ExpenseCrudsService(*, repo=None)\n

Bases: CrudsServiceAdaptor[Expense, ExpenseDocument]

Expense CRUD service resolving :class:Expense documents from a repo.

Notes

Instances are created by :func:get_expense_service. The model and schema class attributes bind the domain model and its document type.

Initialize the adaptor with a backing repository.

Parameters:

Name Type Description Default repo BaseRepository

Repository used for all operations.

None"},{"location":"interfaces/openapi/#interfaces.openapi.ExpenseCrudsService-functions","title":"Functions","text":""},{"location":"interfaces/openapi/#interfaces.openapi.ExpenseCrudsService.create","title":"create async","text":"
create(data: Model | dict) -> Schema\n

Create a document from a model or raw mapping.

Parameters:

Name Type Description Default data Model | dict

Model instance or field mapping to persist.

required

Returns:

Name Type Description Schema Schema

Persisted document.

"},{"location":"interfaces/openapi/#interfaces.openapi.ExpenseCrudsService.delete","title":"delete async","text":"
delete(id: PyObjectId) -> bool\n

Delete a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Name Type Description bool bool

True when a document was deleted.

"},{"location":"interfaces/openapi/#interfaces.openapi.ExpenseCrudsService.model_to_dict","title":"model_to_dict staticmethod","text":"
model_to_dict(model_obj: Model) -> dict\n

Serialize a model into a sparse dictionary.

Parameters:

Name Type Description Default model_obj Model

Model instance to serialize.

required

Returns:

Name Type Description dict dict

Fields that are set and not None.

"},{"location":"interfaces/openapi/#interfaces.openapi.ExpenseCrudsService.patch","title":"patch async","text":"
patch(id: PyObjectId, data: dict) -> Schema | None\n

Partially update a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data dict

Fields to patch.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.ExpenseCrudsService.read","title":"read async","text":"
read(id: PyObjectId) -> Schema | None\n

Read a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Type Description Schema | None

Schema | None: Matching document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.ExpenseCrudsService.search","title":"search async","text":"
search(\n    filter: dict | None = None, *args, **kwargs\n) -> list[Schema]\n

List documents matching an optional filter.

Parameters:

Name Type Description Default filter dict | None

Query filter passed to the repository.

None

Returns:

Type Description list[Schema]

list[Schema]: Matching documents.

Notes

Extra positional and keyword arguments are forwarded to the repository.

"},{"location":"interfaces/openapi/#interfaces.openapi.ExpenseCrudsService.update","title":"update async","text":"
update(id: PyObjectId, data: Model | dict) -> Schema | None\n

Replace a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data Model | dict

Replacement model or field mapping.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService","title":"FetchRequestCrudsService","text":"
FetchRequestCrudsService(*, repo=None)\n

Bases: CrudsServiceAdaptor[FetchRequest, FetchRequestDocument]

CRUD service for fetch requests with pipeline stage helpers.

Attributes:

Name Type Description model FetchRequest

Domain model class.

schema FetchRequestDocument

Persistence document class.

Initialize the adaptor with a backing repository.

Parameters:

Name Type Description Default repo BaseRepository

Repository used for all operations.

None"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService-functions","title":"Functions","text":""},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.create","title":"create async","text":"
create(data: Model | dict) -> Schema\n

Create a document from a model or raw mapping.

Parameters:

Name Type Description Default data Model | dict

Model instance or field mapping to persist.

required

Returns:

Name Type Description Schema Schema

Persisted document.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.delete","title":"delete async","text":"
delete(id: PyObjectId) -> bool\n

Delete a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Name Type Description bool bool

True when a document was deleted.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.model_to_dict","title":"model_to_dict staticmethod","text":"
model_to_dict(model_obj: Model) -> dict\n

Serialize a model into a sparse dictionary.

Parameters:

Name Type Description Default model_obj Model

Model instance to serialize.

required

Returns:

Name Type Description dict dict

Fields that are set and not None.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.patch","title":"patch async","text":"
patch(id: PyObjectId, data: dict) -> Schema | None\n

Partially update a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data dict

Fields to patch.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.read","title":"read async","text":"
read(id: PyObjectId) -> Schema | None\n

Read a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Type Description Schema | None

Schema | None: Matching document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.save_enrichment","title":"save_enrichment async","text":"
save_enrichment(\n    id: PyObjectId, enrichment_dicts: list\n) -> None\n

Persist the enriched expense dicts on the request source.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required enrichment_dicts list

Enriched expense dicts.

required

Returns:

Name Type Description None None

Nothing.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.save_raw_lines","title":"save_raw_lines async","text":"
save_raw_lines(id: PyObjectId, raw_lines: list) -> None\n

Persist the extracted raw lines on the request source.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required raw_lines list

Raw OCR/text lines.

required

Returns:

Name Type Description None None

Nothing.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.save_txn_blocks","title":"save_txn_blocks async","text":"
save_txn_blocks(id: PyObjectId, txn_blocks: dict) -> None\n

Persist the extracted transaction blocks on the request source.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required txn_blocks dict

Transaction blocks keyed by order id.

required

Returns:

Name Type Description None None

Nothing.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.save_txn_dicts","title":"save_txn_dicts async","text":"
save_txn_dicts(\n    id: PyObjectId, txn_dicts: list, txn_dicts_count: int\n) -> None\n

Persist the parsed transaction dicts and count on the request source.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required txn_dicts list

Raw expense dicts.

required txn_dicts_count int

Number of parsed transaction dicts.

required

Returns:

Name Type Description None None

Nothing.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.search","title":"search async","text":"
search(\n    filter: dict | None = None, *args, **kwargs\n) -> list[Schema]\n

List documents matching an optional filter.

Parameters:

Name Type Description Default filter dict | None

Query filter passed to the repository.

None

Returns:

Type Description list[Schema]

list[Schema]: Matching documents.

Notes

Extra positional and keyword arguments are forwarded to the repository.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.update","title":"update async","text":"
update(id: PyObjectId, data: Model | dict) -> Schema | None\n

Replace a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data Model | dict

Replacement model or field mapping.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.FetchRequestCrudsService.update_status","title":"update_status async","text":"
update_status(\n    id: PyObjectId,\n    status: str,\n    error_message: Optional[str] = None,\n    retry_count: Optional[int] = None,\n) -> bool\n

Update the request status, optionally carrying failure detail.

Parameters:

Name Type Description Default id PyObjectId

Fetch request id.

required status str

New status value.

required error_message Optional[str]

Message recorded when failing.

None retry_count Optional[int]

Retry counter recorded when failing.

None

Returns:

Name Type Description bool bool

True when a document was patched.

Raises:

Type Description ValueError

If status == \"failed\" and either error_message or retry_count is None.

"},{"location":"interfaces/openapi/#interfaces.openapi.ReportQuery","title":"ReportQuery","text":"

Bases: BaseModel

Definition of a report snapshot. Bounds the data set; dimensions are sliced at read time.

Attributes:

Name Type Description name str

Snapshot name; empty for an auto-generated name.

granularities List[str]

Granularities to precompute in the cube.

group_dims List[str]

Dimensions to group by, e.g. \"payee\", \"tag\".

flow str

Flow filter: inflows, outflows, or both.

accounts Optional[List[str]]

Account names to include; all when None.

ignore_self bool

Exclude self-transfer tagged expenses.

start_date str

Inclusive start boundary, DD-MM-YYYY.

end_date str

Inclusive end boundary, DD-MM-YYYY.

min_amount Optional[float]

Minimum absolute amount to include.

max_amount Optional[float]

Maximum absolute amount to include.

"},{"location":"interfaces/openapi/#interfaces.openapi.ReportService","title":"ReportService","text":"
ReportService(\n    expense_svc: ExpenseCrudsService,\n    tag_svc: TagCrudsService,\n    store: ReportStore,\n    report_repo=None,\n)\n

Build, persist, and serve precomputed report snapshots.

Notes

Instances are created by :func:get_report_service. The service scans expenses in batches, expands tag hierarchies, and persists period series into the configured :class:ReportStore.

Initialize the report service with its dependencies.

Parameters:

Name Type Description Default expense_svc ExpenseCrudsService

Expense CRUD service used as the cube source.

required tag_svc TagCrudsService

Tag CRUD service used to expand tag hierarchies and resolve ignore tags.

required store ReportStore

Key-value store for cube period data.

required report_repo Any

Report snapshot repository; defaults to :func:create_report_repo when omitted.

None"},{"location":"interfaces/openapi/#interfaces.openapi.ReportService-functions","title":"Functions","text":""},{"location":"interfaces/openapi/#interfaces.openapi.ReportService.delete_snapshot","title":"delete_snapshot async","text":"
delete_snapshot(report_id: str) -> bool\n

Delete a snapshot and all of its cube keys from the store.

Parameters:

Name Type Description Default report_id str

Snapshot ID to delete.

required

Returns:

Name Type Description bool bool

True when the snapshot existed and was deleted.

"},{"location":"interfaces/openapi/#interfaces.openapi.ReportService.fetch_report","title":"fetch_report async","text":"
fetch_report(\n    report_id: str,\n    granularities: Optional[List[str]] = None,\n    period_ids: Optional[List[str]] = None,\n    flow: str = \"outflows\",\n    payees: Optional[List[str]] = None,\n    tags: Optional[List[str]] = None,\n) -> Optional[Report]\n

Slice a stored snapshot into a report API response.

\"*\" in payees or tags expands to every value stored in the cube meta.

Parameters:

Name Type Description Default report_id str

Snapshot ID to slice.

required granularities Optional[List[str]]

Granularities to include; defaults to the snapshot's own.

None period_ids Optional[List[str]]

Period labels to filter to.

None flow str

Flow to serve; both includes inflows and outflows.

'outflows' payees Optional[List[str]]

Payee filters applied per bucket.

None tags Optional[List[str]]

Tag path filters applied per bucket.

None

Returns:

Type Description Optional[Report]

Optional[Report]: The sliced report view, or None when the snapshot does not exist.

"},{"location":"interfaces/openapi/#interfaces.openapi.ReportService.generate_snapshot","title":"generate_snapshot async","text":"
generate_snapshot(\n    query: ReportQuery,\n) -> ReportSnapshotDocument\n

Validate a query and return an existing or newly built snapshot.

If a snapshot with the same canonical signature already exists it is returned directly; otherwise a fresh cube is built and persisted.

Parameters:

Name Type Description Default query ReportQuery

Raw snapshot definition.

required

Returns:

Name Type Description ReportSnapshotDocument ReportSnapshotDocument

The existing or newly created snapshot.

"},{"location":"interfaces/openapi/#interfaces.openapi.ReportService.list_snapshots","title":"list_snapshots async","text":"
list_snapshots(\n    offset: int = 0, limit: int = DEFAULT_LIMIT\n) -> List[ReportSnapshotDocument]\n

List stored snapshots, newest first.

Parameters:

Name Type Description Default offset int

Number of snapshots to skip.

0 limit int

Maximum number of snapshots to return.

DEFAULT_LIMIT

Returns:

Type Description List[ReportSnapshotDocument]

List[ReportSnapshotDocument]: Snapshots ordered by creation time, newest first.

"},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService","title":"TagCrudsService","text":"
TagCrudsService(*, repo=None)\n

Bases: CrudsServiceAdaptor[Tag, TagDocument]

Tag CRUD service resolving :class:Tag documents from a repo.

Notes

Instances are created by :func:get_tag_service. The model and schema class attributes bind the domain model and its document type. An additional lookup helper get_by_names is provided.

Initialize the adaptor with a backing repository.

Parameters:

Name Type Description Default repo BaseRepository

Repository used for all operations.

None"},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService-functions","title":"Functions","text":""},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService.create","title":"create async","text":"
create(data: Model | dict) -> Schema\n

Create a document from a model or raw mapping.

Parameters:

Name Type Description Default data Model | dict

Model instance or field mapping to persist.

required

Returns:

Name Type Description Schema Schema

Persisted document.

"},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService.delete","title":"delete async","text":"
delete(id: PyObjectId) -> bool\n

Delete a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Name Type Description bool bool

True when a document was deleted.

"},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService.get_by_names","title":"get_by_names async","text":"
get_by_names(names: list[str])\n

Return tags whose names match any of the provided values.

Parameters:

Name Type Description Default names list[str]

Tag names to look up.

required

Returns:

Name Type Description list

Matching tag documents.

"},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService.model_to_dict","title":"model_to_dict staticmethod","text":"
model_to_dict(model_obj: Model) -> dict\n

Serialize a model into a sparse dictionary.

Parameters:

Name Type Description Default model_obj Model

Model instance to serialize.

required

Returns:

Name Type Description dict dict

Fields that are set and not None.

"},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService.patch","title":"patch async","text":"
patch(id: PyObjectId, data: dict) -> Schema | None\n

Partially update a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data dict

Fields to patch.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService.read","title":"read async","text":"
read(id: PyObjectId) -> Schema | None\n

Read a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Type Description Schema | None

Schema | None: Matching document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService.search","title":"search async","text":"
search(\n    filter: dict | None = None, *args, **kwargs\n) -> list[Schema]\n

List documents matching an optional filter.

Parameters:

Name Type Description Default filter dict | None

Query filter passed to the repository.

None

Returns:

Type Description list[Schema]

list[Schema]: Matching documents.

Notes

Extra positional and keyword arguments are forwarded to the repository.

"},{"location":"interfaces/openapi/#interfaces.openapi.TagCrudsService.update","title":"update async","text":"
update(id: PyObjectId, data: Model | dict) -> Schema | None\n

Replace a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data Model | dict

Replacement model or field mapping.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.UploadCrudsService","title":"UploadCrudsService","text":"
UploadCrudsService(*, repo=None)\n

Bases: CrudsServiceAdaptor[UploadResult, UploadResultDocument]

Upload result CRUD service resolving :class:UploadResult documents.

Notes

Instances are created by :func:get_upload_service. The model and schema class attributes bind the domain model and its document type.

Initialize the adaptor with a backing repository.

Parameters:

Name Type Description Default repo BaseRepository

Repository used for all operations.

None"},{"location":"interfaces/openapi/#interfaces.openapi.UploadCrudsService-functions","title":"Functions","text":""},{"location":"interfaces/openapi/#interfaces.openapi.UploadCrudsService.create","title":"create async","text":"
create(data: Model | dict) -> Schema\n

Create a document from a model or raw mapping.

Parameters:

Name Type Description Default data Model | dict

Model instance or field mapping to persist.

required

Returns:

Name Type Description Schema Schema

Persisted document.

"},{"location":"interfaces/openapi/#interfaces.openapi.UploadCrudsService.delete","title":"delete async","text":"
delete(id: PyObjectId) -> bool\n

Delete a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Name Type Description bool bool

True when a document was deleted.

"},{"location":"interfaces/openapi/#interfaces.openapi.UploadCrudsService.model_to_dict","title":"model_to_dict staticmethod","text":"
model_to_dict(model_obj: Model) -> dict\n

Serialize a model into a sparse dictionary.

Parameters:

Name Type Description Default model_obj Model

Model instance to serialize.

required

Returns:

Name Type Description dict dict

Fields that are set and not None.

"},{"location":"interfaces/openapi/#interfaces.openapi.UploadCrudsService.patch","title":"patch async","text":"
patch(id: PyObjectId, data: dict) -> Schema | None\n

Partially update a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data dict

Fields to patch.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.UploadCrudsService.read","title":"read async","text":"
read(id: PyObjectId) -> Schema | None\n

Read a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Type Description Schema | None

Schema | None: Matching document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.UploadCrudsService.search","title":"search async","text":"
search(\n    filter: dict | None = None, *args, **kwargs\n) -> list[Schema]\n

List documents matching an optional filter.

Parameters:

Name Type Description Default filter dict | None

Query filter passed to the repository.

None

Returns:

Type Description list[Schema]

list[Schema]: Matching documents.

Notes

Extra positional and keyword arguments are forwarded to the repository.

"},{"location":"interfaces/openapi/#interfaces.openapi.UploadCrudsService.update","title":"update async","text":"
update(id: PyObjectId, data: Model | dict) -> Schema | None\n

Replace a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data Model | dict

Replacement model or field mapping.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.UploadResult","title":"UploadResult","text":"

Bases: BaseModel

Metadata describing a stored file upload.

Attributes:

Name Type Description original_filename str

Name of the file as uploaded by the client.

saved_as str

Name the file was stored under on disk.

content_type str

MIME type of the uploaded file.

url str

Public URL serving the stored file.

absolute_path str

Absolute filesystem path of the stored file.

"},{"location":"interfaces/openapi/#interfaces.openapi.UserCrudsService","title":"UserCrudsService","text":"
UserCrudsService(*, repo=None)\n

Bases: CrudsServiceAdaptor[User, UserDocument]

User CRUD service resolving :class:User documents from a repo.

Notes

Instances are created by :func:get_user_service. The model and schema class attributes bind the domain model and its document type.

Initialize the adaptor with a backing repository.

Parameters:

Name Type Description Default repo BaseRepository

Repository used for all operations.

None"},{"location":"interfaces/openapi/#interfaces.openapi.UserCrudsService-functions","title":"Functions","text":""},{"location":"interfaces/openapi/#interfaces.openapi.UserCrudsService.create","title":"create async","text":"
create(data: Model | dict) -> Schema\n

Create a document from a model or raw mapping.

Parameters:

Name Type Description Default data Model | dict

Model instance or field mapping to persist.

required

Returns:

Name Type Description Schema Schema

Persisted document.

"},{"location":"interfaces/openapi/#interfaces.openapi.UserCrudsService.delete","title":"delete async","text":"
delete(id: PyObjectId) -> bool\n

Delete a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Name Type Description bool bool

True when a document was deleted.

"},{"location":"interfaces/openapi/#interfaces.openapi.UserCrudsService.model_to_dict","title":"model_to_dict staticmethod","text":"
model_to_dict(model_obj: Model) -> dict\n

Serialize a model into a sparse dictionary.

Parameters:

Name Type Description Default model_obj Model

Model instance to serialize.

required

Returns:

Name Type Description dict dict

Fields that are set and not None.

"},{"location":"interfaces/openapi/#interfaces.openapi.UserCrudsService.patch","title":"patch async","text":"
patch(id: PyObjectId, data: dict) -> Schema | None\n

Partially update a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data dict

Fields to patch.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.UserCrudsService.read","title":"read async","text":"
read(id: PyObjectId) -> Schema | None\n

Read a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required

Returns:

Type Description Schema | None

Schema | None: Matching document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi.UserCrudsService.search","title":"search async","text":"
search(\n    filter: dict | None = None, *args, **kwargs\n) -> list[Schema]\n

List documents matching an optional filter.

Parameters:

Name Type Description Default filter dict | None

Query filter passed to the repository.

None

Returns:

Type Description list[Schema]

list[Schema]: Matching documents.

Notes

Extra positional and keyword arguments are forwarded to the repository.

"},{"location":"interfaces/openapi/#interfaces.openapi.UserCrudsService.update","title":"update async","text":"
update(id: PyObjectId, data: Model | dict) -> Schema | None\n

Replace a document by primary key.

Parameters:

Name Type Description Default id PyObjectId

Document identifier.

required data Model | dict

Replacement model or field mapping.

required

Returns:

Type Description Schema | None

Schema | None: Updated document, or None when absent.

"},{"location":"interfaces/openapi/#interfaces.openapi-functions","title":"Functions","text":""},{"location":"interfaces/openapi/#interfaces.openapi.cache_response","title":"cache_response","text":"
cache_response(ttl: Optional[int] = None) -> Callable\n

Decorate a GET-style route handler to cache its JSON response.

Parameters:

Name Type Description Default ttl Optional[int]

Cache lifetime in seconds; defaults to settings.cache_ttl.

None

Returns:

Name Type Description Callable Callable

Decorator that wraps the route handler.

Notes

The wrapped handler must accept a request: Request parameter (as every openapi_first handler does). Responses that are already a fastapi.Response (for example 204) are returned untouched and never cached. When no http_cache_store is wired on request.app.state.db_resources the decorator passes through to the handler without caching.

"},{"location":"interfaces/openapi/#interfaces.openapi.create_account","title":"create_account async","text":"
create_account(request: Request, body: dict)\n

Create a new account.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Account payload forwarded to the service.

required

Returns:

Name Type Description AccountDocument

The created account.

"},{"location":"interfaces/openapi/#interfaces.openapi.create_entity","title":"create_entity async","text":"
create_entity(request: Request, body: dict)\n

Create a new entity.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Entity payload forwarded to the service.

required

Returns:

Name Type Description EntityDocument

The created entity.

"},{"location":"interfaces/openapi/#interfaces.openapi.create_expense","title":"create_expense async","text":"
create_expense(request: Request, body: dict)\n

Create a new expense.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Expense payload forwarded to the service.

required

Returns:

Name Type Description ExpenseDocument

The created expense.

"},{"location":"interfaces/openapi/#interfaces.openapi.create_fetch_request","title":"create_fetch_request async","text":"
create_fetch_request(request: Request, body: dict)\n

Create a new fetch request.

A stable fingerprint is derived from the source payload and stored on the document when the payload does not already provide one.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Fetch request payload forwarded to the service.

required

Returns:

Name Type Description FetchRequestDocument

The created fetch request.

"},{"location":"interfaces/openapi/#interfaces.openapi.create_report","title":"create_report async","text":"
create_report(request: Request, body: dict)\n

Generate a report snapshot from a query definition.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Report query payload; validated into a ReportQuery.

required

Returns:

Name Type Description ReportSnapshotDocument

The generated snapshot.

Raises:

Type Description HTTPException

400 when the query payload is invalid.

"},{"location":"interfaces/openapi/#interfaces.openapi.create_tag","title":"create_tag async","text":"
create_tag(request: Request, body: dict)\n

Create a new tag.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Tag payload forwarded to the service.

required

Returns:

Name Type Description TagDocument

The created tag.

"},{"location":"interfaces/openapi/#interfaces.openapi.create_user","title":"create_user async","text":"
create_user(request: Request, body: dict)\n

Create a new user.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

User payload forwarded to the service.

required

Returns:

Name Type Description UserDocument

The created user.

"},{"location":"interfaces/openapi/#interfaces.openapi.delete_account","title":"delete_account async","text":"
delete_account(request: Request, id: str)\n

Delete an account by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Account id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no account matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.delete_entity","title":"delete_entity async","text":"
delete_entity(request: Request, id: str)\n

Delete an entity by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Entity id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no entity matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.delete_expense","title":"delete_expense async","text":"
delete_expense(request: Request, id: str)\n

Delete an expense by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Expense id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no expense matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.delete_fetch_request","title":"delete_fetch_request async","text":"
delete_fetch_request(request: Request, id: str)\n

Delete a fetch request and its dependent data.

Cascades deletes to related expenses and ambiguities, removes the fetch request, and invalidates the expenses HTTP cache.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no fetch request matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.delete_report","title":"delete_report async","text":"
delete_report(request: Request, id: str)\n

Delete a report snapshot by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Report snapshot id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when the snapshot does not exist.

"},{"location":"interfaces/openapi/#interfaces.openapi.delete_tag","title":"delete_tag async","text":"
delete_tag(request: Request, id: str)\n

Delete a tag by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Tag id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no tag matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.get_account","title":"get_account async","text":"
get_account(request: Request, id: str)\n

Get an account by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Account id.

required

Returns:

Name Type Description AccountDocument

The matching account.

Raises:

Type Description HTTPException

404 when no account matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.get_current_user","title":"get_current_user async","text":"
get_current_user(request: Request)\n

Get the profile of the authenticated user.

Reads the principal from request.state and creates the profile on first access when it does not exist yet.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries the authenticated user and app.state.db_resources.

required

Returns:

Name Type Description UserDocument

The current user's profile.

Raises:

Type Description HTTPException

401 when the request is not authenticated.

"},{"location":"interfaces/openapi/#interfaces.openapi.get_entity","title":"get_entity async","text":"
get_entity(request: Request, id: str)\n

Get an entity by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Entity id.

required

Returns:

Name Type Description EntityDocument

The matching entity.

Raises:

Type Description HTTPException

404 when no entity matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.get_expense","title":"get_expense async","text":"
get_expense(request: Request, id: str)\n

Get an expense by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Expense id.

required

Returns:

Name Type Description ExpenseDocument

The matching expense.

Raises:

Type Description HTTPException

404 when no expense matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.get_fetch_request","title":"get_fetch_request async","text":"
get_fetch_request(request: Request, id: str)\n

Get a fetch request by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required

Returns:

Name Type Description FetchRequestDocument

The matching fetch request.

Raises:

Type Description HTTPException

404 when no fetch request matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.get_report","title":"get_report async","text":"
get_report(\n    request: Request,\n    id: str,\n    granularity: Optional[List[str]] = Query(None),\n    period_ids: Optional[List[str]] = Query(None),\n    flow: str = \"outflows\",\n    payee: Optional[List[str]] = Query(None),\n    tags: Optional[List[str]] = Query(None),\n)\n

Fetch a report snapshot with optional granularity, flow, and filter overrides.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Report snapshot id.

required granularity Optional[List[str]]

Granularities to materialize; empty means the snapshot's default set.

Query(None) period_ids Optional[List[str]]

Period labels to constrain output.

Query(None) flow str

Flow filter of inflows, outflows, or both. Defaults to outflows.

'outflows' payee Optional[List[str]]

Payee names to include.

Query(None) tags Optional[List[str]]

Tag paths to include.

Query(None)

Returns:

Name Type Description Report

The fetched report.

Raises:

Type Description HTTPException

400 when the report arguments are invalid.

HTTPException

404 when the snapshot does not exist.

"},{"location":"interfaces/openapi/#interfaces.openapi.get_tag","title":"get_tag async","text":"
get_tag(request: Request, id: str)\n

Get a tag by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Tag id.

required

Returns:

Name Type Description TagDocument

The matching tag.

Raises:

Type Description HTTPException

404 when no tag matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.get_uploaded_file","title":"get_uploaded_file async","text":"
get_uploaded_file(request: Request, filepath: str)\n

Serve an uploaded file from disk.

Parameters:

Name Type Description Default request Request

Incoming HTTP request.

required filepath str

Relative path of the file under UPLOAD_DIR.

required

Returns:

Name Type Description FileResponse

The requested file with its original filename.

Raises:

Type Description HTTPException

404 when the file does not exist.

"},{"location":"interfaces/openapi/#interfaces.openapi.get_user","title":"get_user async","text":"
get_user(request: Request, id: str)\n

Get a user by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

User id.

required

Returns:

Name Type Description UserDocument

The matching user.

Raises:

Type Description HTTPException

404 when no user matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.list_accounts","title":"list_accounts async","text":"
list_accounts(\n    request: Request, skip: int = 0, limit: int = 100\n)\n

List accounts with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required skip int

Number of accounts to skip (offset). Defaults to 0.

0 limit int

Maximum number of accounts to return. Defaults to 100.

100

Returns:

Type Description

list[AccountDocument]: Matching accounts from AccountCrudsService.search.

"},{"location":"interfaces/openapi/#interfaces.openapi.list_ambiguities","title":"list_ambiguities async","text":"
list_ambiguities(request: Request, id: str)\n

List pending ambiguities for a fetch request.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required

Returns:

Name Type Description list

Pending ambiguity documents from the ambiguity service.

"},{"location":"interfaces/openapi/#interfaces.openapi.list_entities","title":"list_entities async","text":"
list_entities(\n    request: Request, skip: int = 0, limit: int = 100\n)\n

List entities with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required skip int

Number of entities to skip (offset). Defaults to 0.

0 limit int

Maximum number of entities to return. Defaults to 100.

100

Returns:

Type Description

list[EntityDocument]: Matching entities from EntityCrudsService.search.

"},{"location":"interfaces/openapi/#interfaces.openapi.list_expenses","title":"list_expenses async","text":"
list_expenses(\n    request: Request,\n    offset: int = 0,\n    limit: int = 10,\n    start_date: str = \"\",\n    end_date: str = \"\",\n)\n

List expenses with pagination, excluding self-transfers.

Expenses tagged with a self-transfer tag are filtered out. The start_date and end_date parameters are accepted by the signature but not applied to the underlying search filter.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required offset int

Number of expenses to skip (offset). Defaults to 0.

0 limit int

Maximum number of expenses to return. Defaults to 10.

10 start_date str

Accepted date-range start; not applied to the search.

'' end_date str

Accepted date-range end; not applied to the search.

''

Returns:

Type Description

list[ExpenseDocument]: Matching expenses from ExpenseCrudsService.search.

"},{"location":"interfaces/openapi/#interfaces.openapi.list_fetch_requests","title":"list_fetch_requests async","text":"
list_fetch_requests(\n    request: Request, offset: int = 0, limit: int = 100\n)\n

List fetch requests with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required offset int

Number of fetch requests to skip (offset). Defaults to 0.

0 limit int

Maximum number of fetch requests to return. Defaults to 100.

100

Returns:

Type Description

list[FetchRequestDocument]: Matching fetch requests from the service.

"},{"location":"interfaces/openapi/#interfaces.openapi.list_reports","title":"list_reports async","text":"
list_reports(\n    request: Request, offset: int = 0, limit: int = 100\n)\n

List report snapshots with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required offset int

Number of snapshots to skip (offset). Defaults to 0.

0 limit int

Maximum number of snapshots to return. Defaults to 100.

100

Returns:

Type Description

list[ReportSnapshotDocument]: Matching snapshots from the report service.

"},{"location":"interfaces/openapi/#interfaces.openapi.list_tags","title":"list_tags async","text":"
list_tags(\n    request: Request, skip: int = 0, limit: int = 1000\n)\n

List tags with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required skip int

Number of tags to skip (offset). Defaults to 0.

0 limit int

Maximum number of tags to return. Defaults to 1000.

1000

Returns:

Type Description

list[TagDocument]: Matching tags from TagCrudsService.search.

"},{"location":"interfaces/openapi/#interfaces.openapi.list_uploads","title":"list_uploads async","text":"
list_uploads(request: Request)\n

List all upload records.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required

Returns:

Type Description

list[UploadDocument]: All uploads from the upload service.

"},{"location":"interfaces/openapi/#interfaces.openapi.list_users","title":"list_users async","text":"
list_users(\n    request: Request, skip: int = 0, limit: int = 100\n)\n

List users with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required skip int

Number of users to skip (offset). Defaults to 0.

0 limit int

Maximum number of users to return. Defaults to 100.

100

Returns:

Type Description

list[UserDocument]: Matching users from UserCrudsService.search.

"},{"location":"interfaces/openapi/#interfaces.openapi.resolve_ambiguity","title":"resolve_ambiguity async","text":"
resolve_ambiguity(request: Request, id: str, body: dict)\n

Resolve an ambiguity by choosing one of its candidates.

Marks the ambiguity resolved, then requeues the parent fetch request when no pending ambiguities remain and the fetch request is paused.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Ambiguity id.

required body dict

Resolution payload; must contain the chosen candidate.

required

Returns:

Type Description

Updated ambiguity document.

Raises:

Type Description HTTPException

400 when the chosen candidate is missing.

HTTPException

404 when the ambiguity is not found.

"},{"location":"interfaces/openapi/#interfaces.openapi.stream_fetch_events","title":"stream_fetch_events async","text":"
stream_fetch_events(request: Request, id: str)\n

Stream progress events for a fetch request as server-sent events.

If the SSE bus is not configured on app.state.db_resources an empty events list is returned. Otherwise a text/event-stream response is yielded, polling the bus every 500 ms until the client disconnects.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required

Returns:

Type Description

StreamingResponse | dict: SSE stream, or {\"events\": []} when the bus

is unavailable.

"},{"location":"interfaces/openapi/#interfaces.openapi.update_account","title":"update_account async","text":"
update_account(request: Request, id: str, body: dict)\n

Update an account by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Account id.

required body dict

Fields to update, forwarded to the service.

required

Returns:

Name Type Description AccountDocument

The updated account.

Raises:

Type Description HTTPException

404 when no account matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.update_current_user","title":"update_current_user async","text":"
update_current_user(request: Request, body: dict)\n

Update the profile of the authenticated user.

Creates the profile on first access, then applies the update payload.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries the authenticated user and app.state.db_resources.

required body dict

Fields to update on the current user's profile.

required

Returns:

Name Type Description UserDocument

The updated profile.

Raises:

Type Description HTTPException

401 when the request is not authenticated.

"},{"location":"interfaces/openapi/#interfaces.openapi.update_entity","title":"update_entity async","text":"
update_entity(request: Request, id: str, body: dict)\n

Update an entity by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Entity id.

required body dict

Fields to update, forwarded to the service.

required

Returns:

Name Type Description EntityDocument

The updated entity.

Raises:

Type Description HTTPException

404 when no entity matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.update_expense","title":"update_expense async","text":"
update_expense(request: Request, id: str, body: dict)\n

Update an expense by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Expense id.

required body dict

Fields to update, forwarded to the service.

required

Returns:

Name Type Description ExpenseDocument

The updated expense.

Raises:

Type Description HTTPException

404 when no expense matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.update_fetch_request","title":"update_fetch_request async","text":"
update_fetch_request(request: Request, id: str, body: dict)\n

Patch a fetch request's status and retry bookkeeping.

Delegates to FetchRequestCrudsService.update_status with the status, error_message, and retry_count fields from the payload, then returns the refreshed document.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required body dict

Payload with status, error_message, and retry_count fields.

required

Returns:

Name Type Description FetchRequestDocument

The refreshed fetch request.

Raises:

Type Description HTTPException

404 when no fetch request matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.update_fetch_request_put","title":"update_fetch_request_put async","text":"
update_fetch_request_put(\n    request: Request, id: str, body: dict\n)\n

Replace a fetch request by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required body dict

Full fetch request payload forwarded to the service.

required

Returns:

Name Type Description FetchRequestDocument

The updated fetch request.

Raises:

Type Description HTTPException

404 when no fetch request matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.update_tag","title":"update_tag async","text":"
update_tag(request: Request, id: str, body: dict)\n

Update a tag by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Tag id.

required body dict

Fields to update, forwarded to the service.

required

Returns:

Name Type Description TagDocument

The updated tag.

Raises:

Type Description HTTPException

404 when no tag matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.upload_entity_logo","title":"upload_entity_logo async","text":"
upload_entity_logo(\n    request: Request, id: str, file: UploadFile\n)\n

Upload a logo for an entity and persist it to the logo directory.

The file contents are hashed to derive a stable filename, written under LOGO_DIR, and the entity's logo field is updated with the served URL.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Entity id.

required file UploadFile

Uploaded logo image.

required

Returns:

Name Type Description dict

A mapping with keys id, url, logo, and status.

Raises:

Type Description HTTPException

404 when no entity matches the id.

"},{"location":"interfaces/openapi/#interfaces.openapi.upload_file","title":"upload_file async","text":"
upload_file(request: Request)\n

Upload a raw request body as a file.

The filename is parsed from the content-disposition header (defaulting to upload) and combined with a content hash to form the stored filename under UPLOAD_DIR. The resulting UploadResult is persisted via the upload service.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries the body, content type, and app.state.db_resources.

required

Returns:

Name Type Description UploadDocument

The created upload record.

"},{"location":"interfaces/account/","title":"Account","text":""},{"location":"interfaces/account/#interfaces.account","title":"interfaces.account","text":""},{"location":"interfaces/account/#interfaces.account--summary","title":"Summary","text":"

Account interface: thin FastAPI route handlers for the account resource, wired to openapi.yaml operationIds by the OpenAPI-first router.

"},{"location":"interfaces/account/routes/","title":"Routes","text":""},{"location":"interfaces/account/routes/#interfaces.account.routes","title":"interfaces.account.routes","text":""},{"location":"interfaces/account/routes/#interfaces.account.routes--summary","title":"Summary","text":"

Account REST handlers \u2014 thin API entry points for the account resource, wired to openapi.yaml operationIds by the OpenAPI-first router. All handlers delegate to AccountCrudsService via request.app.state.db_resources.

"},{"location":"interfaces/account/routes/#interfaces.account.routes-classes","title":"Classes","text":""},{"location":"interfaces/account/routes/#interfaces.account.routes-functions","title":"Functions","text":""},{"location":"interfaces/account/routes/#interfaces.account.routes.create_account","title":"create_account async","text":"
create_account(request: Request, body: dict)\n

Create a new account.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Account payload forwarded to the service.

required

Returns:

Name Type Description AccountDocument

The created account.

"},{"location":"interfaces/account/routes/#interfaces.account.routes.delete_account","title":"delete_account async","text":"
delete_account(request: Request, id: str)\n

Delete an account by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Account id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no account matches the id.

"},{"location":"interfaces/account/routes/#interfaces.account.routes.get_account","title":"get_account async","text":"
get_account(request: Request, id: str)\n

Get an account by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Account id.

required

Returns:

Name Type Description AccountDocument

The matching account.

Raises:

Type Description HTTPException

404 when no account matches the id.

"},{"location":"interfaces/account/routes/#interfaces.account.routes.list_accounts","title":"list_accounts async","text":"
list_accounts(\n    request: Request, skip: int = 0, limit: int = 100\n)\n

List accounts with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required skip int

Number of accounts to skip (offset). Defaults to 0.

0 limit int

Maximum number of accounts to return. Defaults to 100.

100

Returns:

Type Description

list[AccountDocument]: Matching accounts from AccountCrudsService.search.

"},{"location":"interfaces/account/routes/#interfaces.account.routes.update_account","title":"update_account async","text":"
update_account(request: Request, id: str, body: dict)\n

Update an account by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Account id.

required body dict

Fields to update, forwarded to the service.

required

Returns:

Name Type Description AccountDocument

The updated account.

Raises:

Type Description HTTPException

404 when no account matches the id.

"},{"location":"interfaces/ambiguity/","title":"Ambiguity","text":""},{"location":"interfaces/ambiguity/#interfaces.ambiguity","title":"interfaces.ambiguity","text":""},{"location":"interfaces/ambiguity/#interfaces.ambiguity--summary","title":"Summary","text":"

Ambiguity interface: thin FastAPI route handlers for the ambiguity resource, wired to openapi.yaml operationIds by the OpenAPI-first router.

"},{"location":"interfaces/ambiguity/routes/","title":"Routes","text":""},{"location":"interfaces/ambiguity/routes/#interfaces.ambiguity.routes","title":"interfaces.ambiguity.routes","text":""},{"location":"interfaces/ambiguity/routes/#interfaces.ambiguity.routes--summary","title":"Summary","text":"

Ambiguity REST handlers \u2014 thin API entry points for the ambiguity resource, wired to openapi.yaml operationIds by the OpenAPI-first router. Resolution updates the ambiguity and requeues the parent fetch request when no pending ambiguities remain.

"},{"location":"interfaces/ambiguity/routes/#interfaces.ambiguity.routes-functions","title":"Functions","text":""},{"location":"interfaces/ambiguity/routes/#interfaces.ambiguity.routes.resolve_ambiguity","title":"resolve_ambiguity async","text":"
resolve_ambiguity(request: Request, id: str, body: dict)\n

Resolve an ambiguity by choosing one of its candidates.

Marks the ambiguity resolved, then requeues the parent fetch request when no pending ambiguities remain and the fetch request is paused.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Ambiguity id.

required body dict

Resolution payload; must contain the chosen candidate.

required

Returns:

Type Description

Updated ambiguity document.

Raises:

Type Description HTTPException

400 when the chosen candidate is missing.

HTTPException

404 when the ambiguity is not found.

"},{"location":"interfaces/entity/","title":"Entity","text":""},{"location":"interfaces/entity/#interfaces.entity","title":"interfaces.entity","text":""},{"location":"interfaces/entity/#interfaces.entity--summary","title":"Summary","text":"

Entity interface: thin FastAPI route handlers for the entity resource, wired to openapi.yaml operationIds by the OpenAPI-first router.

"},{"location":"interfaces/entity/routes/","title":"Routes","text":""},{"location":"interfaces/entity/routes/#interfaces.entity.routes","title":"interfaces.entity.routes","text":""},{"location":"interfaces/entity/routes/#interfaces.entity.routes--summary","title":"Summary","text":"

Entity REST handlers \u2014 thin API entry points for the entity resource, wired to openapi.yaml operationIds by the OpenAPI-first router. All handlers delegate to EntityCrudsService via request.app.state.db_resources.

"},{"location":"interfaces/entity/routes/#interfaces.entity.routes-classes","title":"Classes","text":""},{"location":"interfaces/entity/routes/#interfaces.entity.routes-functions","title":"Functions","text":""},{"location":"interfaces/entity/routes/#interfaces.entity.routes.create_entity","title":"create_entity async","text":"
create_entity(request: Request, body: dict)\n

Create a new entity.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Entity payload forwarded to the service.

required

Returns:

Name Type Description EntityDocument

The created entity.

"},{"location":"interfaces/entity/routes/#interfaces.entity.routes.delete_entity","title":"delete_entity async","text":"
delete_entity(request: Request, id: str)\n

Delete an entity by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Entity id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no entity matches the id.

"},{"location":"interfaces/entity/routes/#interfaces.entity.routes.get_entity","title":"get_entity async","text":"
get_entity(request: Request, id: str)\n

Get an entity by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Entity id.

required

Returns:

Name Type Description EntityDocument

The matching entity.

Raises:

Type Description HTTPException

404 when no entity matches the id.

"},{"location":"interfaces/entity/routes/#interfaces.entity.routes.list_entities","title":"list_entities async","text":"
list_entities(\n    request: Request, skip: int = 0, limit: int = 100\n)\n

List entities with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required skip int

Number of entities to skip (offset). Defaults to 0.

0 limit int

Maximum number of entities to return. Defaults to 100.

100

Returns:

Type Description

list[EntityDocument]: Matching entities from EntityCrudsService.search.

"},{"location":"interfaces/entity/routes/#interfaces.entity.routes.update_entity","title":"update_entity async","text":"
update_entity(request: Request, id: str, body: dict)\n

Update an entity by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Entity id.

required body dict

Fields to update, forwarded to the service.

required

Returns:

Name Type Description EntityDocument

The updated entity.

Raises:

Type Description HTTPException

404 when no entity matches the id.

"},{"location":"interfaces/entity/routes/#interfaces.entity.routes.upload_entity_logo","title":"upload_entity_logo async","text":"
upload_entity_logo(\n    request: Request, id: str, file: UploadFile\n)\n

Upload a logo for an entity and persist it to the logo directory.

The file contents are hashed to derive a stable filename, written under LOGO_DIR, and the entity's logo field is updated with the served URL.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Entity id.

required file UploadFile

Uploaded logo image.

required

Returns:

Name Type Description dict

A mapping with keys id, url, logo, and status.

Raises:

Type Description HTTPException

404 when no entity matches the id.

"},{"location":"interfaces/expense/","title":"Expense","text":""},{"location":"interfaces/expense/#interfaces.expense","title":"interfaces.expense","text":""},{"location":"interfaces/expense/#interfaces.expense--summary","title":"Summary","text":"

Expense interface: thin FastAPI route handlers for the expense resource, wired to openapi.yaml operationIds by the OpenAPI-first router.

"},{"location":"interfaces/expense/routes/","title":"Routes","text":""},{"location":"interfaces/expense/routes/#interfaces.expense.routes","title":"interfaces.expense.routes","text":""},{"location":"interfaces/expense/routes/#interfaces.expense.routes--summary","title":"Summary","text":"

Expense REST handlers \u2014 thin API entry points for the expense resource, wired to openapi.yaml operationIds by the OpenAPI-first router. All handlers delegate to ExpenseCrudsService via request.app.state.db_resources.

"},{"location":"interfaces/expense/routes/#interfaces.expense.routes-classes","title":"Classes","text":""},{"location":"interfaces/expense/routes/#interfaces.expense.routes-functions","title":"Functions","text":""},{"location":"interfaces/expense/routes/#interfaces.expense.routes.create_expense","title":"create_expense async","text":"
create_expense(request: Request, body: dict)\n

Create a new expense.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Expense payload forwarded to the service.

required

Returns:

Name Type Description ExpenseDocument

The created expense.

"},{"location":"interfaces/expense/routes/#interfaces.expense.routes.delete_expense","title":"delete_expense async","text":"
delete_expense(request: Request, id: str)\n

Delete an expense by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Expense id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no expense matches the id.

"},{"location":"interfaces/expense/routes/#interfaces.expense.routes.get_expense","title":"get_expense async","text":"
get_expense(request: Request, id: str)\n

Get an expense by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Expense id.

required

Returns:

Name Type Description ExpenseDocument

The matching expense.

Raises:

Type Description HTTPException

404 when no expense matches the id.

"},{"location":"interfaces/expense/routes/#interfaces.expense.routes.list_expenses","title":"list_expenses async","text":"
list_expenses(\n    request: Request,\n    offset: int = 0,\n    limit: int = 10,\n    start_date: str = \"\",\n    end_date: str = \"\",\n)\n

List expenses with pagination, excluding self-transfers.

Expenses tagged with a self-transfer tag are filtered out. The start_date and end_date parameters are accepted by the signature but not applied to the underlying search filter.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required offset int

Number of expenses to skip (offset). Defaults to 0.

0 limit int

Maximum number of expenses to return. Defaults to 10.

10 start_date str

Accepted date-range start; not applied to the search.

'' end_date str

Accepted date-range end; not applied to the search.

''

Returns:

Type Description

list[ExpenseDocument]: Matching expenses from ExpenseCrudsService.search.

"},{"location":"interfaces/expense/routes/#interfaces.expense.routes.update_expense","title":"update_expense async","text":"
update_expense(request: Request, id: str, body: dict)\n

Update an expense by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Expense id.

required body dict

Fields to update, forwarded to the service.

required

Returns:

Name Type Description ExpenseDocument

The updated expense.

Raises:

Type Description HTTPException

404 when no expense matches the id.

"},{"location":"interfaces/fetch_request/","title":"Fetch Request","text":""},{"location":"interfaces/fetch_request/#interfaces.fetch_request","title":"interfaces.fetch_request","text":""},{"location":"interfaces/fetch_request/#interfaces.fetch_request--summary","title":"Summary","text":"

Fetch request interface: thin FastAPI route handlers, SSE handlers, and a CLI for the fetch request resource, wired to openapi.yaml operationIds by the OpenAPI-first router.

"},{"location":"interfaces/fetch_request/routes/","title":"Routes","text":""},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes","title":"interfaces.fetch_request.routes","text":""},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes--summary","title":"Summary","text":"

Fetch request REST handlers \u2014 thin API entry points for the fetch request resource, wired to openapi.yaml operationIds by the OpenAPI-first router. Deletion cascades to related expenses, ambiguities, and the HTTP cache.

"},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes-classes","title":"Classes","text":""},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes-functions","title":"Functions","text":""},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes.create_fetch_request","title":"create_fetch_request async","text":"
create_fetch_request(request: Request, body: dict)\n

Create a new fetch request.

A stable fingerprint is derived from the source payload and stored on the document when the payload does not already provide one.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Fetch request payload forwarded to the service.

required

Returns:

Name Type Description FetchRequestDocument

The created fetch request.

"},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes.delete_fetch_request","title":"delete_fetch_request async","text":"
delete_fetch_request(request: Request, id: str)\n

Delete a fetch request and its dependent data.

Cascades deletes to related expenses and ambiguities, removes the fetch request, and invalidates the expenses HTTP cache.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no fetch request matches the id.

"},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes.get_fetch_request","title":"get_fetch_request async","text":"
get_fetch_request(request: Request, id: str)\n

Get a fetch request by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required

Returns:

Name Type Description FetchRequestDocument

The matching fetch request.

Raises:

Type Description HTTPException

404 when no fetch request matches the id.

"},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes.list_fetch_requests","title":"list_fetch_requests async","text":"
list_fetch_requests(\n    request: Request, offset: int = 0, limit: int = 100\n)\n

List fetch requests with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required offset int

Number of fetch requests to skip (offset). Defaults to 0.

0 limit int

Maximum number of fetch requests to return. Defaults to 100.

100

Returns:

Type Description

list[FetchRequestDocument]: Matching fetch requests from the service.

"},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes.update_fetch_request","title":"update_fetch_request async","text":"
update_fetch_request(request: Request, id: str, body: dict)\n

Patch a fetch request's status and retry bookkeeping.

Delegates to FetchRequestCrudsService.update_status with the status, error_message, and retry_count fields from the payload, then returns the refreshed document.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required body dict

Payload with status, error_message, and retry_count fields.

required

Returns:

Name Type Description FetchRequestDocument

The refreshed fetch request.

Raises:

Type Description HTTPException

404 when no fetch request matches the id.

"},{"location":"interfaces/fetch_request/routes/#interfaces.fetch_request.routes.update_fetch_request_put","title":"update_fetch_request_put async","text":"
update_fetch_request_put(\n    request: Request, id: str, body: dict\n)\n

Replace a fetch request by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required body dict

Full fetch request payload forwarded to the service.

required

Returns:

Name Type Description FetchRequestDocument

The updated fetch request.

Raises:

Type Description HTTPException

404 when no fetch request matches the id.

"},{"location":"interfaces/fetch_request/sse/","title":"Sse","text":""},{"location":"interfaces/fetch_request/sse/#interfaces.fetch_request.sse","title":"interfaces.fetch_request.sse","text":""},{"location":"interfaces/fetch_request/sse/#interfaces.fetch_request.sse--summary","title":"Summary","text":"

Fetch request SSE handlers \u2014 real-time progress events and ambiguity listing for a given fetch request. Events are streamed via an SSE bus; ambiguities are queried directly from the ambiguity service.

"},{"location":"interfaces/fetch_request/sse/#interfaces.fetch_request.sse-functions","title":"Functions","text":""},{"location":"interfaces/fetch_request/sse/#interfaces.fetch_request.sse.list_ambiguities","title":"list_ambiguities async","text":"
list_ambiguities(request: Request, id: str)\n

List pending ambiguities for a fetch request.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required

Returns:

Name Type Description list

Pending ambiguity documents from the ambiguity service.

"},{"location":"interfaces/fetch_request/sse/#interfaces.fetch_request.sse.stream_fetch_events","title":"stream_fetch_events async","text":"
stream_fetch_events(request: Request, id: str)\n

Stream progress events for a fetch request as server-sent events.

If the SSE bus is not configured on app.state.db_resources an empty events list is returned. Otherwise a text/event-stream response is yielded, polling the bus every 500 ms until the client disconnects.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Fetch request id.

required

Returns:

Type Description

StreamingResponse | dict: SSE stream, or {\"events\": []} when the bus

is unavailable.

"},{"location":"interfaces/fetch_request/cli/","title":"Cli","text":""},{"location":"interfaces/fetch_request/cli/#interfaces.fetch_request.cli","title":"interfaces.fetch_request.cli","text":""},{"location":"interfaces/fetch_request/cli/#interfaces.fetch_request.cli--summary","title":"Summary","text":"

Fetch request CLI package: argparse-driven command entry point (main), subcommand implementations (commands), and the pipeline runner (run).

"},{"location":"interfaces/fetch_request/cli/__main__/","title":"Main","text":""},{"location":"interfaces/fetch_request/cli/__main__/#interfaces.fetch_request.cli.__main__","title":"interfaces.fetch_request.cli.__main__","text":""},{"location":"interfaces/fetch_request/cli/__main__/#interfaces.fetch_request.cli.__main__--summary","title":"Summary","text":"

CLI for FetchRequest management \u2014 list, get, create, run, resolve, retry.

Example:

```python\npython -m interfaces.fetch_request.cli list\npython -m interfaces.fetch_request.cli get <id>\npython -m interfaces.fetch_request.cli create-file --account \"ICICI Savings\" --path ./stmt.pdf --start-date 2025-04-01 --end-date 2026-03-31\npython -m interfaces.fetch_request.cli run <id>\npython -m interfaces.fetch_request.cli ambiguities <fr_id>\npython -m interfaces.fetch_request.cli resolve <fr_id>\npython -m interfaces.fetch_request.cli retry <id>\n```\n
"},{"location":"interfaces/fetch_request/cli/__main__/#interfaces.fetch_request.cli.__main__-classes","title":"Classes","text":""},{"location":"interfaces/fetch_request/cli/__main__/#interfaces.fetch_request.cli.__main__-functions","title":"Functions","text":""},{"location":"interfaces/fetch_request/cli/__main__/#interfaces.fetch_request.cli.__main__.main","title":"main async","text":"
main()\n

Run the FetchRequest CLI: parse arguments, dispatch to a subcommand.

Initializes the application resources before dispatch and shuts them down afterwards.

"},{"location":"interfaces/fetch_request/cli/commands/","title":"Commands","text":""},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands","title":"interfaces.fetch_request.cli.commands","text":""},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands--summary","title":"Summary","text":"

Subcommand implementations: list, get, create-file, create-email, ambiguities, resolve, retry. Each cmd_* function receives the parsed argparse namespace and prints its result to stdout.

"},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands-classes","title":"Classes","text":""},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands-functions","title":"Functions","text":""},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands.cmd_ambiguities","title":"cmd_ambiguities async","text":"
cmd_ambiguities(args)\n

List ambiguities for a fetch request, optionally cleaning them.

Parameters:

Name Type Description Default args

Parsed argparse namespace with fr_id, status, clean, and yes fields.

required"},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands.cmd_create_email","title":"cmd_create_email async","text":"
cmd_create_email(args)\n

Create an email-based fetch request.

Requires an existing account and user; parses the date range, builds an EmailSource, and persists the created fetch request.

Parameters:

Name Type Description Default args

Parsed argparse namespace with account, user, from-email, bank, subject, raw-terms, start-date, and end-date fields.

required"},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands.cmd_create_file","title":"cmd_create_file async","text":"
cmd_create_file(args)\n

Create a file-based fetch request.

Requires an existing account and user; parses the date range, builds a FileSource, and persists the created fetch request.

Parameters:

Name Type Description Default args

Parsed argparse namespace with account, user, path, bank, start-date, and end-date fields.

required"},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands.cmd_get","title":"cmd_get async","text":"
cmd_get(args)\n

Show details of a single fetch request.

Parameters:

Name Type Description Default args

Parsed argparse namespace with the id field.

required"},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands.cmd_list","title":"cmd_list async","text":"
cmd_list(args)\n

List fetch requests, optionally filtered by status and account.

Parameters:

Name Type Description Default args

Parsed argparse namespace with status, account, and limit fields.

required"},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands.cmd_resolve","title":"cmd_resolve async","text":"
cmd_resolve(args)\n

Resolve ambiguities, interactively or directly by amount and balance.

Parameters:

Name Type Description Default args

Parsed argparse namespace with fr_id, ambiguity-id, amount, and balance fields.

required"},{"location":"interfaces/fetch_request/cli/commands/#interfaces.fetch_request.cli.commands.cmd_retry","title":"cmd_retry async","text":"
cmd_retry(args)\n

Reset a failed or paused fetch request back to pending.

Optionally clears extracted data such as raw_lines and txn_blocks.

Parameters:

Name Type Description Default args

Parsed argparse namespace with the id and reset-data fields.

required"},{"location":"interfaces/fetch_request/cli/run/","title":"Run","text":""},{"location":"interfaces/fetch_request/cli/run/#interfaces.fetch_request.cli.run","title":"interfaces.fetch_request.cli.run","text":""},{"location":"interfaces/fetch_request/cli/run/#interfaces.fetch_request.cli.run--summary","title":"Summary","text":"

Pipeline runner subcommand \u2014 drives _extract \u2192 _enrich \u2192 _process_expenses with a --till guard that stops the run after a given stage.

"},{"location":"interfaces/fetch_request/cli/run/#interfaces.fetch_request.cli.run-classes","title":"Classes","text":""},{"location":"interfaces/fetch_request/cli/run/#interfaces.fetch_request.cli.run-functions","title":"Functions","text":""},{"location":"interfaces/fetch_request/cli/run/#interfaces.fetch_request.cli.run.cmd_run","title":"cmd_run async","text":"
cmd_run(args)\n

Run the pipeline for a fetch request using parsed CLI arguments.

Parameters:

Name Type Description Default args

Parsed argparse namespace with id, till, force, and resume fields.

required"},{"location":"interfaces/fetch_request/cli/run/#interfaces.fetch_request.cli.run.run_pipeline","title":"run_pipeline async","text":"
run_pipeline(\n    fr_id: str,\n    *,\n    till: str = \"expense\",\n    force: bool = False,\n    resume: bool = False,\n    splitter=None\n)\n

Run the extraction pipeline for a fetch request.

Fetches the source content, extracts raw expenses, enriches them, and saves them as expenses, stopping between stages when till asks for it.

Parameters:

Name Type Description Default fr_id str

Fetch request id.

required till str

Stop stage: raw, enriched, or expense. Defaults to expense.

'expense' force bool

Reset to pending and clear extraction data before running. Defaults to False.

False resume bool

Load previously resolved choices before running. Defaults to False.

False splitter

Optional custom splitter injected into the extractor.

None"},{"location":"interfaces/report/","title":"Report","text":""},{"location":"interfaces/report/#interfaces.report","title":"interfaces.report","text":""},{"location":"interfaces/report/#interfaces.report--summary","title":"Summary","text":"

Reports interface: thin API entry points for the reports resource.

"},{"location":"interfaces/report/routes/","title":"Routes","text":""},{"location":"interfaces/report/routes/#interfaces.report.routes","title":"interfaces.report.routes","text":""},{"location":"interfaces/report/routes/#interfaces.report.routes--summary","title":"Summary","text":"

Report REST handlers \u2014 thin API entry points for the reports resource, wired to openapi.yaml operationIds by the OpenAPI-first router. All handlers delegate to ReportService via request.app.state.db_resources and translate domain validation errors into 400 responses.

"},{"location":"interfaces/report/routes/#interfaces.report.routes-classes","title":"Classes","text":""},{"location":"interfaces/report/routes/#interfaces.report.routes-functions","title":"Functions","text":""},{"location":"interfaces/report/routes/#interfaces.report.routes.create_report","title":"create_report async","text":"
create_report(request: Request, body: dict)\n

Generate a report snapshot from a query definition.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Report query payload; validated into a ReportQuery.

required

Returns:

Name Type Description ReportSnapshotDocument

The generated snapshot.

Raises:

Type Description HTTPException

400 when the query payload is invalid.

"},{"location":"interfaces/report/routes/#interfaces.report.routes.delete_report","title":"delete_report async","text":"
delete_report(request: Request, id: str)\n

Delete a report snapshot by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Report snapshot id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when the snapshot does not exist.

"},{"location":"interfaces/report/routes/#interfaces.report.routes.get_report","title":"get_report async","text":"
get_report(\n    request: Request,\n    id: str,\n    granularity: Optional[List[str]] = Query(None),\n    period_ids: Optional[List[str]] = Query(None),\n    flow: str = \"outflows\",\n    payee: Optional[List[str]] = Query(None),\n    tags: Optional[List[str]] = Query(None),\n)\n

Fetch a report snapshot with optional granularity, flow, and filter overrides.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Report snapshot id.

required granularity Optional[List[str]]

Granularities to materialize; empty means the snapshot's default set.

Query(None) period_ids Optional[List[str]]

Period labels to constrain output.

Query(None) flow str

Flow filter of inflows, outflows, or both. Defaults to outflows.

'outflows' payee Optional[List[str]]

Payee names to include.

Query(None) tags Optional[List[str]]

Tag paths to include.

Query(None)

Returns:

Name Type Description Report

The fetched report.

Raises:

Type Description HTTPException

400 when the report arguments are invalid.

HTTPException

404 when the snapshot does not exist.

"},{"location":"interfaces/report/routes/#interfaces.report.routes.list_reports","title":"list_reports async","text":"
list_reports(\n    request: Request, offset: int = 0, limit: int = 100\n)\n

List report snapshots with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required offset int

Number of snapshots to skip (offset). Defaults to 0.

0 limit int

Maximum number of snapshots to return. Defaults to 100.

100

Returns:

Type Description

list[ReportSnapshotDocument]: Matching snapshots from the report service.

"},{"location":"interfaces/tag/","title":"Tag","text":""},{"location":"interfaces/tag/#interfaces.tag","title":"interfaces.tag","text":""},{"location":"interfaces/tag/#interfaces.tag--summary","title":"Summary","text":"

Tag interface: thin FastAPI route handlers for the tag resource, wired to openapi.yaml operationIds by the OpenAPI-first router.

"},{"location":"interfaces/tag/routes/","title":"Routes","text":""},{"location":"interfaces/tag/routes/#interfaces.tag.routes","title":"interfaces.tag.routes","text":""},{"location":"interfaces/tag/routes/#interfaces.tag.routes--summary","title":"Summary","text":"

Tag REST handlers \u2014 thin API entry points for the tag resource, wired to openapi.yaml operationIds by the OpenAPI-first router. All handlers delegate to TagCrudsService via request.app.state.db_resources.

"},{"location":"interfaces/tag/routes/#interfaces.tag.routes-classes","title":"Classes","text":""},{"location":"interfaces/tag/routes/#interfaces.tag.routes-functions","title":"Functions","text":""},{"location":"interfaces/tag/routes/#interfaces.tag.routes.create_tag","title":"create_tag async","text":"
create_tag(request: Request, body: dict)\n

Create a new tag.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

Tag payload forwarded to the service.

required

Returns:

Name Type Description TagDocument

The created tag.

"},{"location":"interfaces/tag/routes/#interfaces.tag.routes.delete_tag","title":"delete_tag async","text":"
delete_tag(request: Request, id: str)\n

Delete a tag by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Tag id.

required

Returns:

Name Type Description Response

Empty 204 response on successful delete.

Raises:

Type Description HTTPException

404 when no tag matches the id.

"},{"location":"interfaces/tag/routes/#interfaces.tag.routes.get_tag","title":"get_tag async","text":"
get_tag(request: Request, id: str)\n

Get a tag by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Tag id.

required

Returns:

Name Type Description TagDocument

The matching tag.

Raises:

Type Description HTTPException

404 when no tag matches the id.

"},{"location":"interfaces/tag/routes/#interfaces.tag.routes.list_tags","title":"list_tags async","text":"
list_tags(\n    request: Request, skip: int = 0, limit: int = 1000\n)\n

List tags with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required skip int

Number of tags to skip (offset). Defaults to 0.

0 limit int

Maximum number of tags to return. Defaults to 1000.

1000

Returns:

Type Description

list[TagDocument]: Matching tags from TagCrudsService.search.

"},{"location":"interfaces/tag/routes/#interfaces.tag.routes.update_tag","title":"update_tag async","text":"
update_tag(request: Request, id: str, body: dict)\n

Update a tag by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

Tag id.

required body dict

Fields to update, forwarded to the service.

required

Returns:

Name Type Description TagDocument

The updated tag.

Raises:

Type Description HTTPException

404 when no tag matches the id.

"},{"location":"interfaces/upload/","title":"Upload","text":""},{"location":"interfaces/upload/#interfaces.upload","title":"interfaces.upload","text":""},{"location":"interfaces/upload/#interfaces.upload--summary","title":"Summary","text":"

Upload interface: thin FastAPI route handlers for the upload resource, wired to openapi.yaml operationIds by the OpenAPI-first router.

"},{"location":"interfaces/upload/routes/","title":"Routes","text":""},{"location":"interfaces/upload/routes/#interfaces.upload.routes","title":"interfaces.upload.routes","text":""},{"location":"interfaces/upload/routes/#interfaces.upload.routes--summary","title":"Summary","text":"

Upload REST handlers \u2014 thin API entry points for the upload resource, wired to openapi.yaml operationIds by the OpenAPI-first router. Files are persisted under UPLOAD_DIR and a name-hashed copy is registered with the upload service.

"},{"location":"interfaces/upload/routes/#interfaces.upload.routes-classes","title":"Classes","text":""},{"location":"interfaces/upload/routes/#interfaces.upload.routes-functions","title":"Functions","text":""},{"location":"interfaces/upload/routes/#interfaces.upload.routes.get_uploaded_file","title":"get_uploaded_file async","text":"
get_uploaded_file(request: Request, filepath: str)\n

Serve an uploaded file from disk.

Parameters:

Name Type Description Default request Request

Incoming HTTP request.

required filepath str

Relative path of the file under UPLOAD_DIR.

required

Returns:

Name Type Description FileResponse

The requested file with its original filename.

Raises:

Type Description HTTPException

404 when the file does not exist.

"},{"location":"interfaces/upload/routes/#interfaces.upload.routes.list_uploads","title":"list_uploads async","text":"
list_uploads(request: Request)\n

List all upload records.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required

Returns:

Type Description

list[UploadDocument]: All uploads from the upload service.

"},{"location":"interfaces/upload/routes/#interfaces.upload.routes.upload_file","title":"upload_file async","text":"
upload_file(request: Request)\n

Upload a raw request body as a file.

The filename is parsed from the content-disposition header (defaulting to upload) and combined with a content hash to form the stored filename under UPLOAD_DIR. The resulting UploadResult is persisted via the upload service.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries the body, content type, and app.state.db_resources.

required

Returns:

Name Type Description UploadDocument

The created upload record.

"},{"location":"interfaces/user/","title":"User","text":""},{"location":"interfaces/user/#interfaces.user","title":"interfaces.user","text":""},{"location":"interfaces/user/#interfaces.user--summary","title":"Summary","text":"

User interface: thin FastAPI route handlers for the user resource, wired to openapi.yaml operationIds by the OpenAPI-first router.

"},{"location":"interfaces/user/routes/","title":"Routes","text":""},{"location":"interfaces/user/routes/#interfaces.user.routes","title":"interfaces.user.routes","text":""},{"location":"interfaces/user/routes/#interfaces.user.routes--summary","title":"Summary","text":"

User REST handlers \u2014 thin API entry points for the user resource, wired to openapi.yaml operationIds by the OpenAPI-first router. Current-user handlers read the authenticated principal from request.state and create the profile on first access.

"},{"location":"interfaces/user/routes/#interfaces.user.routes-classes","title":"Classes","text":""},{"location":"interfaces/user/routes/#interfaces.user.routes-functions","title":"Functions","text":""},{"location":"interfaces/user/routes/#interfaces.user.routes.create_user","title":"create_user async","text":"
create_user(request: Request, body: dict)\n

Create a new user.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required body dict

User payload forwarded to the service.

required

Returns:

Name Type Description UserDocument

The created user.

"},{"location":"interfaces/user/routes/#interfaces.user.routes.get_current_user","title":"get_current_user async","text":"
get_current_user(request: Request)\n

Get the profile of the authenticated user.

Reads the principal from request.state and creates the profile on first access when it does not exist yet.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries the authenticated user and app.state.db_resources.

required

Returns:

Name Type Description UserDocument

The current user's profile.

Raises:

Type Description HTTPException

401 when the request is not authenticated.

"},{"location":"interfaces/user/routes/#interfaces.user.routes.get_user","title":"get_user async","text":"
get_user(request: Request, id: str)\n

Get a user by id.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required id str

User id.

required

Returns:

Name Type Description UserDocument

The matching user.

Raises:

Type Description HTTPException

404 when no user matches the id.

"},{"location":"interfaces/user/routes/#interfaces.user.routes.list_users","title":"list_users async","text":"
list_users(\n    request: Request, skip: int = 0, limit: int = 100\n)\n

List users with pagination.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries app.state.db_resources.

required skip int

Number of users to skip (offset). Defaults to 0.

0 limit int

Maximum number of users to return. Defaults to 100.

100

Returns:

Type Description

list[UserDocument]: Matching users from UserCrudsService.search.

"},{"location":"interfaces/user/routes/#interfaces.user.routes.update_current_user","title":"update_current_user async","text":"
update_current_user(request: Request, body: dict)\n

Update the profile of the authenticated user.

Creates the profile on first access, then applies the update payload.

Parameters:

Name Type Description Default request Request

Incoming HTTP request; carries the authenticated user and app.state.db_resources.

required body dict

Fields to update on the current user's profile.

required

Returns:

Name Type Description UserDocument

The updated profile.

Raises:

Type Description HTTPException

401 when the request is not authenticated.

"},{"location":"pipelines/","title":"Pipelines","text":""},{"location":"pipelines/#pipelines","title":"pipelines","text":""},{"location":"pipelines/#pipelines--summary","title":"Summary","text":"

Top-level pipelines package for the khata-app Expenses Service backend.

"},{"location":"pipelines/#pipelines--notes","title":"Notes","text":"

Pipeline families live in dedicated subpackages. The enrichment family lives under pipelines.enrichment and is documented there; keep this package free of implementation modules.

"},{"location":"pipelines/enrichment/","title":"Enrichment","text":""},{"location":"pipelines/enrichment/#pipelines.enrichment","title":"pipelines.enrichment","text":""},{"location":"pipelines/enrichment/#pipelines.enrichment--summary","title":"Summary","text":"

Enrichment pipelines (entity + tags) as hexa-wired dagpipe graphs.

"},{"location":"pipelines/enrichment/#pipelines.enrichment--notes","title":"Notes","text":"

get_entity_pipeline / get_tags_pipeline return memoized, fully assembled roots \u2014 hexa wiring + pattern registry + dagpipe Engine \u2014 matching the OG domain/enrichment adaptors' behaviour.

"},{"location":"pipelines/enrichment/#pipelines.enrichment-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/#pipelines.enrichment-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/#pipelines.enrichment.get_entity_pipeline","title":"get_entity_pipeline","text":"
get_entity_pipeline()\n

Build and memoize the entity enrichment pipeline root.

Returns:

Name Type Description ImplEntityPipeline

The assembled entity pipeline root.

"},{"location":"pipelines/enrichment/#pipelines.enrichment.get_tags_pipeline","title":"get_tags_pipeline","text":"
get_tags_pipeline()\n

Build and memoize the tags enrichment pipeline root.

Returns:

Name Type Description ImplTagsPipeline

The assembled tags pipeline root.

"},{"location":"pipelines/enrichment/entity/","title":"Entity","text":""},{"location":"pipelines/enrichment/entity/#pipelines.enrichment.entity","title":"pipelines.enrichment.entity","text":""},{"location":"pipelines/enrichment/entity/#pipelines.enrichment.entity--summary","title":"Summary","text":"

Entity enrichment family (hexa-wired dagpipe graph).

"},{"location":"pipelines/enrichment/entity/#pipelines.enrichment.entity--notes","title":"Notes","text":"

Houses the abstract contracts (abc.py), the concrete dagpipe stage nodes and root (impl.py) and the runtime resources (resources/) for the entity family.

"},{"location":"pipelines/enrichment/entity/abc/","title":"Abc","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc","title":"pipelines.enrichment.entity.abc","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc--summary","title":"Summary","text":"

Abstract contracts for the entity enrichment family (no implementation).

The entity family is the classic dagpipe chain:

normalize \u2192 extract_candidates \u2192 candidate_flags \u2192 amount_flags \u2192\nset_entity \u2192 entity_alias \u2192 fallback\n

Each stage port is a dagpipe Node whose resolve yields forked States carrying confidence. EntityPipeline (the hexa root) wires the stage slots and runs the graph through a dagpipe Engine; EntityFinalizePort turns the terminal states into the entity result dict.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.CandidateFlagsPort","title":"CandidateFlagsPort","text":"

Bases: RegistryPort, ABC

candidate.value \u2192 candidate.flags via CANDIDATE_BASED_FLAG_MAPPING.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.CandidateFlagsPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.CandidateFlagsPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.CandidateFlagsPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.CandidateFlagsPort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield forks with candidate.flags updated from the candidate value.

Parameters:

Name Type Description Default state State

Incoming dagpipe state carrying candidate.

required

Yields:

Name Type Description State Iterable[State]

Forked states with candidate.flags populated.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.CandidateFlagsPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.CandidateFlagsPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityAliasPort","title":"EntityAliasPort","text":"

Bases: RegistryPort, ABC

candidate.value \u2192 entity via ENTITY_ALIAS_REGEX (when name not set).

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityAliasPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityAliasPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityAliasPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityAliasPort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield the aliased entity fork from the candidate value.

Parameters:

Name Type Description Default state State

Incoming dagpipe state carrying a candidate value.

required

Yields:

Name Type Description State Iterable[State]

Forked states with the aliased entity.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityAliasPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityAliasPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityFinalizePort","title":"EntityFinalizePort","text":"

Bases: FinalizePort, ABC

terminal states \u2192 {entity.name, entity.id, entity.type, ...}.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityFinalizePort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityFinalizePort.process","title":"process abstractmethod","text":"
process(states: List) -> dict\n

Build the entity result dict from the terminal states.

Parameters:

Name Type Description Default states List

Terminal states from the dagpipe graph.

required

Returns:

Name Type Description dict dict

The entity result dict.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityPipeline","title":"EntityPipeline","text":"

Bases: ABC

Root \u2014 wires normalize \u2192 \u2026 \u2192 fallback, then runs the dagpipe graph.

Attributes:

Name Type Description normalize NormalizePort

Normalize stage port.

extract_candidates ExtractCandidatesPort

Extract-candidates stage port.

candidate_flags CandidateFlagsPort

Candidate-flags stage port.

amount_flags AmountFlagsPort

Amount-flags stage port.

set_entity SetEntityPort

Set-entity stage port.

entity_alias EntityAliasPort

Entity-alias stage port.

fallback FallbackPort

Fallback stage port.

finalize EntityFinalizePort

Terminal finalize port.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityPipeline-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.EntityPipeline.enrich","title":"enrich abstractmethod","text":"
enrich(payload: dict) -> dict\n

Enrich a raw transaction payload into an entity result.

Parameters:

Name Type Description Default payload dict

Raw transaction payload.

required

Returns:

Name Type Description dict dict

The entity result dict.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.ExtractCandidatesPort","title":"ExtractCandidatesPort","text":"

Bases: RegistryPort, ABC

signals \u2192 candidate.value forks (confidence penalties on fallbacks).

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.ExtractCandidatesPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.ExtractCandidatesPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.ExtractCandidatesPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.ExtractCandidatesPort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield candidate.value forks, penalizing fallback candidates.

Parameters:

Name Type Description Default state State

Incoming dagpipe state carrying signals.

required

Yields:

Name Type Description State Iterable[State]

Forked states carrying a candidate.value.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.ExtractCandidatesPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.ExtractCandidatesPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.FallbackPort","title":"FallbackPort","text":"

Bases: RegistryPort, ABC

Terminal \u2014 merchant/person fallback or Unknown.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.FallbackPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.FallbackPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.FallbackPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.FallbackPort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield the terminal fallback entity fork.

Parameters:

Name Type Description Default state State

Incoming terminal dagpipe state.

required

Yields:

Name Type Description State Iterable[State]

Forked states with the fallback entity.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.FallbackPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.FallbackPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.NormalizePort","title":"NormalizePort","text":"

Bases: RegistryPort, ABC

raw.description \u2192 signals (raw/items/parts), stripping number sequences.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.NormalizePort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.NormalizePort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.NormalizePort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.NormalizePort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield the normalized signals fork of the incoming state.

Parameters:

Name Type Description Default state State

Incoming dagpipe state carrying raw.description.

required

Yields:

Name Type Description State Iterable[State]

Forked states carrying the normalized signals.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.NormalizePort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.NormalizePort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.SetEntityPort","title":"SetEntityPort","text":"

Bases: RegistryPort, ABC

candidate.flags \u2192 entity via FLAGS_BASED_ENTITY_RULES.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.SetEntityPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.SetEntityPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.SetEntityPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.SetEntityPort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield the resolved entity fork from candidate flags.

Parameters:

Name Type Description Default state State

Incoming dagpipe state carrying candidate flags.

required

Yields:

Name Type Description State Iterable[State]

Forked states carrying the resolved entity.

"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.SetEntityPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/abc/#pipelines.enrichment.entity.abc.SetEntityPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/impl/","title":"Impl","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl","title":"pipelines.enrichment.entity.impl","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl--summary","title":"Summary","text":"

Concrete entity-family implementations (dagpipe stage nodes + root).

Stage bodies are ports of domain/enrichment/entity/resolver.py, keeping the exact fork/confidence semantics. The root ImplEntityPipeline.enrich runs the hexa-wired stage graph through a dagpipe Engine (assembled in shared/loader.py) and delegates terminal processing to ImplEntityFinalizePort (port of EntityStatesProcessorAdaptor).

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplCandidateFlagsPort","title":"ImplCandidateFlagsPort","text":"

Bases: CandidateFlagsPort

Candidate-flags stage: keyword matches append candidate-based flags.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplCandidateFlagsPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplCandidateFlagsPort.candidate_based_flag_mapping","title":"candidate_based_flag_mapping property","text":"
candidate_based_flag_mapping\n

Keyword \u2192 flag mapping used for candidate flagging.

Returns:

Name Type Description dict

The candidate-based flag mapping.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplCandidateFlagsPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplCandidateFlagsPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplCandidateFlagsPort.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Append candidate flags whose keywords appear in the candidate value.

Parameters:

Name Type Description Default state State

Incoming state carrying a candidate value and flags.

required

Yields:

Name Type Description State Iterable[State]

A fork with updated candidate.flags when flags changed, else the unmodified state.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplCandidateFlagsPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplCandidateFlagsPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort","title":"ImplEntityAliasPort","text":"

Bases: EntityAliasPort

Entity-alias stage: resolve the entity from the candidate via aliases.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort.default_logo_mapping","title":"default_logo_mapping property","text":"
default_logo_mapping\n

Entity type \u2192 default logo mapping.

Returns:

Name Type Description dict

The default logo mapping.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort.entity_alias_regex","title":"entity_alias_regex property","text":"
entity_alias_regex\n

Alias regex \u2192 name pairs used for entity resolution.

Returns:

Type Description

List[Tuple[re.Pattern, str]]: Compiled (regex, name) pairs.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort.entity_type_mapping","title":"entity_type_mapping property","text":"
entity_type_mapping\n

Entity id \u2192 type mapping used for entity resolution.

Returns:

Name Type Description dict

The entity type mapping.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Resolve the entity from the candidate value via alias regexes.

Parameters:

Name Type Description Default state State

Incoming state carrying a candidate value.

required

Yields:

Name Type Description State Iterable[State]

A fork with the aliased entity payload, or the unmodified state when the name is already set or no alias matches.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityAliasPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityFinalizePort","title":"ImplEntityFinalizePort","text":"

Bases: EntityFinalizePort

Finalize terminal states into the entity result dict.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityFinalizePort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityFinalizePort.process","title":"process","text":"
process(states: List) -> dict\n

Build the entity result dict from the best terminal state.

Parameters:

Name Type Description Default states List

Terminal states from the dagpipe graph.

required

Returns:

Name Type Description dict dict

The entity result dict (name, id, type, logo, raw_candidate, candidate flags and tags).

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityPipeline","title":"ImplEntityPipeline","text":"

Bases: EntityPipeline

Concrete entity pipeline root wiring the stage ports.

Attributes:

Name Type Description normalize ImplNormalizePort

Normalize stage port.

extract_candidates ImplExtractCandidatesPort

Extract-candidates port.

candidate_flags ImplCandidateFlagsPort

Candidate-flags port.

amount_flags ImplAmountFlagsPort

Amount-flags port.

set_entity ImplSetEntityPort

Set-entity port.

entity_alias ImplEntityAliasPort

Entity-alias port.

fallback ImplFallbackPort

Fallback port.

finalize ImplEntityFinalizePort

Terminal finalize port.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityPipeline-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplEntityPipeline.enrich","title":"enrich","text":"
enrich(payload: dict) -> dict\n

Run the entity graph on a raw payload and finalize the result.

Parameters:

Name Type Description Default payload dict

Raw transaction payload.

required

Returns:

Name Type Description dict dict

The entity result dict from the finalize port.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplExtractCandidatesPort","title":"ImplExtractCandidatesPort","text":"

Bases: ExtractCandidatesPort

Extract-candidates stage: signals \u2192 candidate value forks with penalties.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplExtractCandidatesPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplExtractCandidatesPort.candidate_regex","title":"candidate_regex property","text":"
candidate_regex\n

Candidate extraction regexes from the pattern registry.

Returns:

Type Description

List[re.Pattern]: Compiled candidate extraction regexes.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplExtractCandidatesPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplExtractCandidatesPort.negative_candidates","title":"negative_candidates property","text":"
negative_candidates\n

Tokens excluded from candidate extraction.

Returns:

Name Type Description List

The registered negative candidate tokens.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplExtractCandidatesPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplExtractCandidatesPort.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Yield candidate-value forks from signals, penalizing fallbacks.

Parameters:

Name Type Description Default state State

Incoming state carrying signals.

required

Yields:

Name Type Description State Iterable[State]

Forks carrying candidate.value for each accepted candidate (parts/items fallbacks penalized), or a single penalized fork when nothing matches.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplExtractCandidatesPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplExtractCandidatesPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplFallbackPort","title":"ImplFallbackPort","text":"

Bases: FallbackPort

Terminal fallback stage: candidate merchant/person, else Unknown.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplFallbackPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplFallbackPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplFallbackPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplFallbackPort.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Assign the terminal fallback entity when none was resolved.

Parameters:

Name Type Description Default state State

Incoming terminal state.

required

Yields:

Name Type Description State Iterable[State]

A fork carrying the fallback entity (candidate, Unknown, or the already-resolved entity).

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplFallbackPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplFallbackPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplNormalizePort","title":"ImplNormalizePort","text":"

Bases: NormalizePort

Normalize stage: strip number sequences, then build raw/items/parts signals.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplNormalizePort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplNormalizePort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplNormalizePort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplNormalizePort.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Clean raw.description and yield a single signals fork.

Parameters:

Name Type Description Default state State

Incoming state carrying raw.description and the raw.amount/raw.balance values.

required

Yields:

Name Type Description State Iterable[State]

A single fork populating signals.raw, signals.items and signals.parts.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplNormalizePort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplNormalizePort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort","title":"ImplSetEntityPort","text":"

Bases: SetEntityPort

Set-entity stage: resolve the entity from candidate flags via rules.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort.default_logo_mapping","title":"default_logo_mapping property","text":"
default_logo_mapping\n

Entity type \u2192 default logo mapping.

Returns:

Name Type Description dict

The default logo mapping.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort.entity_type_mapping","title":"entity_type_mapping property","text":"
entity_type_mapping\n

Entity id \u2192 type mapping used for entity resolution.

Returns:

Name Type Description dict

The entity type mapping.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort.flags_based_entity_rules","title":"flags_based_entity_rules property","text":"
flags_based_entity_rules\n

Flag-matching rules that emit the resolved entity.

Returns:

Type Description

List[Dict]: The ordered entity rules.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Resolve the entity from candidate flags using the first matching rule.

Parameters:

Name Type Description Default state State

Incoming state carrying candidate flags.

required

Yields:

Name Type Description State Iterable[State]

A fork with the resolved entity payload, the unmodified state when an entity name is already set, or a penalized fork when unresolvable.

"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl.ImplSetEntityPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/entity/impl/#pipelines.enrichment.entity.impl-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/","title":"Shared","text":""},{"location":"pipelines/enrichment/shared/#pipelines.enrichment.shared","title":"pipelines.enrichment.shared","text":""},{"location":"pipelines/enrichment/shared/#pipelines.enrichment.shared--summary","title":"Summary","text":"

Shared enrichment core: models, identity, utils, ports, loader, registry.

"},{"location":"pipelines/enrichment/shared/#pipelines.enrichment.shared--notes","title":"Notes","text":"

These modules are shared by the entity and tags enrichment families.

"},{"location":"pipelines/enrichment/shared/identity/","title":"Identity","text":""},{"location":"pipelines/enrichment/shared/identity/#pipelines.enrichment.shared.identity","title":"pipelines.enrichment.shared.identity","text":""},{"location":"pipelines/enrichment/shared/identity/#pipelines.enrichment.shared.identity--summary","title":"Summary","text":"

Entity identity helpers (port of domain/enrichment/entity/identity.py).

"},{"location":"pipelines/enrichment/shared/identity/#pipelines.enrichment.shared.identity-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/identity/#pipelines.enrichment.shared.identity.build_entity","title":"build_entity","text":"
build_entity(\n    name: str,\n    entity_type: str = \"merchant\",\n    entity_logo: str | None = None,\n) -> dict\n

Build the entity payload dict from name, type and logo.

Parameters:

Name Type Description Default name str

Entity display name.

required entity_type str

Entity type key, defaults to \"merchant\".

'merchant' entity_logo str | None

Logo URL, or None.

None

Returns:

Name Type Description dict dict

Entity payload with entity.id, entity.name, entity.type and entity.logo keys.

"},{"location":"pipelines/enrichment/shared/identity/#pipelines.enrichment.shared.identity.canonicalize_candidate","title":"canonicalize_candidate","text":"
canonicalize_candidate(candidate: str | None) -> str | None\n

Canonicalize a candidate value via normalize_key.

Parameters:

Name Type Description Default candidate str | None

Raw candidate, or None/empty.

required

Returns:

Type Description str | None

str | None: The normalized candidate, or None when candidate is empty.

"},{"location":"pipelines/enrichment/shared/identity/#pipelines.enrichment.shared.identity.normalize_key","title":"normalize_key","text":"
normalize_key(text: str | None) -> str | None\n

Normalize a key: NFKC, lowercase and stripped.

Parameters:

Name Type Description Default text str | None

Raw key, or None.

required

Returns:

Type Description str | None

str | None: The normalized key, or None when text is None.

"},{"location":"pipelines/enrichment/shared/identity/#pipelines.enrichment.shared.identity.to_entity_id","title":"to_entity_id","text":"
to_entity_id(name: str | None) -> str | None\n

Build the canonical snake-cased entity id from a name.

Parameters:

Name Type Description Default name str | None

Raw entity name, or None/empty.

required

Returns:

Type Description str | None

str | None: The snake-cased entity id, or None when name is empty.

"},{"location":"pipelines/enrichment/shared/impl/","title":"Impl","text":""},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl","title":"pipelines.enrichment.shared.impl","text":""},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl--summary","title":"Summary","text":"

Concrete shared enrichment ports.

ImplAmountFlagsPort is the port of domain.enrichment.nodes.AmountBasedFlagNode \u2014 used by both the entity and tags families.

"},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl.ImplAmountFlagsPort","title":"ImplAmountFlagsPort","text":"

Bases: AmountFlagsPort

Amount-flags stage: map the amount to amount_* candidate flags.

Notes

Shared by the entity and tags families; the amount-flag name encodes the comparison (e.g. amount_greater_than_500, amount_within_5_500).

"},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl.ImplAmountFlagsPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl.ImplAmountFlagsPort.amount_based_flag_mapping","title":"amount_based_flag_mapping property","text":"
amount_based_flag_mapping\n

Flag names to evaluate, taken from the registry.

Returns:

Name Type Description List

The registered amount-flag names.

"},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl.ImplAmountFlagsPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl.ImplAmountFlagsPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl.ImplAmountFlagsPort.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Evaluate the amount-based flags and append the matches.

Parameters:

Name Type Description Default state State

Incoming state carrying raw.amount and candidate.flags.

required

Yields:

Name Type Description State Iterable[State]

A fork with candidate.flags updated when flags were appended, else the unmodified state.

"},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl.ImplAmountFlagsPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/shared/impl/#pipelines.enrichment.shared.impl.ImplAmountFlagsPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/shared/loader/","title":"Loader","text":""},{"location":"pipelines/enrichment/shared/loader/#pipelines.enrichment.shared.loader","title":"pipelines.enrichment.shared.loader","text":""},{"location":"pipelines/enrichment/shared/loader/#pipelines.enrichment.shared.loader--summary","title":"Summary","text":"

Assemble a hexa-wired enrichment port tree into a runnable dagpipe graph.

Flow (mirrors domain/enrichment/{entity,tags}/pipeline.py#load, but hexa replaces the class-path import/instantiation and the dagpipe spec is consumed for its schema/graph/per-node config):

  1. hexa.build(root_cls) instantiates and wires every stage port slot.
  2. The family resources/patterns/*.yaml files merge into a PatternRegistry.
  3. Each stage port (slot name == dagpipe node id) gets set_registry + set_config from the family resources/pipeline.yaml.
  4. The dagpipe schema: builds a State subclass, graph: builds the Graph, and the Engine is created.
  5. The Engine + State class are attached to the wired root for enrich().
"},{"location":"pipelines/enrichment/shared/loader/#pipelines.enrichment.shared.loader-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/shared/loader/#pipelines.enrichment.shared.loader-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/loader/#pipelines.enrichment.shared.loader.load","title":"load","text":"
load(root_cls: type, resources_dir: Path)\n

Build the wired root + dagpipe runtime; attach engine/state_cls to root.

Parameters:

Name Type Description Default root_cls type

Composition root class to hexa-build.

required resources_dir Path

Family resources directory containing pipeline.yaml and patterns/.

required

Returns:

Name Type Description object

The wired root instance with _engine/_state_cls attached.

Raises:

Type Description FileNotFoundError

When pipeline.yaml does not exist.

"},{"location":"pipelines/enrichment/shared/models/","title":"Models","text":""},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models","title":"pipelines.enrichment.shared.models","text":""},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models--summary","title":"Summary","text":"

Pattern model family + PatternRegistry (port of domain/enrichment/models.py).

The registry is loaded from the family resources/patterns/*.yaml files and injected into every dagpipe stage node via set_registry.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.ArrayPattern","title":"ArrayPattern","text":"

Bases: BasePattern

Array pattern: a plain list of values.

Attributes:

Name Type Description type Literal[ARRAY]

Fixed discriminator.

array List

Plain value list.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.BasePattern","title":"BasePattern","text":"

Bases: BaseModel

Base model for all patterns: a discriminated type tag.

Attributes:

Name Type Description type PatternType

Pattern kind discriminator.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.KeywordsPattern","title":"KeywordsPattern","text":"

Bases: BasePattern

Keywords pattern: a flat list of keywords.

Attributes:

Name Type Description type Literal[KEYWORDS]

Fixed discriminator.

items List[str]

Keyword list.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.MappingPattern","title":"MappingPattern","text":"

Bases: BasePattern

Enumerated mapping of token \u2192 value.

Attributes:

Name Type Description type Literal[MAPPING]

Fixed discriminator.

mapping Dict[str, Union[str, MappingValue, List]]

Token mapping.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.MappingValue","title":"MappingValue","text":"

Bases: BaseModel

Named value inside a mapping pattern.

Attributes:

Name Type Description id str

Mapping key id.

name str

Display name.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry","title":"PatternRegistry","text":"

Bases: BaseModel

Loaded pattern registry injected into dagpipe stage nodes.

Attributes:

Name Type Description version int

Registry schema version.

patterns Dict[str, Pattern]

Name \u2192 pattern.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry.array","title":"array","text":"
array(name: str) -> List\n

Return the raw array of an ArrayPattern.

Parameters:

Name Type Description Default name str

Pattern name.

required

Returns:

Name Type Description List List

The array items.

Raises:

Type Description TypeError

When the pattern is not an ArrayPattern.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry.get","title":"get","text":"
get(name: str) -> Pattern\n

Look up a pattern by name.

Parameters:

Name Type Description Default name str

Pattern name.

required

Returns:

Name Type Description Pattern Pattern

The stored pattern object.

Raises:

Type Description KeyError

When the pattern name is not registered.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry.keywords","title":"keywords","text":"
keywords(name: str) -> List[str]\n

Return the keyword list of a KeywordsPattern.

Parameters:

Name Type Description Default name str

Pattern name.

required

Returns:

Type Description List[str]

List[str]: The keyword items.

Raises:

Type Description TypeError

When the pattern is not a KeywordsPattern.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry.mapping","title":"mapping","text":"
mapping(name: str) -> Dict[str, str]\n

Return the token mapping of a MappingPattern.

Parameters:

Name Type Description Default name str

Pattern name.

required

Returns:

Type Description Dict[str, str]

Dict[str, str]: The mapping dict.

Raises:

Type Description TypeError

When the pattern is not a MappingPattern.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry.regex","title":"regex","text":"
regex(name: str) -> re.Pattern\n

Return the compiled regex of a RegexPattern.

Parameters:

Name Type Description Default name str

Pattern name.

required

Returns:

Type Description Pattern

re.Pattern: The compiled regex.

Raises:

Type Description TypeError

When the pattern is not a RegexPattern.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry.regex_list","title":"regex_list","text":"
regex_list(name: str) -> List[re.Pattern]\n

Return the compiled regexes of a RegexListPattern.

Parameters:

Name Type Description Default name str

Pattern name.

required

Returns:

Type Description List[Pattern]

List[re.Pattern]: The compiled regexes.

Raises:

Type Description TypeError

When the pattern is not a RegexListPattern.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry.regex_map","title":"regex_map","text":"
regex_map(name: str) -> List[Tuple[re.Pattern, str]]\n

Return the compiled (regex, value) pairs of a RegexMapPattern.

Parameters:

Name Type Description Default name str

Pattern name.

required

Returns:

Type Description List[Tuple[Pattern, str]]

List[Tuple[re.Pattern, str]]: The compiled pairs.

Raises:

Type Description TypeError

When the pattern is not a RegexMapPattern.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry.rules","title":"rules","text":"
rules(name: str) -> List[Dict]\n

Return the rule list of a RulesPattern.

Parameters:

Name Type Description Default name str

Pattern name.

required

Returns:

Type Description List[Dict]

List[Dict]: The ordered rules.

Raises:

Type Description TypeError

When the pattern is not a RulesPattern.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternRegistry.template","title":"template","text":"
template(name: str) -> str\n

Return the format string of a TemplatePattern.

Parameters:

Name Type Description Default name str

Pattern name.

required

Returns:

Name Type Description str str

The template format string.

Raises:

Type Description TypeError

When the pattern is not a TemplatePattern.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.PatternType","title":"PatternType","text":"

Bases: str, Enum

Supported pattern kinds loaded from the family pattern files.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RegexListPattern","title":"RegexListPattern","text":"

Bases: BasePattern

List-of-regexes pattern.

Attributes:

Name Type Description type Literal[REGEX_LIST]

Fixed discriminator.

patterns List[str]

Regex sources.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RegexListPattern-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RegexListPattern.compile_all","title":"compile_all","text":"
compile_all(flags: int = re.IGNORECASE) -> List[re.Pattern]\n

Compile every regex source.

Parameters:

Name Type Description Default flags int

Compile flags, default re.IGNORECASE.

IGNORECASE

Returns:

Type Description List[Pattern]

List[re.Pattern]: The compiled regexes.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RegexMapPattern","title":"RegexMapPattern","text":"

Bases: BasePattern

Regex \u2192 value mapping pattern.

Attributes:

Name Type Description type Literal[REGEX_MAP]

Fixed discriminator.

mapping Dict[str, str]

Regex source \u2192 value.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RegexMapPattern-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RegexMapPattern.compile_all","title":"compile_all","text":"
compile_all(\n    flags: int = re.IGNORECASE,\n) -> List[Tuple[re.Pattern, str]]\n

Pre-compile the mapping into (regex, value) pairs.

Parameters:

Name Type Description Default flags int

Compile flags, default re.IGNORECASE.

IGNORECASE

Returns:

Type Description List[Tuple[Pattern, str]]

List[Tuple[re.Pattern, str]]: The compiled pairs.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RegexPattern","title":"RegexPattern","text":"

Bases: BasePattern

Single-regex pattern.

Attributes:

Name Type Description type Literal[REGEX]

Fixed discriminator.

pattern str

Regex source.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RegexPattern-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RegexPattern.compile","title":"compile","text":"
compile(flags: int = re.IGNORECASE) -> re.Pattern\n

Compile the regex pattern.

Parameters:

Name Type Description Default flags int

Compile flags, default re.IGNORECASE.

IGNORECASE

Returns:

Type Description Pattern

re.Pattern: The compiled regex.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.RulesPattern","title":"RulesPattern","text":"

Bases: BasePattern

Rule-set pattern: ordered flag rules with emit payloads.

Attributes:

Name Type Description type Literal[RULES]

Fixed discriminator.

rules List[Dict]

Ordered rule dicts.

"},{"location":"pipelines/enrichment/shared/models/#pipelines.enrichment.shared.models.TemplatePattern","title":"TemplatePattern","text":"

Bases: BasePattern

String-template pattern.

Attributes:

Name Type Description type Literal[TEMPLATE]

Fixed discriminator.

format str

Format/template string.

"},{"location":"pipelines/enrichment/shared/ports/","title":"Ports","text":""},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports","title":"pipelines.enrichment.shared.ports","text":""},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports--summary","title":"Summary","text":"

Shared enrichment port contracts.

Stage ports are dagpipe Nodes: hexa.build() wires their instances on a family root, the shared loader injects the pattern registry + per-node config, and a dagpipe Engine executes them. FinalizePort is the terminal state processor (confidence sort + result dict building).

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.AmountFlagsPort","title":"AmountFlagsPort","text":"

Bases: RegistryPort, ABC

amount \u2192 amount_* candidate flags (shared by entity and tags families).

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.AmountFlagsPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.AmountFlagsPort.amount_based_flag_mapping","title":"amount_based_flag_mapping property","text":"
amount_based_flag_mapping\n

Flag names to evaluate, taken from the registry.

Returns:

Name Type Description List

The registered amount-flag names.

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.AmountFlagsPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.AmountFlagsPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.AmountFlagsPort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield the forked states with amount_* flags applied.

Parameters:

Name Type Description Default state State

Incoming dagpipe state carrying the amount.

required

Yields:

Name Type Description State Iterable[State]

Forked states carrying the updated candidate flags.

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.AmountFlagsPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.AmountFlagsPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.FinalizePort","title":"FinalizePort","text":"

Bases: ABC

Terminal state processor: confidence sort then build the result dict.

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.FinalizePort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.FinalizePort.process","title":"process abstractmethod","text":"
process(states: list) -> dict\n

Build the result dict from the terminal states.

Parameters:

Name Type Description Default states list

Terminal states from the dagpipe graph.

required

Returns:

Name Type Description dict dict

The generated result dict.

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.RegistryPort","title":"RegistryPort","text":"

Bases: Node, ABC

dagpipe node with injectable PatternRegistry + per-node config.

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.RegistryPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.RegistryPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.RegistryPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.RegistryPort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield the forked states carrying this stage's output.

Parameters:

Name Type Description Default state State

Incoming dagpipe state.

required

Yields:

Name Type Description State Iterable[State]

Forked states carrying the stage output.

"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.RegistryPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/shared/ports/#pipelines.enrichment.shared.ports.RegistryPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/shared/registry/","title":"Registry","text":""},{"location":"pipelines/enrichment/shared/registry/#pipelines.enrichment.shared.registry","title":"pipelines.enrichment.shared.registry","text":""},{"location":"pipelines/enrichment/shared/registry/#pipelines.enrichment.shared.registry--summary","title":"Summary","text":"

Registry mapping enrichment family \u2192 composition root.

Enrichment has two families (entity, tags); each has a single default root (no per-bank variants) so the family is the root, living in the family's impl.py. Callers use resolve_enrichment_root instead of hand-rolled maps.

"},{"location":"pipelines/enrichment/shared/registry/#pipelines.enrichment.shared.registry-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/shared/registry/#pipelines.enrichment.shared.registry-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/registry/#pipelines.enrichment.shared.registry.known_enrichment_roots","title":"known_enrichment_roots","text":"
known_enrichment_roots() -> list\n

List the registered enrichment family names.

Returns:

Name Type Description list list

The known family names.

"},{"location":"pipelines/enrichment/shared/registry/#pipelines.enrichment.shared.registry.resolve_enrichment_root","title":"resolve_enrichment_root","text":"
resolve_enrichment_root(family: str) -> type\n

Return the composition root class for an enrichment family.

Parameters:

Name Type Description Default family str

Enrichment family name (\"entity\" or \"tags\").

required

Returns:

Name Type Description type type

The composition root class for the family.

Raises:

Type Description ValueError

When the family has no registered enrichment root.

"},{"location":"pipelines/enrichment/shared/utils/","title":"Utils","text":""},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils","title":"pipelines.enrichment.shared.utils","text":""},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils--summary","title":"Summary","text":"

Description/candidate utilities (port of domain/enrichment/entity/utils.py).

"},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils.extract_candidates","title":"extract_candidates","text":"
extract_candidates(\n    description: str,\n    candidate_regexes: Iterable[re.Pattern],\n) -> List[str]\n

Extract valid payee candidates from a description.

Parameters:

Name Type Description Default description str

Raw description text.

required candidate_regexes Iterable[Pattern]

Compiled extraction regexes.

required

Returns:

Type Description List[str]

List[str]: The normalized valid candidates.

"},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils.is_valid_candidate","title":"is_valid_candidate","text":"
is_valid_candidate(candidate: str) -> bool\n

Return True when a candidate looks like a plausible payee.

Parameters:

Name Type Description Default candidate str

Extracted candidate value.

required

Returns:

Name Type Description bool bool

True when the candidate passes the length/content heuristics.

"},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils.lookup_mapping","title":"lookup_mapping","text":"
lookup_mapping(candidate: str, mapping: dict)\n

Look up mapping values for a candidate token.

Parameters:

Name Type Description Default candidate str

Candidate token.

required mapping dict

Mapping dict of key \u2192 MappingValue.

required

Returns:

Name Type Description list

Matching value names, or (None, None) when the candidate is empty.

"},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils.normalize_description","title":"normalize_description","text":"
normalize_description(text: str) -> str\n

Normalize a description: separators \u2192 space, lowercase, drop OCR noise.

Parameters:

Name Type Description Default text str

Raw description.

required

Returns:

Name Type Description str str

The normalized lowercase description.

"},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils.normalize_money_str","title":"normalize_money_str","text":"
normalize_money_str(x) -> str\n

Format a numeric value as a fixed two-decimal string.

Parameters:

Name Type Description Default x float

Value coercible to float.

required

Returns:

Name Type Description str str

The value formatted to exactly two decimals.

"},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils.normalize_person_handle","title":"normalize_person_handle","text":"
normalize_person_handle(handle: str) -> str\n

Normalize a person/UPI handle into a capitalized display name.

Parameters:

Name Type Description Default handle str

Raw handle (may carry a UPI suffix or trailing digits).

required

Returns:

Name Type Description str str

The cleaned handle, or \"\" when only hex characters remain.

"},{"location":"pipelines/enrichment/shared/utils/#pipelines.enrichment.shared.utils.remove_number_sequence","title":"remove_number_sequence","text":"
remove_number_sequence(\n    text: str, amt: str, bal: str\n) -> str\n

Strip amount/balance digit sequences from a description.

Parameters:

Name Type Description Default text str

Description text.

required amt str

Amount value.

required bal str

Balance value.

required

Returns:

Name Type Description str str

The cleaned, whitespace-collapsed description.

"},{"location":"pipelines/enrichment/tags/","title":"Tags","text":""},{"location":"pipelines/enrichment/tags/#pipelines.enrichment.tags","title":"pipelines.enrichment.tags","text":""},{"location":"pipelines/enrichment/tags/#pipelines.enrichment.tags--summary","title":"Summary","text":"

Tags enrichment family (hexa-wired dagpipe graph).

"},{"location":"pipelines/enrichment/tags/#pipelines.enrichment.tags--notes","title":"Notes","text":"

Houses the abstract contracts (abc.py), the concrete dagpipe stage nodes and root (impl.py) and the runtime resources (resources/) for the tags family.

"},{"location":"pipelines/enrichment/tags/abc/","title":"Abc","text":""},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc","title":"pipelines.enrichment.tags.abc","text":""},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc--summary","title":"Summary","text":"

Abstract contracts for the tags enrichment family (no implementation).

The tags family chains resolved entities into tags:

amount_flags \u2192 entity_flags \u2192 set_tags\n

It consumes the output of the entity family (entity.name + amount) and emits tags. TagsPipeline is the hexa root; TagsFinalizePort dedupes tags and defaults to [\"misc\"].

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.EntityFlagsPort","title":"EntityFlagsPort","text":"

Bases: RegistryPort, ABC

entity.name + candidate.flags \u2192 entity_* flags via ENTITY_BASED_FLAG_MAPPING.

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.EntityFlagsPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.EntityFlagsPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.EntityFlagsPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.EntityFlagsPort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield forks with entity_* flags appended from the entity name.

Parameters:

Name Type Description Default state State

Incoming dagpipe state carrying entity.name.

required

Yields:

Name Type Description State Iterable[State]

Forked states carrying updated candidate flags.

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.EntityFlagsPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.EntityFlagsPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.SetTagsPort","title":"SetTagsPort","text":"

Bases: RegistryPort, ABC

candidate.flags \u2192 tags via FLAGS_BASED_TAGS_RULES.

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.SetTagsPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.SetTagsPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.SetTagsPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.SetTagsPort.resolve","title":"resolve abstractmethod","text":"
resolve(state: State) -> Iterable[State]\n

Yield forks with tags populated from candidate flags.

Parameters:

Name Type Description Default state State

Incoming dagpipe state carrying candidate flags.

required

Yields:

Name Type Description State Iterable[State]

Forked states carrying the emitted tags.

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.SetTagsPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.SetTagsPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.TagsFinalizePort","title":"TagsFinalizePort","text":"

Bases: FinalizePort, ABC

terminal states \u2192 {\"tags\": [...]} (deduped, default [\"misc\"]).

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.TagsFinalizePort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.TagsFinalizePort.process","title":"process abstractmethod","text":"
process(states: List) -> dict\n

Build the tags result dict from the terminal states.

Parameters:

Name Type Description Default states List

Terminal states from the dagpipe graph.

required

Returns:

Name Type Description dict dict

The tags result dict.

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.TagsPipeline","title":"TagsPipeline","text":"

Bases: ABC

Root \u2014 wires amount_flags \u2192 entity_flags \u2192 set_tags, then runs the graph.

Attributes:

Name Type Description amount_flags AmountFlagsPort

Amount-flags stage port.

entity_flags EntityFlagsPort

Entity-flags stage port.

set_tags SetTagsPort

Set-tags stage port.

finalize TagsFinalizePort

Terminal finalize port.

"},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.TagsPipeline-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/tags/abc/#pipelines.enrichment.tags.abc.TagsPipeline.enrich","title":"enrich abstractmethod","text":"
enrich(payload: dict) -> dict\n

Enrich an entity payload into a tags result.

Parameters:

Name Type Description Default payload dict

Payload carrying entity.name and the amount.

required

Returns:

Name Type Description dict dict

The tags result dict.

"},{"location":"pipelines/enrichment/tags/impl/","title":"Impl","text":""},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl","title":"pipelines.enrichment.tags.impl","text":""},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl--summary","title":"Summary","text":"

Concrete tags-family implementations (dagpipe stage nodes + root).

Stage bodies are ports of domain/enrichment/tags/flags.py. The root ImplTagsPipeline.enrich runs the hexa-wired stage graph through a dagpipe Engine and delegates terminal processing to ImplTagsFinalizePort (port of TagStatesProcessorAdaptor).

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl-classes","title":"Classes","text":""},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplEntityFlagsPort","title":"ImplEntityFlagsPort","text":"

Bases: EntityFlagsPort

Entity-flags stage: append entity_* flags from the entity name.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplEntityFlagsPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplEntityFlagsPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplEntityFlagsPort.entity_based_flag_mapping","title":"entity_based_flag_mapping property","text":"
entity_based_flag_mapping\n

Entity name \u2192 flag mapping used for entity flagging.

Returns:

Name Type Description dict

The entity-based flag mapping.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplEntityFlagsPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplEntityFlagsPort.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Append matching entity_* flags and reset tags.

Parameters:

Name Type Description Default state State

Incoming state carrying entity.name and candidate.flags.

required

Yields:

Name Type Description State Iterable[State]

A fork with updated candidate.flags and empty tags, or the unmodified state when no entity name is set.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplEntityFlagsPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplEntityFlagsPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplSetTagsPort","title":"ImplSetTagsPort","text":"

Bases: SetTagsPort

Set-tags stage: emit tags from the matching flag rules.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplSetTagsPort-attributes","title":"Attributes","text":""},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplSetTagsPort.config","title":"config property","text":"
config\n

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplSetTagsPort.flags_based_tags_rules","title":"flags_based_tags_rules property","text":"
flags_based_tags_rules\n

Flag-matching rules that emit tags.

Returns:

Type Description

List[Dict]: The ordered tag rules.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplSetTagsPort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplSetTagsPort.resolve","title":"resolve","text":"
resolve(state: State) -> Iterable[State]\n

Append tags emitted by the first matching flag rules.

Parameters:

Name Type Description Default state State

Incoming state carrying candidate flags and tags.

required

Yields:

Name Type Description State Iterable[State]

A fork with tags updated when rules matched, else the unmodified state.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplSetTagsPort.set_config","title":"set_config","text":"
set_config(config)\n

Inject the per-node config.

Parameters:

Name Type Description Default config dict

Per-node config from the dagpipe spec.

required"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplSetTagsPort.set_registry","title":"set_registry","text":"
set_registry(registry)\n

Inject the merged pattern registry.

Parameters:

Name Type Description Default registry PatternRegistry

The merged pattern registry.

required"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplTagsFinalizePort","title":"ImplTagsFinalizePort","text":"

Bases: TagsFinalizePort

Finalize terminal states into the tags result dict.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplTagsFinalizePort-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplTagsFinalizePort.process","title":"process","text":"
process(states: List) -> dict\n

Build the tags result dict, deduped and order-preserving.

Parameters:

Name Type Description Default states List

Terminal states from the dagpipe graph.

required

Returns:

Name Type Description dict dict

{\"tags\": [...]} with unique tags.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplTagsPipeline","title":"ImplTagsPipeline","text":"

Bases: TagsPipeline

Concrete tags pipeline root wiring the stage ports.

Attributes:

Name Type Description amount_flags ImplAmountFlagsPort

Amount-flags stage port.

entity_flags ImplEntityFlagsPort

Entity-flags stage port.

set_tags ImplSetTagsPort

Set-tags stage port.

finalize ImplTagsFinalizePort

Terminal finalize port.

"},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplTagsPipeline-functions","title":"Functions","text":""},{"location":"pipelines/enrichment/tags/impl/#pipelines.enrichment.tags.impl.ImplTagsPipeline.enrich","title":"enrich","text":"
enrich(payload: dict) -> dict\n

Run the tags graph on an entity payload and finalize the result.

Parameters:

Name Type Description Default payload dict

Payload carrying entity.name and the amount.

required

Returns:

Name Type Description dict dict

The tags result dict from the finalize port.

"},{"location":"pipelines/extraction/","title":"Extraction","text":""},{"location":"pipelines/extraction/#pipelines.extraction","title":"pipelines.extraction","text":""},{"location":"pipelines/extraction/#pipelines.extraction--summary","title":"Summary","text":"

Extraction pipelines, organized per source family.

pipeline \u2192 extraction \u2192 type [pdf,email,csv,xlsx,llama] \u2192 {pipeline.yaml, abc.py, impl.py, banks/}\n

Shared leaf contracts and cross-family machinery live in shared/; the registry mapping (source_type, bank, pipeline) \u2192 root lives in shared/registry.py.

"},{"location":"pipelines/extraction/csv/","title":"Csv","text":""},{"location":"pipelines/extraction/csv/#pipelines.extraction.csv","title":"pipelines.extraction.csv","text":""},{"location":"pipelines/extraction/csv/#pipelines.extraction.csv--summary","title":"Summary","text":"

csv (direct table) extraction family.

"},{"location":"pipelines/extraction/csv/abc/","title":"Abc","text":""},{"location":"pipelines/extraction/csv/abc/#pipelines.extraction.csv.abc","title":"pipelines.extraction.csv.abc","text":""},{"location":"pipelines/extraction/csv/abc/#pipelines.extraction.csv.abc--summary","title":"Summary","text":"

Abstract contracts for the csv (direct table) extraction graph.

The csv family is a \"direct table\" pipeline \u2014 no OCR, no buckets, no ambiguity. It shares the tabular core (shared/tabular.py) with xlsx: only the table reader differs (csv rows vs xlsx worksheet rows). Bank-specific readers live under banks/.

"},{"location":"pipelines/extraction/csv/abc/#pipelines.extraction.csv.abc-classes","title":"Classes","text":""},{"location":"pipelines/extraction/csv/abc/#pipelines.extraction.csv.abc.CsvExtractionPipeline","title":"CsvExtractionPipeline","text":"

Bases: TabularExtractionPipeline

csv-family root \u2014 pins only the reader; chain shared with xlsx.

Slot annotations

source: ExtractionSource ingest, table_reader, txn_dicts, raw_expense

Attributes:

Name Type Description source ExtractionSource

The extraction source descriptor.

table_reader CsvTableReaderPort

Csv table reader stage.

"},{"location":"pipelines/extraction/csv/abc/#pipelines.extraction.csv.abc.CsvExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/csv/abc/#pipelines.extraction.csv.abc.CsvExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the direct-table extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/csv/abc/#pipelines.extraction.csv.abc.CsvTableReaderPort","title":"CsvTableReaderPort","text":"

Bases: TableReaderPort

content \u2192 list of typed records read from a csv statement file.

"},{"location":"pipelines/extraction/csv/abc/#pipelines.extraction.csv.abc.CsvTableReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/csv/abc/#pipelines.extraction.csv.abc.CsvTableReaderPort.read","title":"read","text":"
read(content) -> List[dict]\n

Read typed records from a csv statement file.

Parameters:

Name Type Description Default content

Materialized content (bytes, Content, dict, or str).

required

Returns:

Type Description List[dict]

List[dict]: Typed table records.

"},{"location":"pipelines/extraction/csv/impl/","title":"Impl","text":""},{"location":"pipelines/extraction/csv/impl/#pipelines.extraction.csv.impl","title":"pipelines.extraction.csv.impl","text":""},{"location":"pipelines/extraction/csv/impl/#pipelines.extraction.csv.impl--summary","title":"Summary","text":"

Concrete csv-family implementations.

ImplCsvTableReaderPort reads csv rows with the omniread csv parser and runs them through the shared TableParserMixin (header location / aliases / typed conversion) to emit typed records. The chain (records \u2192 balance-adjusted txn dicts \u2192 raw expenses) is the shared tabular core.

"},{"location":"pipelines/extraction/csv/impl/#pipelines.extraction.csv.impl-classes","title":"Classes","text":""},{"location":"pipelines/extraction/csv/impl/#pipelines.extraction.csv.impl.ImplCsvExtractionPipeline","title":"ImplCsvExtractionPipeline","text":"

Bases: CsvExtractionPipeline

Concrete csv graph root.

Attributes:

Name Type Description ingest ImplIngestPort

Ingest stage.

table_reader ImplCsvTableReaderPort

Csv table reader stage.

txn_dicts ImplTabularTxnDictsPort

Shared tabular txn-dicts stage.

raw_expense ImplRawExpensePort

Terminal raw-expense stage.

"},{"location":"pipelines/extraction/csv/impl/#pipelines.extraction.csv.impl.ImplCsvExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/csv/impl/#pipelines.extraction.csv.impl.ImplCsvExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the direct-table extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/csv/impl/#pipelines.extraction.csv.impl.ImplCsvTableReaderPort","title":"ImplCsvTableReaderPort","text":"

Bases: TableParserMixin, CsvTableReaderPort

Concrete csv reader \u2014 omniread csv parser + shared TableParserMixin.

"},{"location":"pipelines/extraction/csv/impl/#pipelines.extraction.csv.impl.ImplCsvTableReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/csv/impl/#pipelines.extraction.csv.impl.ImplCsvTableReaderPort.read","title":"read","text":"
read(content) -> List[dict]\n

Read typed records from csv content.

Parameters:

Name Type Description Default content

Materialized content (Content, bytes, or dict).

required

Returns:

Type Description List[dict]

List[dict]: Typed table records.

"},{"location":"pipelines/extraction/csv/banks/","title":"Banks","text":""},{"location":"pipelines/extraction/csv/banks/#pipelines.extraction.csv.banks","title":"pipelines.extraction.csv.banks","text":""},{"location":"pipelines/extraction/csv/banks/#pipelines.extraction.csv.banks--summary","title":"Summary","text":"

csv family \u2014 bank-specific ports and pipeline roots.

"},{"location":"pipelines/extraction/csv/banks/axis/","title":"Axis","text":""},{"location":"pipelines/extraction/csv/banks/axis/#pipelines.extraction.csv.banks.axis","title":"pipelines.extraction.csv.banks.axis","text":""},{"location":"pipelines/extraction/csv/banks/axis/#pipelines.extraction.csv.banks.axis--summary","title":"Summary","text":"

Axis bank-specific port implementations (csv table path).

Faithful port of domain/extraction/banks/axis/csv.py:

AxisCsvExtractionPipeline pins the reader; ordering/balance policy stays in the shared tabular txn_dicts stage.

"},{"location":"pipelines/extraction/csv/banks/axis/#pipelines.extraction.csv.banks.axis-classes","title":"Classes","text":""},{"location":"pipelines/extraction/csv/banks/axis/#pipelines.extraction.csv.banks.axis.AxisCsvExtractionPipeline","title":"AxisCsvExtractionPipeline","text":"

Bases: ImplCsvExtractionPipeline

Axis csv graph root \u2014 pins the Axis reader.

Attributes:

Name Type Description table_reader AxisCsvTableReaderPort

Axis csv reader stage.

"},{"location":"pipelines/extraction/csv/banks/axis/#pipelines.extraction.csv.banks.axis.AxisCsvExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/csv/banks/axis/#pipelines.extraction.csv.banks.axis.AxisCsvExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the direct-table extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/csv/banks/axis/#pipelines.extraction.csv.banks.axis.AxisCsvTableReaderPort","title":"AxisCsvTableReaderPort","text":"

Bases: ImplCsvTableReaderPort

Axis csv reader \u2014 DR/CR inverted column aliases.

Attributes:

Name Type Description column_aliases Dict[str, List[str]]

Axis DR/CR-inverted aliases.

required_columns tuple

Required columns for header matching.

"},{"location":"pipelines/extraction/csv/banks/axis/#pipelines.extraction.csv.banks.axis.AxisCsvTableReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/csv/banks/axis/#pipelines.extraction.csv.banks.axis.AxisCsvTableReaderPort.read","title":"read","text":"
read(content) -> List[dict]\n

Read typed records from csv content.

Parameters:

Name Type Description Default content

Materialized content (Content, bytes, or dict).

required

Returns:

Type Description List[dict]

List[dict]: Typed table records.

"},{"location":"pipelines/extraction/csv/banks/icici/","title":"Icici","text":""},{"location":"pipelines/extraction/csv/banks/icici/#pipelines.extraction.csv.banks.icici","title":"pipelines.extraction.csv.banks.icici","text":""},{"location":"pipelines/extraction/csv/banks/icici/#pipelines.extraction.csv.banks.icici--summary","title":"Summary","text":"

Icici bank-specific port implementations (csv table path).

Faithful port of domain/extraction/banks/icici/csv.py: shares all table logic with xlsx via the shared TableParserMixin (default icici aliases).

IciciCsvExtractionPipeline pins the reader; ordering/balance policy stays in the shared tabular txn_dicts stage.

"},{"location":"pipelines/extraction/csv/banks/icici/#pipelines.extraction.csv.banks.icici-classes","title":"Classes","text":""},{"location":"pipelines/extraction/csv/banks/icici/#pipelines.extraction.csv.banks.icici.IciciCsvExtractionPipeline","title":"IciciCsvExtractionPipeline","text":"

Bases: ImplCsvExtractionPipeline

Icici csv graph root \u2014 pins the Icici reader.

Attributes:

Name Type Description table_reader IciciCsvTableReaderPort

Icici csv reader stage.

"},{"location":"pipelines/extraction/csv/banks/icici/#pipelines.extraction.csv.banks.icici.IciciCsvExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/csv/banks/icici/#pipelines.extraction.csv.banks.icici.IciciCsvExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the direct-table extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/csv/banks/icici/#pipelines.extraction.csv.banks.icici.IciciCsvTableReaderPort","title":"IciciCsvTableReaderPort","text":"

Bases: ImplCsvTableReaderPort

Icici csv reader \u2014 inherits the default (icici) column aliases.

"},{"location":"pipelines/extraction/csv/banks/icici/#pipelines.extraction.csv.banks.icici.IciciCsvTableReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/csv/banks/icici/#pipelines.extraction.csv.banks.icici.IciciCsvTableReaderPort.read","title":"read","text":"
read(content) -> List[dict]\n

Read typed records from csv content.

Parameters:

Name Type Description Default content

Materialized content (Content, bytes, or dict).

required

Returns:

Type Description List[dict]

List[dict]: Typed table records.

"},{"location":"pipelines/extraction/email/","title":"Email","text":""},{"location":"pipelines/extraction/email/#pipelines.extraction.email","title":"pipelines.extraction.email","text":""},{"location":"pipelines/extraction/email/#pipelines.extraction.email--summary","title":"Summary","text":"

email (message) extraction family.

"},{"location":"pipelines/extraction/email/abc/","title":"Abc","text":""},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc","title":"pipelines.extraction.email.abc","text":""},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc--summary","title":"Summary","text":"

Abstract contracts for the email (message) extraction graph (no implementation).

Email is NOT the OCR text chain. A message is self-contained \u2014 one HTML email maps to one transaction, so the chain is deliberately slim:

ingest \u2192 message_reader \u2192 message_parser \u2192 raw_expense\n

No bucket finding, splitting, or ambiguity resolution happens here.

"},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc-classes","title":"Classes","text":""},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc.EmailExtractionPipeline","title":"EmailExtractionPipeline","text":"

Bases: ABC

Root \u2014 wires ingest \u2192 message_reader \u2192 message_parser \u2192 raw_expense.

Attributes:

Name Type Description source ExtractionSource

The extraction source descriptor.

pipeline str

Pipeline tag; defaults to \"heuristic\".

ingest IngestPort

Ingest stage.

message_reader MessageReaderPort

Message-reading stage.

message_parser MessageParserPort

Message-parsing stage.

raw_expense RawExpensePort

Terminal raw-expense stage.

"},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc.EmailExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc.EmailExtractionPipeline.run","title":"run abstractmethod","text":"
run(source) -> List[Any]\n

Run the email extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc.MessageParserPort","title":"MessageParserPort","text":"

Bases: ABC

message text \u2192 one txn dict (date/particulars/amount/balance/direction).

"},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc.MessageParserPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc.MessageParserPort.parse","title":"parse abstractmethod","text":"
parse(message: str) -> Dict[str, Any]\n

Parse one message into a txn dict.

Parameters:

Name Type Description Default message str

Flattened message text.

required

Returns:

Type Description Dict[str, Any]

Dict[str, Any]: Txn dict with date/particulars/amount/balance/

Dict[str, Any]

direction keys.

"},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc.MessageReaderPort","title":"MessageReaderPort","text":"

Bases: ABC

content \u2192 list of flattened message texts.

"},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc.MessageReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/abc/#pipelines.extraction.email.abc.MessageReaderPort.extract","title":"extract abstractmethod","text":"
extract(content) -> List[str]\n

Flatten content into message texts.

Parameters:

Name Type Description Default content

Content (list, bytes, dict, or a single source).

required

Returns:

Type Description List[str]

List[str]: Flattened message texts.

"},{"location":"pipelines/extraction/email/impl/","title":"Impl","text":""},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl","title":"pipelines.extraction.email.impl","text":""},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl--summary","title":"Summary","text":"

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.

"},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl-classes","title":"Classes","text":""},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl.ImplEmailExtractionPipeline","title":"ImplEmailExtractionPipeline","text":"

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.

"},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl.ImplEmailExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl.ImplEmailExtractionPipeline.run","title":"run","text":"
run(source)\n

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.

"},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl.ImplMessageParserPort","title":"ImplMessageParserPort","text":"

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.

"},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl.ImplMessageParserPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl.ImplMessageParserPort.parse","title":"parse","text":"
parse(message: str)\n

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.

"},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl.ImplMessageReaderPort","title":"ImplMessageReaderPort","text":"

Bases: MessageReaderPort

Concrete message reader \u2014 HTML flattens each message to text.

"},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl.ImplMessageReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/impl/#pipelines.extraction.email.impl.ImplMessageReaderPort.extract","title":"extract","text":"
extract(content) -> List[str]\n

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.

"},{"location":"pipelines/extraction/email/banks/","title":"Banks","text":""},{"location":"pipelines/extraction/email/banks/#pipelines.extraction.email.banks","title":"pipelines.extraction.email.banks","text":""},{"location":"pipelines/extraction/email/banks/#pipelines.extraction.email.banks--summary","title":"Summary","text":"

email family \u2014 bank-specific ports and pipeline roots.

"},{"location":"pipelines/extraction/email/banks/axis/","title":"Axis","text":""},{"location":"pipelines/extraction/email/banks/axis/#pipelines.extraction.email.banks.axis","title":"pipelines.extraction.email.banks.axis","text":""},{"location":"pipelines/extraction/email/banks/axis/#pipelines.extraction.email.banks.axis--summary","title":"Summary","text":"

Axis bank-specific port implementations (email message path).

Faithful port of domain/extraction/banks/axis/email.py (AxisTransactionParserAdaptor.parse): INR amount, debited/credited direction, DD-MM-YYYY timestamped date, and a description sliced between Axis Bank Credit Card Transaction: and the trailing spam markers.

"},{"location":"pipelines/extraction/email/banks/axis/#pipelines.extraction.email.banks.axis-classes","title":"Classes","text":""},{"location":"pipelines/extraction/email/banks/axis/#pipelines.extraction.email.banks.axis.AxisEmailExtractionPipeline","title":"AxisEmailExtractionPipeline","text":"

Bases: ImplEmailExtractionPipeline

Axis email graph root \u2014 pins the Axis message parser.

Attributes:

Name Type Description message_parser AxisMessageParserPort

Axis message parser.

"},{"location":"pipelines/extraction/email/banks/axis/#pipelines.extraction.email.banks.axis.AxisEmailExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/banks/axis/#pipelines.extraction.email.banks.axis.AxisEmailExtractionPipeline.run","title":"run","text":"
run(source)\n

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.

"},{"location":"pipelines/extraction/email/banks/axis/#pipelines.extraction.email.banks.axis.AxisMessageParserPort","title":"AxisMessageParserPort","text":"

Bases: ImplMessageParserPort

Axis email parser \u2014 INR amount, debited/credited, timestamped date.

Attributes:

Name Type Description description_starts List[str]

Axis description start markers.

description_ends List[str]

Axis description end markers.

"},{"location":"pipelines/extraction/email/banks/axis/#pipelines.extraction.email.banks.axis.AxisMessageParserPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/banks/axis/#pipelines.extraction.email.banks.axis.AxisMessageParserPort.parse","title":"parse","text":"
parse(message: str)\n

Parse an Axis message into one txn dict.

Parameters:

Name Type Description Default message str

Flattened message text.

required

Returns:

Type Description

Txn dict with txn_date, particulars, amount, balance, direction.

Raises:

Type Description ValueError

When the amount or transaction date is not found.

"},{"location":"pipelines/extraction/email/banks/icici/","title":"Icici","text":""},{"location":"pipelines/extraction/email/banks/icici/#pipelines.extraction.email.banks.icici","title":"pipelines.extraction.email.banks.icici","text":""},{"location":"pipelines/extraction/email/banks/icici/#pipelines.extraction.email.banks.icici--summary","title":"Summary","text":"

Icici bank-specific port implementations (email message path).

Faithful port of domain/extraction/banks/icici/email.py (IciciTransactionParserAdaptor.parse): INR amount, credited/refund/ reversal direction, on <Mon DD, YYYY> at <HH:MM:SS> date formatting to DD-MM-YYYY, and a description sliced between Info: and the available credit-limit footer.

"},{"location":"pipelines/extraction/email/banks/icici/#pipelines.extraction.email.banks.icici-classes","title":"Classes","text":""},{"location":"pipelines/extraction/email/banks/icici/#pipelines.extraction.email.banks.icici.IciciEmailExtractionPipeline","title":"IciciEmailExtractionPipeline","text":"

Bases: ImplEmailExtractionPipeline

Icici email graph root \u2014 pins the Icici message parser.

Attributes:

Name Type Description message_parser IciciMessageParserPort

Icici message parser.

"},{"location":"pipelines/extraction/email/banks/icici/#pipelines.extraction.email.banks.icici.IciciEmailExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/banks/icici/#pipelines.extraction.email.banks.icici.IciciEmailExtractionPipeline.run","title":"run","text":"
run(source)\n

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.

"},{"location":"pipelines/extraction/email/banks/icici/#pipelines.extraction.email.banks.icici.IciciMessageParserPort","title":"IciciMessageParserPort","text":"

Bases: ImplMessageParserPort

Icici email parser \u2014 credited/refund/reversal direction, DD-MM-YYYY.

Attributes:

Name Type Description description_starts List[str]

Icici description start markers.

description_ends List[str]

Icici description end markers.

"},{"location":"pipelines/extraction/email/banks/icici/#pipelines.extraction.email.banks.icici.IciciMessageParserPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/email/banks/icici/#pipelines.extraction.email.banks.icici.IciciMessageParserPort.parse","title":"parse","text":"
parse(message: str)\n

Parse an Icici message into one txn dict.

Parameters:

Name Type Description Default message str

Flattened message text.

required

Returns:

Type Description

Txn dict with txn_date, particulars, amount, balance, direction.

Raises:

Type Description ValueError

When the amount or transaction date is not found.

"},{"location":"pipelines/extraction/llama/","title":"Llama","text":""},{"location":"pipelines/extraction/llama/#pipelines.extraction.llama","title":"pipelines.extraction.llama","text":""},{"location":"pipelines/extraction/llama/#pipelines.extraction.llama--summary","title":"Summary","text":"

Llama (structured-objects) extraction family.

"},{"location":"pipelines/extraction/llama/abc/","title":"Abc","text":""},{"location":"pipelines/extraction/llama/abc/#pipelines.extraction.llama.abc","title":"pipelines.extraction.llama.abc","text":""},{"location":"pipelines/extraction/llama/abc/#pipelines.extraction.llama.abc--summary","title":"Summary","text":"

Abstract contracts for the llama (structured-objects) extraction graph.

The llama family is \"tabular-like\" but the front stage differs: instead of reading table rows it starts from a LIST OF ALREADY-STRUCTURED OBJECTS (one per transaction \u2014 what LlamaCloud returns, or the cached fixture CSV standing in for it). The downstream stages reuse the shared core:

Bank-specific wiring lives under banks/.

"},{"location":"pipelines/extraction/llama/abc/#pipelines.extraction.llama.abc-classes","title":"Classes","text":""},{"location":"pipelines/extraction/llama/abc/#pipelines.extraction.llama.abc.LlamaExtractionPipeline","title":"LlamaExtractionPipeline","text":"

Bases: ABC

Root \u2014 objects chain: ingest \u2192 objects_reader \u2192 txn_dicts \u2192 raw_expense.

Slot annotations

source: ExtractionSource ingest: IngestPort objects_reader: LlamaObjectsReaderPort txn_dicts: ObjectsTxnDictsPort raw_expense: RawExpensePort

Attributes:

Name Type Description source ExtractionSource

The extraction source descriptor.

pipeline str

Pipeline tag (\"llama\").

ingest IngestPort

Ingest stage.

objects_reader LlamaObjectsReaderPort

Objects-reading stage.

txn_dicts ObjectsTxnDictsPort

Objects-to-txn-dicts stage.

raw_expense RawExpensePort

Terminal raw-expense stage.

"},{"location":"pipelines/extraction/llama/abc/#pipelines.extraction.llama.abc.LlamaExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/llama/abc/#pipelines.extraction.llama.abc.LlamaExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the llama objects extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/llama/abc/#pipelines.extraction.llama.abc.LlamaObjectsReaderPort","title":"LlamaObjectsReaderPort","text":"

Bases: ABC

list of structured objects \u2192 list of filtered records (in order).

"},{"location":"pipelines/extraction/llama/abc/#pipelines.extraction.llama.abc.LlamaObjectsReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/llama/abc/#pipelines.extraction.llama.abc.LlamaObjectsReaderPort.read","title":"read abstractmethod","text":"
read(objects) -> List[Dict[str, Any]]\n

Read structured objects, dropping marker and header rows.

Parameters:

Name Type Description Default objects

List of structured statement objects.

required

Returns:

Type Description List[Dict[str, Any]]

List[Dict[str, Any]]: Filtered records in order.

"},{"location":"pipelines/extraction/llama/impl/","title":"Impl","text":""},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl","title":"pipelines.extraction.llama.impl","text":""},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl--summary","title":"Summary","text":"

Concrete llama-family implementations.

ImplLlamaObjectsReaderPort receives the list of already-structured statement objects (the equivalent of the LlamaCloud extract result) and applies the row-level bucket filter \u2014 B/F marker rows and any rows before the first marker are dropped, mirroring OG domain.extraction.adaptors.txn_blocks.BucketFinderAdaptor.filter_txn_rows. The downstream chain (objects \u2192 txn dicts \u2192 raw expenses) is the shared core: ImplTxnDictsObjectsPort (stated balances trusted) + ImplRawExpensePort.

"},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl-classes","title":"Classes","text":""},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl.ImplLlamaExtractionPipeline","title":"ImplLlamaExtractionPipeline","text":"

Bases: LlamaExtractionPipeline

Concrete llama graph root.

Attributes:

Name Type Description ingest ImplIngestPort

Ingest stage.

objects_reader ImplLlamaObjectsReaderPort

Objects-reading stage.

txn_dicts ImplObjectsTxnDictsPort

Objects-to-txn-dicts stage.

raw_expense ImplRawExpensePort

Terminal raw-expense stage.

"},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl.ImplLlamaExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl.ImplLlamaExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the llama objects extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl.ImplLlamaObjectsReaderPort","title":"ImplLlamaObjectsReaderPort","text":"

Bases: LlamaObjectsReaderPort

Drop B/F marker rows + pre-marker header rows from a statement list.

Mirrors the OG bucket finder contract exactly: markers are B/F / BIF / B|F matched against each object's description (upper-cased). With limit_first only the first (primary) bucket is kept (default False, like the OG lama service; the icici bank module overrides it to True to match the icici OG CONFIG). Statements without a marker row pass through.

Attributes:

Name Type Description bf_markers tuple

Marker tokens identifying bucket boundaries.

limit_first bool

Keep only the first bucket.

"},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl.ImplLlamaObjectsReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl.ImplLlamaObjectsReaderPort.filter_objects","title":"filter_objects","text":"
filter_objects(\n    objects: List[Any], *, limit_first: bool = False\n) -> List[dict]\n

Filter objects to rows between balance-forward marker rows.

Parameters:

Name Type Description Default objects List[Any]

Structured statement objects.

required limit_first bool

Keep only the first bucket. Defaults to False.

False

Returns:

Type Description List[dict]

List[dict]: Records between (and after) marker rows.

"},{"location":"pipelines/extraction/llama/impl/#pipelines.extraction.llama.impl.ImplLlamaObjectsReaderPort.read","title":"read","text":"
read(objects) -> List[dict]\n

Read structured objects, applying the row-level bucket filter.

Parameters:

Name Type Description Default objects

List of structured statement objects.

required

Returns:

Type Description List[dict]

List[dict]: Filtered records in order.

"},{"location":"pipelines/extraction/llama/banks/","title":"Banks","text":""},{"location":"pipelines/extraction/llama/banks/#pipelines.extraction.llama.banks","title":"pipelines.extraction.llama.banks","text":""},{"location":"pipelines/extraction/llama/banks/#pipelines.extraction.llama.banks--summary","title":"Summary","text":"

Llama-family bank-specific wiring.

"},{"location":"pipelines/extraction/llama/banks/icici/","title":"Icici","text":""},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici","title":"pipelines.extraction.llama.banks.icici","text":""},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici--summary","title":"Summary","text":"

Icici bank-specific port implementations (llama objects path).

The llama objects are already normalized per-transaction (date / amount / balance / description / direction), so there is no bank-specific column logic. IciciLlamaObjectsReaderPort mirrors the icici OG bank CONFIG {\"limit_first\": True} (keeps only the primary account bucket), matching the 223-txn llama run stored in the DB. IciciLlamaExtractionPipeline pins the reader; the shared objects policy (stated balances trusted) is identical across banks.

"},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici-classes","title":"Classes","text":""},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici.IciciLlamaExtractionPipeline","title":"IciciLlamaExtractionPipeline","text":"

Bases: ImplLlamaExtractionPipeline

Icici llama graph root \u2014 pins the Icici objects reader.

Attributes:

Name Type Description objects_reader IciciLlamaObjectsReaderPort

Icici objects reader.

"},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici.IciciLlamaExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici.IciciLlamaExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the llama objects extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici.IciciLlamaObjectsReaderPort","title":"IciciLlamaObjectsReaderPort","text":"

Bases: ImplLlamaObjectsReaderPort

Icici llama objects reader \u2014 primary bucket only (OG icici CONFIG).

Attributes:

Name Type Description limit_first bool

Whether to keep only the primary bucket.

"},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici.IciciLlamaObjectsReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici.IciciLlamaObjectsReaderPort.filter_objects","title":"filter_objects","text":"
filter_objects(\n    objects: List[Any], *, limit_first: bool = False\n) -> List[dict]\n

Filter objects to rows between balance-forward marker rows.

Parameters:

Name Type Description Default objects List[Any]

Structured statement objects.

required limit_first bool

Keep only the first bucket. Defaults to False.

False

Returns:

Type Description List[dict]

List[dict]: Records between (and after) marker rows.

"},{"location":"pipelines/extraction/llama/banks/icici/#pipelines.extraction.llama.banks.icici.IciciLlamaObjectsReaderPort.read","title":"read","text":"
read(objects) -> List[dict]\n

Read structured objects, applying the row-level bucket filter.

Parameters:

Name Type Description Default objects

List of structured statement objects.

required

Returns:

Type Description List[dict]

List[dict]: Filtered records in order.

"},{"location":"pipelines/extraction/pdf/","title":"Pdf","text":""},{"location":"pipelines/extraction/pdf/#pipelines.extraction.pdf","title":"pipelines.extraction.pdf","text":""},{"location":"pipelines/extraction/pdf/#pipelines.extraction.pdf--summary","title":"Summary","text":"

pdf (OCR text) extraction family.

"},{"location":"pipelines/extraction/pdf/abc/","title":"Abc","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc","title":"pipelines.extraction.pdf.abc","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc--summary","title":"Summary","text":"

Abstract contracts for the pdf (OCR text) extraction graph (no implementation).

The pdf family is the classic heuristic text chain:

ingest \u2192 raw_lines \u2192 txn_blocks \u2192 txn_dicts \u2192 raw_expense\n

Non-PDF families (email / csv / xlsx) do NOT extend this root \u2014 they have their own stage chains (see email/abc.py and shared/tabular.py).

The annotations on each class declare WHAT it needs. Concrete implementations (re)declare the same port slots with CONCRETE types to inform which implementation is used, and implement the @abstractmethod bodies.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc-classes","title":"Classes","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.BucketFinderPort","title":"BucketFinderPort","text":"

Bases: ABC

Divide raw_lines into account buckets at B/F markers.

Attributes:

Name Type Description number NumberPort

Number extraction leaf.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.BucketFinderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.BucketFinderPort.get_opening_balance_buckets","title":"get_opening_balance_buckets abstractmethod","text":"
get_opening_balance_buckets(\n    lines: List[str],\n    *,\n    limit_first: bool = False,\n    line_offset: int = 0\n) -> List[tuple]\n

Divide raw lines into account buckets at B/F markers.

Parameters:

Name Type Description Default lines List[str]

Raw text lines.

required limit_first bool

Keep only the first bucket. Defaults to False.

False line_offset int

Offset added to starting indices. Defaults to 0.

0

Returns:

Type Description List[tuple]

List[tuple]: (start, end, opening_balance) bucket triples.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.PDFExtractionPipeline","title":"PDFExtractionPipeline","text":"

Bases: ABC

Root \u2014 wires ingest \u2192 raw_lines \u2192 txn_blocks \u2192 txn_dicts \u2192 raw_expenses.

Attributes:

Name Type Description source ExtractionSource

The extraction source descriptor.

pipeline str

Pipeline tag; defaults to \"heuristic\".

trust_fallback

Fallback policy for amount/balance trust.

ingest IngestPort

Ingest stage.

raw_lines RawLinesPort

Raw-lines stage.

txn_blocks TxnBlocksPort

Txn-blocks stage.

txn_dicts TxnDictsPort

Txn-dicts stage.

raw_expense RawExpensePort

Terminal raw-expense stage.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.PDFExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.PDFExtractionPipeline.run","title":"run abstractmethod","text":"
run(source) -> List[Any]\n

Run the pdf extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.RawLinesPort","title":"RawLinesPort","text":"

Bases: ABC

content \u2192 list of raw text lines.

Attributes:

Name Type Description covert_to_image bool

Whether to binarize pages via image conversion.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.RawLinesPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.RawLinesPort.extract","title":"extract abstractmethod","text":"
extract(content) -> List[str]\n

Extract raw OCR text lines from content.

Parameters:

Name Type Description Default content

Materialized content payload.

required

Returns:

Type Description List[str]

List[str]: Raw text lines.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.SplitterPort","title":"SplitterPort","text":"

Bases: ABC

Split bucket line-groups into transaction blocks.

Attributes:

Name Type Description number NumberPort

Number extraction leaf.

date DatePort

Date parsing leaf.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.SplitterPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.SplitterPort.split_blocks","title":"split_blocks abstractmethod","text":"
split_blocks(\n    lines: List[str],\n    *,\n    has_header: bool = False,\n    min_numbers: int = 3,\n    detect_date_ranges: bool = False\n) -> List[str]\n

Split bucket line-groups into transaction blocks.

Parameters:

Name Type Description Default lines List[str]

Lines belonging to one account bucket.

required has_header bool

Whether a header precedes the rows.

False min_numbers int

Minimum numbers for a split.

3 detect_date_ranges bool

Detect date-range lines.

False

Returns:

Type Description List[str]

List[str]: Transaction block texts.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.TransactionParserPort","title":"TransactionParserPort","text":"

Bases: ABC

Parse one transaction block into a structured dict.

Attributes:

Name Type Description min_numbers int

Minimum numbers for a block.

amount_index int

Index of the amount in the number list.

balance_index int

Index of the balance in the number list.

number NumberPort

Number extraction leaf.

date DatePort

Date parsing leaf.

desc DescPort

Description extraction leaf.

amount_balance AmountBalancePort

Amount/balance resolution leaf.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.TransactionParserPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.TransactionParserPort.parse","title":"parse abstractmethod","text":"
parse(\n    txn_text: str, prev_date_str, prev_balance: float\n) -> Dict[str, Any]\n

Parse one transaction block into a structured dict.

Parameters:

Name Type Description Default txn_text str

Transaction block text.

required prev_date_str

Previous transaction date string.

required prev_balance float

Running balance from the previous transaction.

required

Returns:

Type Description Dict[str, Any]

Dict[str, Any]: Parsed transaction dict.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.TxnBlocksPort","title":"TxnBlocksPort","text":"

Bases: ABC

raw_lines \u2192 txn_blocks (opening_balance \u2192 list[block strings]).

Attributes:

Name Type Description has_header bool

Whether a header precedes the rows.

min_numbers int

Minimum numbers for block splitting.

detect_date_ranges bool

Detect date-range lines.

limit_first bool

Keep only the first bucket.

line_offset int

Offset added to starting indices.

bucket_finder BucketFinderPort

Bucket-finding stage.

splitter SplitterPort

Block-splitting stage.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.TxnBlocksPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.TxnBlocksPort.extract","title":"extract abstractmethod","text":"
extract(raw_lines: List[str]) -> Dict[float, List[str]]\n

Extract txn blocks keyed by opening balance.

Parameters:

Name Type Description Default raw_lines List[str]

Raw OCR text lines.

required

Returns:

Type Description Dict[float, List[str]]

Dict[float, List[str]]: Opening balance \u2192 block texts.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.TxnDictsPort","title":"TxnDictsPort","text":"

Bases: ABC

txn_blocks \u2192 list of structured txn dicts.

Attributes:

Name Type Description min_numbers int

Minimum numbers for a block.

amount_index int

Index of the amount in the number list.

balance_index int

Index of the balance in the number list.

parser TransactionParserPort

Transaction parsing stage.

"},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.TxnDictsPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/abc/#pipelines.extraction.pdf.abc.TxnDictsPort.extract","title":"extract abstractmethod","text":"
extract(txn_blocks: Dict[float, List[str]]) -> Any\n

Extract structured txn dicts from txn blocks.

Parameters:

Name Type Description Default txn_blocks Dict[float, List[str]]

Opening balance \u2192 block texts.

required

Returns:

Name Type Description Any Any

List of txn dicts.

"},{"location":"pipelines/extraction/pdf/impl/","title":"Impl","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl","title":"pipelines.extraction.pdf.impl","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl--summary","title":"Summary","text":"

Concrete pdf-family implementations.

The pdf family is the OCR text chain; each concrete class REDECLARES its port slots with CONCRETE types \u2014 this pinned typing is what informs the ports to be used, exactly as in the old pipelines/extraction_pipeline_impl.py.

This models the real domain/extraction pdf path as a hexa composition tree:

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl-classes","title":"Classes","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplAmbiguityPort","title":"ImplAmbiguityPort","text":"
ImplAmbiguityPort(\n    fetch_request_id: str = \"\",\n    pause_on_ambiguity: bool = True,\n    resolved_choices: Optional[dict] = None,\n    resolver: Optional[Callable] = None,\n)\n

Bases: AmbiguityPort, AmbiguityHandler

Concrete ambiguity leaf \u2014 delegates to AmbiguityHandler.

Initialize the ambiguity handler.

Parameters:

Name Type Description Default fetch_request_id str

Identifier correlating this resolution to a fetch request. Defaults to \"\".

'' pause_on_ambiguity bool

Whether to raise PauseForResolution when unresolved. Defaults to True.

True resolved_choices Optional[dict]

Prior choices keyed by candidate key. Defaults to None (becomes an empty dict).

None resolver Optional[Callable]

Optional resolver hook. Defaults to None.

None"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplAmbiguityPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplAmbiguityPort.resolve_ambiguity","title":"resolve_ambiguity","text":"
resolve_ambiguity(\n    line,\n    ocr_amount,\n    ocr_balance,\n    prev_balance,\n    candidates=None,\n)\n

Resolve ambiguity via AmbiguityHandler.resolve_ambiguity.

Parameters:

Name Type Description Default line

Raw transaction line.

required ocr_amount

OCR amount.

required ocr_balance

OCR balance.

required prev_balance

Previous transaction balance.

required candidates

Candidate (amount, balance) pairs; default set().

None

Returns:

Type Description

Set with the chosen pair, or None.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplAmountBalancePort","title":"ImplAmountBalancePort","text":"

Bases: AmountBalancePort

Concrete amount/balance leaf \u2014 resolves via ResolutionContext.

Attributes:

Name Type Description number ImplNumberPort

Number extraction leaf.

ambiguity ImplAmbiguityPort

Ambiguity resolution leaf.

handler Optional[AmbiguityHandler]

Optional override handler.

trust_fallback Optional[str]

Fallback policy.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplAmountBalancePort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplAmountBalancePort.adjust_balance","title":"adjust_balance","text":"
adjust_balance(balance: float, line: str) -> float\n

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.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplAmountBalancePort.missing_number_candidates","title":"missing_number_candidates","text":"
missing_number_candidates(ctx)\n

Provide candidates for one-number lines (no-op base).

Parameters:

Name Type Description Default ctx

The active ResolutionContext.

required

Returns:

Type Description

None.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplAmountBalancePort.resolve","title":"resolve","text":"
resolve(amount, balance, prev_balance, line, numbers=None)\n

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.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplBucketFinderPort","title":"ImplBucketFinderPort","text":"

Bases: BucketFinderPort

Concrete bucket finder \u2014 splits raw lines at B/F and opening markers.

Attributes:

Name Type Description number ImplNumberPort

Number extraction leaf.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplBucketFinderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplBucketFinderPort.get_opening_balance_buckets","title":"get_opening_balance_buckets","text":"
get_opening_balance_buckets(\n    lines, *, limit_first=False, line_offset=0\n)\n

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 (start, end, opening_balance) triples.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDatePort","title":"ImplDatePort","text":"

Bases: DatePort

Concrete date leaf: parse, split, reconcile, and reorder dates.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDatePort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDatePort.get_dates","title":"get_dates","text":"
get_dates(line: str) -> Optional[Tuple[str, str]]\n

Extract the leading date and text tail from a line.

Parameters:

Name Type Description Default line str

Text line.

required

Returns:

Type Description Optional[Tuple[str, str]]

Optional[Tuple[str, str]]: (date_str, date_tail) or None.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDatePort.parse_date","title":"parse_date","text":"
parse_date(date_str: str) -> datetime.date\n

Parse DD-MM-YYYY (or DD/MM/YYYY) into a date.

Parameters:

Name Type Description Default date_str str

Date string.

required

Returns:

Type Description date

datetime.date: The parsed date.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDatePort.reconcile_date","title":"reconcile_date","text":"
reconcile_date(\n    date_str: str, prev_date_str: Optional[str]\n) -> str\n

Reconcile an OCR date against the previous transaction date.

Parameters:

Name Type Description Default date_str str

OCR date string.

required prev_date_str Optional[str]

Previous transaction date string.

required

Returns:

Name Type Description str str

Reconciliated date as DD-MM-YYYY.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDatePort.reconcile_date_full","title":"reconcile_date_full","text":"
reconcile_date_full(\n    date_str: str, prev: datetime.date\n) -> Optional[str]\n

Reconcile a date string against a full reference date.

Parameters:

Name Type Description Default date_str str

OCR date string.

required prev date

Previous transaction date.

required

Returns:

Type Description Optional[str]

Optional[str]: Reconciliated DD-MM-YYYY string or None.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDatePort.reconcile_date_partial","title":"reconcile_date_partial","text":"
reconcile_date_partial(\n    date_str: str, prev: datetime.date\n) -> Optional[str]\n

Reconcile a partial MM-YYYY date against a reference date.

Parameters:

Name Type Description Default date_str str

Partial OCR date string.

required prev date

Previous transaction date.

required

Returns:

Type Description Optional[str]

Optional[str]: Reconciliated DD-MM-YYYY string or None.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDatePort.reorder_lines_by_date","title":"reorder_lines_by_date","text":"
reorder_lines_by_date(txn_lines: List[str]) -> List[str]\n

Move the dated line to the front of a transaction block.

Parameters:

Name Type Description Default txn_lines List[str]

Transaction block lines.

required

Returns:

Type Description List[str]

List[str]: Reordered lines.

Raises:

Type Description ValueError

When no dated line is present in the block.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDatePort.split_line_by_date","title":"split_line_by_date","text":"
split_line_by_date(line: str) -> List[str]\n

Split a merged line into segments at date boundaries.

Parameters:

Name Type Description Default line str

Possibly merged OCR line.

required

Returns:

Type Description List[str]

List[str]: Line segments split at date boundaries.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDescPort","title":"ImplDescPort","text":"

Bases: DescPort

Concrete description leaf \u2014 slices at the first starter marker.

Attributes:

Name Type Description starters Optional[List[str]]

Description starter markers.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDescPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDescPort.extract_description","title":"extract_description","text":"
extract_description(description: str) -> str\n

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.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplDescPort.fix_ocr","title":"fix_ocr","text":"
fix_ocr(text: str) -> str\n

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.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplNumberPort","title":"ImplNumberPort","text":"

Bases: NumberPort

Concrete number leaf \u2014 prefers trailing decimals, else the last numbers.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplNumberPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplNumberPort.get_numbers","title":"get_numbers","text":"
get_numbers(line: str) -> List[float]\n

Extract monetary numbers, preferring trailing decimals.

Parameters:

Name Type Description Default line str

Text line to scan.

required

Returns:

Type Description List[float]

List[float]: Cleaned monetary numbers.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplNumberPort.get_opening_balance","title":"get_opening_balance","text":"
get_opening_balance(line: str) -> Optional[float]\n

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 None.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplPDFExtractionPipeline","title":"ImplPDFExtractionPipeline","text":"

Bases: PDFExtractionPipeline

Concrete pdf graph root.

Attributes:

Name Type Description pipeline str

Pipeline tag (\"heuristic\").

trust_fallback

Fallback policy for amount/balance trust.

ingest ImplIngestPort

Ingest stage.

raw_lines ImplRawLinesPort

Raw-lines stage.

txn_blocks ImplTxnBlocksPort

Txn-blocks stage.

txn_dicts ImplTxnDictsPort

Txn-dicts stage.

raw_expense ImplRawExpensePort

Terminal raw-expense stage.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplPDFExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplPDFExtractionPipeline.run","title":"run","text":"
run(source)\n

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.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplRawLinesPort","title":"ImplRawLinesPort","text":"

Bases: RawLinesPort

Concrete raw-lines leaf \u2014 OCRs PDF bytes into text lines.

Attributes:

Name Type Description covert_to_image bool

Binarize pages via image conversion.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplRawLinesPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplRawLinesPort.extract","title":"extract","text":"
extract(content)\n

Extract raw OCR text lines from content.

Parameters:

Name Type Description Default content

PDF bytes, Content, or dict payload.

required

Returns:

Type Description

List of raw text lines.

Raises:

Type Description TypeError

When content is not PDF bytes or Content with .raw.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplSplitterPort","title":"ImplSplitterPort","text":"

Bases: SplitterPort

Concrete splitter \u2014 splits bucket lines into transaction blocks.

Attributes:

Name Type Description number ImplNumberPort

Number extraction leaf.

date ImplDatePort

Date parsing leaf.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplSplitterPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplSplitterPort.split_blocks","title":"split_blocks","text":"
split_blocks(\n    lines,\n    *,\n    has_header=False,\n    min_numbers=3,\n    detect_date_ranges=False\n)\n

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.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplTransactionParserPort","title":"ImplTransactionParserPort","text":"

Bases: TransactionParserPort

Concrete transaction parser \u2014 one block to one txn dict.

Attributes:

Name Type Description number ImplNumberPort

Number extraction leaf.

date ImplDatePort

Date parsing leaf.

desc ImplDescPort

Description extraction leaf.

amount_balance ImplAmountBalancePort

Amount/balance resolution leaf.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplTransactionParserPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplTransactionParserPort.parse","title":"parse","text":"
parse(txn_text, prev_date_str, prev_balance)\n

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 None when the block has no usable date/numbers.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplTxnBlocksPort","title":"ImplTxnBlocksPort","text":"

Bases: TxnBlocksPort

Concrete txn-blocks stage \u2014 buckets plus per-bucket splitting.

Attributes:

Name Type Description bucket_finder ImplBucketFinderPort

Bucket-finding leaf.

splitter ImplSplitterPort

Block-splitting leaf.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplTxnBlocksPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplTxnBlocksPort.extract","title":"extract","text":"
extract(raw_lines)\n

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 \u2192 block texts.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplTxnDictsPort","title":"ImplTxnDictsPort","text":"

Bases: TxnDictsPort

Concrete txn-dicts stage \u2014 parses blocks in balance-chained order.

Attributes:

Name Type Description parser ImplTransactionParserPort

Transaction parsing leaf.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplTxnDictsPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ImplTxnDictsPort.extract","title":"extract","text":"
extract(txn_blocks)\n

Extract balance-chained txn dicts from blocks.

Parameters:

Name Type Description Default txn_blocks

Opening balance \u2192 block texts.

required

Returns:

Type Description

List of txn dicts.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.clean_num","title":"clean_num","text":"
clean_num(s: str) -> float\n

Port of domain.extraction.ports.pdf.clean_num.

Parameters:

Name Type Description Default s str

Numeric string to clean.

required

Returns:

Name Type Description float float

Parsed numeric value; 0.0 when the string has no digits.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.normalize","title":"normalize","text":"
normalize(text: str) -> str\n

Normalize OCR text: fix artifacts, strip separators, drop commas.

Parameters:

Name Type Description Default text str

Raw OCR text.

required

Returns:

Name Type Description str str

Normalized text.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.ocr_all_pages","title":"ocr_all_pages","text":"
ocr_all_pages(\n    pdf_bytes: bytes, covert_to_image: bool = None\n) -> list\n

Run OCR over every PDF page, returning per-page text.

Parameters:

Name Type Description Default pdf_bytes bytes

PDF file bytes.

required covert_to_image bool

Binarize pages through image conversion.

None

Returns:

Name Type Description list list

One OCR text string per page.

Raises:

Type Description ImportError

When pytesseract/Pillow are unavailable.

"},{"location":"pipelines/extraction/pdf/impl/#pipelines.extraction.pdf.impl.rasterize_pdf","title":"rasterize_pdf","text":"
rasterize_pdf(\n    pdf_bytes: bytes, out_dir: str, dpi: int = 300\n) -> list\n

Rasterize PDF bytes into JPEG page images via pdftoppm.

Parameters:

Name Type Description Default pdf_bytes bytes

PDF file bytes.

required out_dir str

Directory to write the PDF and page images.

required dpi int

Render resolution. Defaults to 300.

300

Returns:

Name Type Description list list

Sorted list of generated JPEG page paths.

"},{"location":"pipelines/extraction/pdf/llm/","title":"Llm","text":""},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm","title":"pipelines.extraction.pdf.llm","text":""},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm--summary","title":"Summary","text":"

LLM splitter variant of the pdf family (impl-layer, bank-agnostic).

LLMSplitterPort is a faithful port of TransactionSplitterLLMAdaptor (domain/extraction/adaptors/txn_blocks.py) using SyncOpenRouterPool. It swaps into the pdf chain exactly where ImplSplitterPort sits, so the rest of the tree (raw_lines \u2192 txn_blocks \u2192 txn_dicts \u2192 raw_expense) is unchanged.

LLMPdfExtractionPipeline re-pins only the txn_blocks.splitter slot.

"},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm-classes","title":"Classes","text":""},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMPdfExtractionPipeline","title":"LLMPdfExtractionPipeline","text":"

Bases: ImplPDFExtractionPipeline

PDF root with the LLM splitter swapped into the txn-blocks stage.

Attributes:

Name Type Description txn_blocks LLMTxnBlocksPort

Txn-blocks stage with LLM splitter.

"},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMPdfExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMPdfExtractionPipeline.run","title":"run","text":"
run(source)\n

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.

"},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMSplitterPort","title":"LLMSplitterPort","text":"
LLMSplitterPort(pool=None, **kwargs)\n

Bases: SplitterPort

LLM-backed splitter that groups lines into transactions via prompts.

Attributes:

Name Type Description DATE_RE Pattern[str]

Compiled regex matching leading DD-MM-YYYY dates.

number ImplNumberPort

Number extraction leaf.

date ImplDatePort

Date parsing leaf.

GROUP_PROMPT str

Prompt grouping indices into transactions.

RESOLVE_PROMPT str

Prompt resolving cross-batch conflicts.

MAX_CONFLICT_LOOPS int

Max conflict resolution loops.

BATCH_MERGE int

Date lines per batch.

Initialize the splitter with an LLM pool.

Parameters:

Name Type Description Default pool

LLM pool; defaults to a new SyncOpenRouterPool.

None **kwargs

Passed through to the base class.

{}"},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMSplitterPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMSplitterPort.clean_raw_lines","title":"clean_raw_lines staticmethod","text":"
clean_raw_lines(raw_lines: List[str]) -> List[str]\n

Clean raw lines: strip trailing noise and drop Page lines.

Parameters:

Name Type Description Default raw_lines List[str]

Raw OCR lines.

required

Returns:

Type Description List[str]

List[str]: Cleaned lines.

"},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMSplitterPort.split_blocks","title":"split_blocks","text":"
split_blocks(\n    lines,\n    *,\n    has_header=False,\n    min_numbers=3,\n    detect_date_ranges=False\n)\n

Group lines into transaction blocks via the LLM.

Parameters:

Name Type Description Default lines

Raw OCR lines.

required has_header

Whether a header precedes the rows.

False min_numbers

Minimum numbers for a block.

3 detect_date_ranges

Detect date-range lines.

False

Returns:

Type Description

List of transaction block texts.

"},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMSplitterPort.strip_headers","title":"strip_headers staticmethod","text":"
strip_headers(raw_lines: List[str]) -> List[str]\n

Drop header lines preceding the first date line.

Parameters:

Name Type Description Default raw_lines List[str]

Raw OCR lines.

required

Returns:

Type Description List[str]

List[str]: Lines with headers removed.

"},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMTxnBlocksPort","title":"LLMTxnBlocksPort","text":"

Bases: ImplTxnBlocksPort

Txn-blocks stage re-pinning the splitter to the LLM variant.

Attributes:

Name Type Description splitter LLMSplitterPort

LLM-backed splitter.

"},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMTxnBlocksPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/llm/#pipelines.extraction.pdf.llm.LLMTxnBlocksPort.extract","title":"extract","text":"
extract(raw_lines)\n

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 \u2192 block texts.

"},{"location":"pipelines/extraction/pdf/banks/","title":"Banks","text":""},{"location":"pipelines/extraction/pdf/banks/#pipelines.extraction.pdf.banks","title":"pipelines.extraction.pdf.banks","text":""},{"location":"pipelines/extraction/pdf/banks/#pipelines.extraction.pdf.banks--summary","title":"Summary","text":"

pdf family \u2014 bank-specific ports and pipeline roots.

"},{"location":"pipelines/extraction/pdf/banks/axis/","title":"Axis","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis","title":"pipelines.extraction.pdf.banks.axis","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis--summary","title":"Summary","text":"

Axis bank-specific port implementations (pdf statement path).

Banks EXTEND the concrete Impl* classes \u2014 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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis-classes","title":"Classes","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisAmountBalancePort","title":"AxisAmountBalancePort","text":"

Bases: ImplAmountBalancePort

Axis amount/balance leaf \u2014 pins the Axis number leaf.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisAmountBalancePort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisAmountBalancePort.adjust_balance","title":"adjust_balance","text":"
adjust_balance(balance: float, line: str) -> float\n

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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisAmountBalancePort.missing_number_candidates","title":"missing_number_candidates","text":"
missing_number_candidates(ctx)\n

Provide candidates for one-number lines (no-op base).

Parameters:

Name Type Description Default ctx

The active ResolutionContext.

required

Returns:

Type Description

None.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisAmountBalancePort.resolve","title":"resolve","text":"
resolve(amount, balance, prev_balance, line, numbers=None)\n

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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisBucketFinderPort","title":"AxisBucketFinderPort","text":"

Bases: ImplBucketFinderPort

Axis bucket finder \u2014 pins the Axis number leaf.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisBucketFinderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisBucketFinderPort.get_opening_balance_buckets","title":"get_opening_balance_buckets","text":"
get_opening_balance_buckets(\n    lines, *, limit_first=False, line_offset=0\n)\n

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 (start, end, opening_balance) triples.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisDescPort","title":"AxisDescPort","text":"

Bases: ImplDescPort

Axis description leaf \u2014 slices at UPI/IMPS/NEFT/ACH/2A markers.

Attributes:

Name Type Description starters List[str]

Description starter markers.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisDescPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisDescPort.extract_description","title":"extract_description","text":"
extract_description(description: str) -> str\n

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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisDescPort.fix_ocr","title":"fix_ocr","text":"
fix_ocr(text: str) -> str\n

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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisNumberPort","title":"AxisNumberPort","text":"

Bases: ImplNumberPort

Axis number leaf \u2014 returns every number in the line.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisNumberPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisNumberPort.get_numbers","title":"get_numbers","text":"
get_numbers(line: str) -> List[float]\n

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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisNumberPort.get_opening_balance","title":"get_opening_balance","text":"
get_opening_balance(line: str) -> Optional[float]\n

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 None.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisPdfExtractionPipeline","title":"AxisPdfExtractionPipeline","text":"

Bases: ImplPDFExtractionPipeline

Axis pdf graph root \u2014 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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisPdfExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisPdfExtractionPipeline.run","title":"run","text":"
run(source)\n

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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisSplitterPort","title":"AxisSplitterPort","text":"

Bases: ImplSplitterPort

Axis splitter \u2014 pins the Axis number leaf.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisSplitterPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisSplitterPort.split_blocks","title":"split_blocks","text":"
split_blocks(\n    lines,\n    *,\n    has_header=False,\n    min_numbers=3,\n    detect_date_ranges=False\n)\n

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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisTransactionParserPort","title":"AxisTransactionParserPort","text":"

Bases: ImplTransactionParserPort

Axis transaction parser \u2014 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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisTransactionParserPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisTransactionParserPort.parse","title":"parse","text":"
parse(txn_text, prev_date_str, prev_balance)\n

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 None when the block has no usable date/numbers.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisTxnBlocksPort","title":"AxisTxnBlocksPort","text":"

Bases: ImplTxnBlocksPort

Axis txn-blocks stage \u2014 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.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisTxnBlocksPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisTxnBlocksPort.extract","title":"extract","text":"
extract(raw_lines)\n

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 \u2192 block texts.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisTxnDictsPort","title":"AxisTxnDictsPort","text":"

Bases: ImplTxnDictsPort

Axis txn-dicts stage \u2014 pins the Axis transaction parser.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisTxnDictsPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis.AxisTxnDictsPort.extract","title":"extract","text":"
extract(txn_blocks)\n

Extract balance-chained txn dicts from blocks.

Parameters:

Name Type Description Default txn_blocks

Opening balance \u2192 block texts.

required

Returns:

Type Description

List of txn dicts.

"},{"location":"pipelines/extraction/pdf/banks/axis/#pipelines.extraction.pdf.banks.axis-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/","title":"Icici","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici","title":"pipelines.extraction.pdf.banks.icici","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici--summary","title":"Summary","text":"

Icici bank-specific port implementations (pdf statement path).

Banks EXTEND the concrete Impl* classes \u2014 they never reinvent the ABC contracts. Each Icici* class overrides only the behavior that DIFFERS from the common Impl*; anything shared is inherited.

Derived from the real domain/extraction/banks/icici/pdf.py:

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici-classes","title":"Classes","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciAmountBalancePort","title":"IciciAmountBalancePort","text":"

Bases: ImplAmountBalancePort

Icici amount/balance leaf \u2014 negates bracketed OCR balances.

Attributes:

Name Type Description number IciciNumberPort

Icici number leaf.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciAmountBalancePort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciAmountBalancePort.adjust_balance","title":"adjust_balance","text":"
adjust_balance(balance: float, line: str) -> float\n

Negate a balance flagged as negative by OCR brackets.

Parameters:

Name Type Description Default balance float

OCR balance.

required line str

Transaction line.

required

Returns:

Name Type Description float float

Negated balance when a bracket marker is present, else the

float

balance unchanged.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciAmountBalancePort.missing_number_candidates","title":"missing_number_candidates","text":"
missing_number_candidates(ctx)\n

Provide one-number candidates: the number as amount or as balance.

Parameters:

Name Type Description Default ctx

The active ResolutionContext.

required

Returns:

Type Description

Set of (amount, balance) candidate pairs.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciAmountBalancePort.resolve","title":"resolve","text":"
resolve(amount, balance, prev_balance, line, numbers=None)\n

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.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciBucketFinderPort","title":"IciciBucketFinderPort","text":"

Bases: ImplBucketFinderPort

Icici bucket finder \u2014 pins the Icici number leaf.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciBucketFinderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciBucketFinderPort.get_opening_balance_buckets","title":"get_opening_balance_buckets","text":"
get_opening_balance_buckets(\n    lines, *, limit_first=False, line_offset=0\n)\n

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 (start, end, opening_balance) triples.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciDescPort","title":"IciciDescPort","text":"

Bases: ImplDescPort

Icici description leaf \u2014 slices at Icici markers and fixes OCR typos.

Attributes:

Name Type Description starters Optional[List[str]]

Description starter markers.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciDescPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciDescPort.extract_description","title":"extract_description","text":"
extract_description(description: str) -> str\n

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.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciDescPort.fix_ocr","title":"fix_ocr","text":"
fix_ocr(text: str) -> str\n

Fix common Icici OCR typos in the description text.

Parameters:

Name Type Description Default text str

Text to fix.

required

Returns:

Name Type Description str str

Text with OCR replacements applied.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciNumberPort","title":"IciciNumberPort","text":"

Bases: ImplNumberPort

Icici number leaf \u2014 prefers the last two decimal numbers.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciNumberPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciNumberPort.get_numbers","title":"get_numbers","text":"
get_numbers(line: str) -> List[float]\n

Extract monetary numbers, preferring trailing decimals.

Parameters:

Name Type Description Default line str

Text line to scan.

required

Returns:

Type Description List[float]

List[float]: Cleaned monetary numbers.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciNumberPort.get_opening_balance","title":"get_opening_balance","text":"
get_opening_balance(line: str) -> Optional[float]\n

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 None.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciPdfExtractionPipeline","title":"IciciPdfExtractionPipeline","text":"

Bases: ImplPDFExtractionPipeline

Icici pdf graph root \u2014 pins raw-lines, txn-blocks, and txn-dicts stages.

Attributes:

Name Type Description raw_lines IciciRawLinesPort

Icici raw-lines stage.

txn_blocks IciciTxnBlocksPort

Icici txn-blocks stage.

txn_dicts IciciTxnDictsPort

Icici txn-dicts stage.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciPdfExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciPdfExtractionPipeline.run","title":"run","text":"
run(source)\n

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.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciRawLinesPort","title":"IciciRawLinesPort","text":"

Bases: ImplRawLinesPort

Icici raw-lines leaf \u2014 binarized OCR.

Attributes:

Name Type Description covert_to_image bool

Binarize pages via image conversion.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciRawLinesPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciRawLinesPort.extract","title":"extract","text":"
extract(content)\n

Extract raw OCR text lines from content.

Parameters:

Name Type Description Default content

PDF bytes, Content, or dict payload.

required

Returns:

Type Description

List of raw text lines.

Raises:

Type Description TypeError

When content is not PDF bytes or Content with .raw.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciSplitterPort","title":"IciciSplitterPort","text":"

Bases: ImplSplitterPort

Icici splitter \u2014 pins the Icici number leaf.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciSplitterPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciSplitterPort.split_blocks","title":"split_blocks","text":"
split_blocks(\n    lines,\n    *,\n    has_header=False,\n    min_numbers=3,\n    detect_date_ranges=False\n)\n

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.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciTransactionParserPort","title":"IciciTransactionParserPort","text":"

Bases: ImplTransactionParserPort

Icici transaction parser \u2014 pins Icici-stage leaves and indices.

Attributes:

Name Type Description number IciciNumberPort

Icici number leaf.

desc IciciDescPort

Icici description leaf.

amount_balance IciciAmountBalancePort

Icici amount/balance leaf.

min_numbers int

Minimum numbers for a block.

amount_index int

Index of the amount in the number list.

balance_index int

Index of the balance in the number list.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciTransactionParserPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciTransactionParserPort.parse","title":"parse","text":"
parse(txn_text, prev_date_str, prev_balance)\n

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 None when the block has no usable date/numbers.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciTxnBlocksPort","title":"IciciTxnBlocksPort","text":"

Bases: ImplTxnBlocksPort

Icici txn-blocks stage \u2014 min_numbers=2, first bucket only.

Attributes:

Name Type Description bucket_finder IciciBucketFinderPort

Icici bucket finder.

splitter IciciSplitterPort

Icici splitter.

min_numbers int

Minimum numbers for a block.

limit_first bool

Keep only the first bucket.

line_offset int

Offset added to starting indices.

detect_date_ranges bool

Date-range detection enabled.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciTxnBlocksPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciTxnBlocksPort.extract","title":"extract","text":"
extract(raw_lines)\n

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 \u2192 block texts.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciTxnDictsPort","title":"IciciTxnDictsPort","text":"

Bases: ImplTxnDictsPort

Icici txn-dicts stage \u2014 pins the Icici transaction parser.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciTxnDictsPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici.IciciTxnDictsPort.extract","title":"extract","text":"
extract(txn_blocks)\n

Extract balance-chained txn dicts from blocks.

Parameters:

Name Type Description Default txn_blocks

Opening balance \u2192 block texts.

required

Returns:

Type Description

List of txn dicts.

"},{"location":"pipelines/extraction/pdf/banks/icici/#pipelines.extraction.pdf.banks.icici-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/","title":"Shared","text":""},{"location":"pipelines/extraction/shared/#pipelines.extraction.shared","title":"pipelines.extraction.shared","text":""},{"location":"pipelines/extraction/shared/#pipelines.extraction.shared--summary","title":"Summary","text":"

Shared leaf contracts + cross-family machinery.

"},{"location":"pipelines/extraction/shared/ambiguity/","title":"Ambiguity","text":""},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity","title":"pipelines.extraction.shared.ambiguity","text":""},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity--summary","title":"Summary","text":"

Ambiguity resolution \u2014 faithful port of domain.extraction.ambiguity.

Candidate generation and three-mode dispatch, ported verbatim so the hexa PDF path matches OG logic. The LLM-specific resolver is kept as an optional hook (resolver); pause/CLI behaviour is preserved via PauseForResolution.

"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity-classes","title":"Classes","text":""},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.AmbiguityHandler","title":"AmbiguityHandler","text":"
AmbiguityHandler(\n    fetch_request_id: str = \"\",\n    pause_on_ambiguity: bool = True,\n    resolved_choices: Optional[dict] = None,\n    resolver: Optional[Callable] = None,\n)\n

Three-mode ambiguity dispatcher: resolved_choices -> resolver -> pause -> CLI.

Attributes:

Name Type Description fetch_request_id str

Identifier correlating this resolution to a fetch request.

pause_on_ambiguity bool

Whether to raise PauseForResolution when unresolved.

resolved_choices dict

Cache of previously resolved candidate keys.

resolver Optional[Callable]

Optional LLM/machine resolver hook.

Initialize the ambiguity handler.

Parameters:

Name Type Description Default fetch_request_id str

Identifier correlating this resolution to a fetch request. Defaults to \"\".

'' pause_on_ambiguity bool

Whether to raise PauseForResolution when unresolved. Defaults to True.

True resolved_choices Optional[dict]

Prior choices keyed by candidate key. Defaults to None (becomes an empty dict).

None resolver Optional[Callable]

Optional resolver hook. Defaults to None.

None"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.AmbiguityHandler-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.AmbiguityHandler.resolve_ambiguity","title":"resolve_ambiguity","text":"
resolve_ambiguity(\n    line, ocr_amount, ocr_balance, prev_balance, candidates\n)\n

Resolve ambiguous amount/balance candidate pairs.

Validates the candidate pairs against the running balance and returns the unique valid interpretation. When multiple valid interpretations remain it consults resolved_choices, then the optional resolver hook, then either raises PauseForResolution or falls back to CLI resolution.

Parameters:

Name Type Description Default line

Raw transaction line being resolved.

required ocr_amount

OCR-extracted amount.

required ocr_balance

OCR-extracted balance.

required prev_balance

Running balance from the previous transaction.

required candidates

Collection of candidate (amount, balance) pairs.

required

Returns:

Type Description

Set of a single (amount, balance) pair, or None when no valid

interpretation exists.

Raises:

Type Description PauseForResolution

When multiple interpretations remain and pause_on_ambiguity is enabled.

"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.AmbiguousCandidateFound","title":"AmbiguousCandidateFound","text":"
AmbiguousCandidateFound(candidates: set)\n

Bases: ValueError

Raised when candidate generation produces multiple valid interpretations.

Attributes:

Name Type Description candidates set

Ambiguous candidate (amount, balance) pairs.

"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.AmountBalanceNotFound","title":"AmountBalanceNotFound","text":"

Bases: ValueError

Raised when no valid amount/balance interpretation can be found.

"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.PauseForResolution","title":"PauseForResolution","text":"
PauseForResolution(\n    line,\n    ocr_amount,\n    ocr_balance,\n    prev_balance,\n    candidates,\n    fetch_request_id: str = \"\",\n)\n

Bases: Exception

Signal that ambiguous candidates need human resolution.

Attributes:

Name Type Description line

Raw transaction line being resolved.

ocr_amount

OCR-extracted amount.

ocr_balance

OCR-extracted balance.

prev_balance

Running balance from the previous transaction.

candidates

Candidate (amount, balance) pairs.

fetch_request_id str

Fetch request ID used for correlation.

"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.ResolutionContext","title":"ResolutionContext","text":"
ResolutionContext(\n    amount,\n    balance,\n    prev_balance,\n    line,\n    numbers,\n    handler=None,\n    trust_fallback=None,\n    missing_number_candidates=None,\n)\n

Resolves amount/balance pairs, generating candidates when direct validation fails.

Attributes:

Name Type Description amount float

Absolute-rounded OCR amount.

balance float

Rounded OCR balance.

prev_balance float

Rounded running balance.

line

Raw transaction line being resolved.

numbers

Extracted numbers from the transaction line.

tolerance float

Allowed rounding difference.

handler

Optional AmbiguityHandler used when ambiguity surfaces.

trust_fallback

Optional fallback policy (\"amount\" or \"balance\").

missing_number_candidates

Optional candidate hook for one-number lines.

adjustors

Ordered list of candidate generator callables.

Initialize a resolution context.

Parameters:

Name Type Description Default amount

OCR-extracted transaction amount.

required balance

OCR-extracted closing balance.

required prev_balance

Running balance from the previous transaction.

required line

Raw transaction line being resolved.

required numbers

Extracted numbers from the transaction line.

required handler

Optional AmbiguityHandler for ambiguous candidates.

None trust_fallback

Optional fallback policy (\"amount\" or \"balance\").

None missing_number_candidates

Optional callable providing candidates for one-number lines.

None"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.ResolutionContext-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.ResolutionContext.resolve","title":"resolve","text":"
resolve()\n

Resolve to a validated (amount, balance) pair.

Applies direct sign validation first, then trust fallbacks, then walks the ordered candidate generators. Raises when nothing reconciles.

Returns:

Type Description

Two-tuple of signed amount and validated balance.

Raises:

Type Description AmountBalanceNotFound

When no candidate interpretation reconciles with the running balance.

"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.clean_num","title":"clean_num","text":"
clean_num(s: str) -> float\n

Convert a numeric string to a float, handling decimals and paise.

A bare integer string is treated as paise (divided by 100); strings with a decimal point use the decimal part directly.

Parameters:

Name Type Description Default s str

Numeric string to clean.

required

Returns:

Name Type Description float float

Parsed numeric value; 0.0 when the string has no digits.

"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.get_numbers","title":"get_numbers","text":"
get_numbers(text: str) -> List[float]\n

Extract monetary numbers from OCR/text lines.

Parameters:

Name Type Description Default text str

Text line to scan.

required

Returns:

Type Description List[float]

List[float]: Cleaned numeric values found in the text.

"},{"location":"pipelines/extraction/shared/ambiguity/#pipelines.extraction.shared.ambiguity.validate_signs","title":"validate_signs","text":"
validate_signs(\n    amount, balance, prev_balance, tolerance=1.0\n)\n

Validate a (amount, balance) interpretation against the running balance.

Parameters:

Name Type Description Default amount

OCR-extracted transaction amount.

required balance

OCR-extracted closing balance.

required prev_balance

Running balance from the previous transaction.

required tolerance float

Allowed rounding difference. Defaults to 1.0.

1.0

Returns:

Type Description

Two-tuple of signed amount and validated balance, or (None, None)

when no sign combination reconciles with the running balance.

"},{"location":"pipelines/extraction/shared/impl/","title":"Impl","text":""},{"location":"pipelines/extraction/shared/impl/#pipelines.extraction.shared.impl","title":"pipelines.extraction.shared.impl","text":""},{"location":"pipelines/extraction/shared/impl/#pipelines.extraction.shared.impl--summary","title":"Summary","text":"

Shared concrete implementations used by every extraction family.

Only genuinely family-agnostic ports live here:

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

"},{"location":"pipelines/extraction/shared/impl/#pipelines.extraction.shared.impl-classes","title":"Classes","text":""},{"location":"pipelines/extraction/shared/impl/#pipelines.extraction.shared.impl.ImplIngestPort","title":"ImplIngestPort","text":"

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.

"},{"location":"pipelines/extraction/shared/impl/#pipelines.extraction.shared.impl.ImplIngestPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/impl/#pipelines.extraction.shared.impl.ImplIngestPort.materialize","title":"materialize","text":"
materialize(source)\n

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.

"},{"location":"pipelines/extraction/shared/impl/#pipelines.extraction.shared.impl.ImplRawExpensePort","title":"ImplRawExpensePort","text":"

Bases: RawExpensePort

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

"},{"location":"pipelines/extraction/shared/impl/#pipelines.extraction.shared.impl.ImplRawExpensePort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/impl/#pipelines.extraction.shared.impl.ImplRawExpensePort.build","title":"build","text":"
build(txn_dicts)\n

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.

"},{"location":"pipelines/extraction/shared/ports/","title":"Ports","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports","title":"pipelines.extraction.shared.ports","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports--summary","title":"Summary","text":"

Shared leaf contracts for every extraction family (no implementation).

These ports are genuinely common across the pdf / email / csv / xlsx families:

Concrete implementations (re)declare the same slots with CONCRETE types in the per-family impl.py modules and in the per-bank modules; hexa.build() reads the merged MRO annotations and wires everything.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports-classes","title":"Classes","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.AmbiguityPort","title":"AmbiguityPort","text":"

Bases: ABC

Resolve ambiguous amount/balance interpretations.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.AmbiguityPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.AmbiguityPort.resolve_ambiguity","title":"resolve_ambiguity abstractmethod","text":"
resolve_ambiguity(\n    line: str,\n    ocr_amount: float,\n    ocr_balance: float,\n    prev_balance: float,\n) -> Any\n

Resolve ambiguous amount/balance interpretations.

Parameters:

Name Type Description Default line str

Raw transaction line.

required ocr_amount float

OCR-extracted amount.

required ocr_balance float

OCR-extracted balance.

required prev_balance float

Running balance from the previous transaction.

required

Returns:

Name Type Description Any Any

Resolution result (concrete per implementation).

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.AmountBalancePort","title":"AmountBalancePort","text":"

Bases: ABC

Validate + resolve a txn amount against the running balance.

Attributes:

Name Type Description trust_fallback Optional[str]

Fallback policy (\"amount\" or \"balance\").

number NumberPort

Number extraction leaf.

ambiguity AmbiguityPort

Ambiguity resolution leaf.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.AmountBalancePort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.AmountBalancePort.resolve","title":"resolve abstractmethod","text":"
resolve(\n    amount: float,\n    balance: float,\n    prev_balance: float,\n    line: str,\n    numbers: Optional[List[float]] = None,\n) -> Tuple[float, float]\n

Validate and resolve a transaction amount against the balance.

Parameters:

Name Type Description Default amount float

OCR-extracted amount.

required balance float

OCR-extracted balance.

required prev_balance float

Running balance from the previous transaction.

required line str

Raw transaction line.

required numbers Optional[List[float]]

Extracted numbers; default None.

None

Returns:

Type Description Tuple[float, float]

Tuple[float, float]: (signed amount, resolved balance).

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DatePort","title":"DatePort","text":"

Bases: ABC

Detect, parse and reconcile transaction dates.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DatePort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DatePort.get_dates","title":"get_dates abstractmethod","text":"
get_dates(line: str) -> Optional[Tuple[str, str]]\n

Extract the leading date and the remaining line tail.

Parameters:

Name Type Description Default line str

Text line to scan.

required

Returns:

Type Description Optional[Tuple[str, str]]

Optional[Tuple[str, str]]: (date_str, date_tail) when a date

Optional[Tuple[str, str]]

leads the line, else None.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DatePort.parse_date","title":"parse_date abstractmethod","text":"
parse_date(date_str: str) -> datetime.date\n

Parse a date string into a date.

Parameters:

Name Type Description Default date_str str

Date string, commonly DD-MM-YYYY.

required

Returns:

Type Description date

datetime.date: The parsed date.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DatePort.reconcile_date","title":"reconcile_date abstractmethod","text":"
reconcile_date(\n    date_str: str, prev_date_str: Optional[str]\n) -> str\n

Reconcile an OCR date against the previous transaction date.

Parameters:

Name Type Description Default date_str str

OCR-extracted date string.

required prev_date_str Optional[str]

Previous transaction date string.

required

Returns:

Name Type Description str str

Reconciliated date as DD-MM-YYYY.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DatePort.reorder_lines_by_date","title":"reorder_lines_by_date abstractmethod","text":"
reorder_lines_by_date(txn_lines: List[str]) -> List[str]\n

Reorder block lines so the dated line leads.

Parameters:

Name Type Description Default txn_lines List[str]

Transaction block lines.

required

Returns:

Type Description List[str]

List[str]: Lines with the dated line moved to the front.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DatePort.split_line_by_date","title":"split_line_by_date abstractmethod","text":"
split_line_by_date(line: str) -> List[str]\n

Split a line into segments at date boundaries.

Parameters:

Name Type Description Default line str

Text line (possibly two transactions merged).

required

Returns:

Type Description List[str]

List[str]: Line segments split at date boundaries.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DescPort","title":"DescPort","text":"

Bases: ABC

Extract a clean transaction description.

Attributes:

Name Type Description starters List[str]

Description starter markers to slice at.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DescPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.DescPort.extract_description","title":"extract_description abstractmethod","text":"
extract_description(description: str) -> str\n

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.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.ExtractionSource","title":"ExtractionSource dataclass","text":"
ExtractionSource(\n    source_type: str,\n    bank: str,\n    pipeline: str,\n    path: Optional[str],\n    trust_fallback: Optional[str],\n)\n

Nested attribute struct describing where to pull content from.

Attributes:

Name Type Description source_type str

Source family tag (pdf, email, csv, xlsx, llama).

bank str

Bank tag (axis, icici).

pipeline str

Pipeline tag (heuristic, llm, tabular).

path Optional[str]

Path to the source content, when applicable.

trust_fallback Optional[str]

Fallback policy for amount/balance trust.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.IngestPort","title":"IngestPort","text":"

Bases: ABC

Turn an ExtractionSource into a concrete content payload.

Attributes:

Name Type Description source_type str

Source-type tag declared by the concrete root.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.IngestPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.IngestPort.materialize","title":"materialize abstractmethod","text":"
materialize(source) -> Any\n

Convert a raw source into a concrete content payload.

Parameters:

Name Type Description Default source

Raw source (via ExtractionSource) to materialize.

required

Returns:

Name Type Description Any Any

Concrete payload (bytes, Content, dict, list, or str).

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.NumberPort","title":"NumberPort","text":"

Bases: ABC

Extract monetary numbers from OCR/text lines.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.NumberPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.NumberPort.get_numbers","title":"get_numbers abstractmethod","text":"
get_numbers(line: str) -> List[float]\n

Extract monetary numbers from a line.

Parameters:

Name Type Description Default line str

Text line to scan.

required

Returns:

Type Description List[float]

List[float]: Cleaned monetary numbers found in the line.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.NumberPort.get_opening_balance","title":"get_opening_balance abstractmethod","text":"
get_opening_balance(line: str) -> Optional[float]\n

Extract the opening balance from a line.

Parameters:

Name Type Description Default line str

Text line to scan.

required

Returns:

Type Description Optional[float]

Optional[float]: The opening balance when found, else None.

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.RawExpensePort","title":"RawExpensePort","text":"

Bases: ABC

txn_dicts \u2192 list[RawExpense], balance-chained (terminal).

"},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.RawExpensePort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/ports/#pipelines.extraction.shared.ports.RawExpensePort.build","title":"build abstractmethod","text":"
build(txn_dicts) -> List[Any]\n

Build raw expenses from txn dicts (terminal stage).

Parameters:

Name Type Description Default txn_dicts

List of structured transaction dicts.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/shared/registry/","title":"Registry","text":""},{"location":"pipelines/extraction/shared/registry/#pipelines.extraction.shared.registry","title":"pipelines.extraction.shared.registry","text":""},{"location":"pipelines/extraction/shared/registry/#pipelines.extraction.shared.registry--summary","title":"Summary","text":"

Registry mapping (source_type, bank, pipeline) \u2192 composition root.

Each family's banks/ module defines its concrete root (e.g. AxisPdfExtractionPipeline); this module is the single lookup used by callers (the fetch-request scripts) instead of hand-rolled _BANK_TO_ROOT maps.

"},{"location":"pipelines/extraction/shared/registry/#pipelines.extraction.shared.registry-classes","title":"Classes","text":""},{"location":"pipelines/extraction/shared/registry/#pipelines.extraction.shared.registry-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/registry/#pipelines.extraction.shared.registry.known_roots","title":"known_roots","text":"
known_roots() -> list\n

List every registered (source_type, bank, pipeline) triple.

Returns:

Name Type Description list list

List of (source_type, bank, pipeline) tuples.

"},{"location":"pipelines/extraction/shared/registry/#pipelines.extraction.shared.registry.resolve_root","title":"resolve_root","text":"
resolve_root(\n    source_type: str, bank: str, pipeline: str = \"heuristic\"\n) -> type\n

Return the composition root class for (source_type, bank, pipeline).

Parameters:

Name Type Description Default source_type str

Source family (pdf, email, csv, xlsx, llama).

required bank str

Bank tag (axis, icici).

required pipeline str

Pipeline tag; defaults to \"heuristic\".

'heuristic'

Returns:

Name Type Description type type

The composition root class for the triple.

Raises:

Type Description ValueError

When no root is registered for the triple.

"},{"location":"pipelines/extraction/shared/tabular/","title":"Tabular","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular","title":"pipelines.extraction.shared.tabular","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular--summary","title":"Summary","text":"

Shared tabular extraction core (csv + xlsx families).

Both the csv and xlsx families are \"direct table\" pipelines: the bank parser emits the exact typed table and the pipeline owns all policy \u2014 signs come from the withdrawal/deposit columns and balances are adjusted as we go so the emitted sequence is always balance-chained. No number extraction, bucket finding, splitting, or ambiguity resolution occurs (unlike the pdf family).

Shared here (both families import from this module):

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular-classes","title":"Classes","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.ImplObjectsTxnDictsPort","title":"ImplObjectsTxnDictsPort","text":"

Bases: ObjectsTxnDictsPort

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.ImplObjectsTxnDictsPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.ImplObjectsTxnDictsPort.build","title":"build","text":"
build(objects)\n

Build txn dicts from already-structured objects (impl).

Parameters:

Name Type Description Default objects

Structured statement objects.

required

Returns:

Type Description

List of txn dicts.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.ImplTabularTxnDictsPort","title":"ImplTabularTxnDictsPort","text":"

Bases: TabularTxnDictsPort

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.ImplTabularTxnDictsPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.ImplTabularTxnDictsPort.build","title":"build","text":"
build(records)\n

Build balance-chained txn dicts from typed records (impl).

Parameters:

Name Type Description Default records

Typed table records.

required

Returns:

Type Description

List of txn dicts.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.ObjectsTxnDictsPort","title":"ObjectsTxnDictsPort","text":"

Bases: ABC

already-structured objects \u2192 list of txn dicts (stated balances trusted).

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.ObjectsTxnDictsPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.ObjectsTxnDictsPort.build","title":"build abstractmethod","text":"
build(\n    objects: List[Dict[str, Any]],\n) -> List[Dict[str, Any]]\n

Build txn dicts from already-structured objects.

Parameters:

Name Type Description Default objects List[Dict[str, Any]]

Structured statement objects.

required

Returns:

Type Description List[Dict[str, Any]]

List[Dict[str, Any]]: Txn dicts.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TableParserMixin","title":"TableParserMixin","text":"

Format-agnostic typed table reading shared by csv and xlsx readers.

Default aliases/required columns model the icici export; the axis csv reader overrides column_aliases (with the DR/CR inversion).

Attributes:

Name Type Description column_aliases Dict[str, List[str]]

Alias lookup for header matching.

max_header_scan int

Max rows scanned for the header row.

required_columns Tuple[str, ...]

Columns that must be present.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TableReaderPort","title":"TableReaderPort","text":"

Bases: ABC

content \u2192 list of typed table records (in sheet/file order).

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TableReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TableReaderPort.read","title":"read abstractmethod","text":"
read(content) -> List[Dict[str, Any]]\n

Read typed table records from content.

Parameters:

Name Type Description Default content

Materialized content payload.

required

Returns:

Type Description List[Dict[str, Any]]

List[Dict[str, Any]]: Typed table records in source order.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TabularExtractionPipeline","title":"TabularExtractionPipeline","text":"

Bases: ABC

Root \u2014 direct-table chain: ingest \u2192 table_reader \u2192 txn_dicts \u2192 raw_expense.

Attributes:

Name Type Description source ExtractionSource

The extraction source descriptor.

pipeline str

Pipeline tag; defaults to \"tabular\".

ingest IngestPort

Ingest stage.

table_reader TableReaderPort

Table reading stage.

txn_dicts TabularTxnDictsPort

Txn-dict building stage.

raw_expense RawExpensePort

Terminal raw-expense stage.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TabularExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TabularExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the direct-table extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TabularTxnDictsPort","title":"TabularTxnDictsPort","text":"

Bases: ABC

records \u2192 list of txn dicts, balance-chained (terminal rules live here).

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TabularTxnDictsPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.TabularTxnDictsPort.build","title":"build abstractmethod","text":"
build(\n    records: List[Dict[str, Any]],\n) -> List[Dict[str, Any]]\n

Build balance-chained txn dicts from typed records.

Parameters:

Name Type Description Default records List[Dict[str, Any]]

Typed table records.

required

Returns:

Type Description List[Dict[str, Any]]

List[Dict[str, Any]]: Txn dicts.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular-functions","title":"Functions","text":""},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.adjust_balances","title":"adjust_balances","text":"
adjust_balances(\n    records: List[Dict[str, Any]],\n) -> List[Dict[str, Any]]\n

Walk records in table order, correcting balances to the running chain.

The first record anchors on its stated balance. Every subsequent record keeps its stated balance only when it continues the chain exactly; otherwise the balance is adjusted to prev + amount.

Parameters:

Name Type Description Default records List[Dict[str, Any]]

Records in table order to chain.

required

Returns:

Type Description List[Dict[str, Any]]

List[Dict[str, Any]]: The same records with corrected balances.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.objects_to_txn_dict","title":"objects_to_txn_dict","text":"
objects_to_txn_dict(obj: Dict[str, Any]) -> Dict[str, Any]\n

Map an already-structured statement object onto the txn-dict shape.

Faithful port of OG domain.extraction.pipelines.llama_parser.to_txn_dict: the object already carries a signed-able amount plus an explicit direction (DEBIT/CREDIT), so the balance is TRUSTED as stated \u2014 no re-chaining, unlike the tabular policy. Direction handling accepts the enum instance, \"Direction.CREDIT\"-style prefixed strings, and any casing, mirroring the OG helper.

Parameters:

Name Type Description Default obj Dict[str, Any]

Structured statement object.

required

Returns:

Type Description Dict[str, Any]

Dict[str, Any]: Txn dict with txn_date, particulars, amount, balance,

Dict[str, Any]

and direction keys.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.signed_amount","title":"signed_amount","text":"
signed_amount(record: Dict[str, Any]) -> float\n

Compute the signed amount from deposit minus withdrawal.

Parameters:

Name Type Description Default record Dict[str, Any]

Typed table record.

required

Returns:

Name Type Description float float

Deposit minus withdrawal, rounded to 2 places.

"},{"location":"pipelines/extraction/shared/tabular/#pipelines.extraction.shared.tabular.tabular_to_txn_dict","title":"tabular_to_txn_dict","text":"
tabular_to_txn_dict(\n    record: Dict[str, Any],\n) -> Dict[str, Any]\n

Map a typed table record onto the standard txn-dict shape.

Parameters:

Name Type Description Default record Dict[str, Any]

Typed, balance-chained table record.

required

Returns:

Type Description Dict[str, Any]

Dict[str, Any]: Txn dict with txn_date, particulars, amount, balance,

Dict[str, Any]

and direction keys.

"},{"location":"pipelines/extraction/xlsx/","title":"Xlsx","text":""},{"location":"pipelines/extraction/xlsx/#pipelines.extraction.xlsx","title":"pipelines.extraction.xlsx","text":""},{"location":"pipelines/extraction/xlsx/#pipelines.extraction.xlsx--summary","title":"Summary","text":"

xlsx (direct table) extraction family.

"},{"location":"pipelines/extraction/xlsx/abc/","title":"Abc","text":""},{"location":"pipelines/extraction/xlsx/abc/#pipelines.extraction.xlsx.abc","title":"pipelines.extraction.xlsx.abc","text":""},{"location":"pipelines/extraction/xlsx/abc/#pipelines.extraction.xlsx.abc--summary","title":"Summary","text":"

Abstract contracts for the xlsx (direct table) extraction graph.

The xlsx family is a \"direct table\" pipeline \u2014 no OCR, no buckets, no ambiguity. It shares the tabular core (shared/tabular.py) with csv: only the table reader differs (xlsx worksheet rows vs csv rows). Bank-specific readers live under banks/.

"},{"location":"pipelines/extraction/xlsx/abc/#pipelines.extraction.xlsx.abc-classes","title":"Classes","text":""},{"location":"pipelines/extraction/xlsx/abc/#pipelines.extraction.xlsx.abc.XlsxExtractionPipeline","title":"XlsxExtractionPipeline","text":"

Bases: TabularExtractionPipeline

xlsx-family root \u2014 pins only the reader; chain shared with csv.

Slot annotations

source: ExtractionSource ingest, table_reader, txn_dicts, raw_expense

Attributes:

Name Type Description source ExtractionSource

The extraction source descriptor.

table_reader XlsxTableReaderPort

Xlsx table reader stage.

"},{"location":"pipelines/extraction/xlsx/abc/#pipelines.extraction.xlsx.abc.XlsxExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/xlsx/abc/#pipelines.extraction.xlsx.abc.XlsxExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the direct-table extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/xlsx/abc/#pipelines.extraction.xlsx.abc.XlsxTableReaderPort","title":"XlsxTableReaderPort","text":"

Bases: TableReaderPort

content \u2192 list of typed records read from an xlsx statement sheet.

"},{"location":"pipelines/extraction/xlsx/abc/#pipelines.extraction.xlsx.abc.XlsxTableReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/xlsx/abc/#pipelines.extraction.xlsx.abc.XlsxTableReaderPort.read","title":"read","text":"
read(content) -> List[dict]\n

Read typed records from an xlsx statement sheet.

Parameters:

Name Type Description Default content

Materialized content (bytes, Content, dict, or str).

required

Returns:

Type Description List[dict]

List[dict]: Typed table records.

"},{"location":"pipelines/extraction/xlsx/impl/","title":"Impl","text":""},{"location":"pipelines/extraction/xlsx/impl/#pipelines.extraction.xlsx.impl","title":"pipelines.extraction.xlsx.impl","text":""},{"location":"pipelines/extraction/xlsx/impl/#pipelines.extraction.xlsx.impl--summary","title":"Summary","text":"

Concrete xlsx-family implementations.

ImplXlsxTableReaderPort reads typed worksheet rows (via the omniread xlsx parser's workbook) and runs them through the shared TableParserMixin to emit typed records. The chain (records \u2192 balance-adjusted txn dicts \u2192 raw expenses) is the shared tabular core.

"},{"location":"pipelines/extraction/xlsx/impl/#pipelines.extraction.xlsx.impl-classes","title":"Classes","text":""},{"location":"pipelines/extraction/xlsx/impl/#pipelines.extraction.xlsx.impl.ImplXlsxExtractionPipeline","title":"ImplXlsxExtractionPipeline","text":"

Bases: XlsxExtractionPipeline

Concrete xlsx graph root.

Attributes:

Name Type Description ingest ImplIngestPort

Ingest stage.

table_reader ImplXlsxTableReaderPort

Xlsx table reader stage.

txn_dicts ImplTabularTxnDictsPort

Shared tabular txn-dicts stage.

raw_expense ImplRawExpensePort

Terminal raw-expense stage.

"},{"location":"pipelines/extraction/xlsx/impl/#pipelines.extraction.xlsx.impl.ImplXlsxExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/xlsx/impl/#pipelines.extraction.xlsx.impl.ImplXlsxExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the direct-table extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/xlsx/impl/#pipelines.extraction.xlsx.impl.ImplXlsxTableReaderPort","title":"ImplXlsxTableReaderPort","text":"

Bases: TableParserMixin, XlsxTableReaderPort

Concrete xlsx reader \u2014 omniread xlsx parser + shared TableParserMixin.

Attributes:

Name Type Description max_header_scan int

Max rows scanned for the header row.

"},{"location":"pipelines/extraction/xlsx/impl/#pipelines.extraction.xlsx.impl.ImplXlsxTableReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/xlsx/impl/#pipelines.extraction.xlsx.impl.ImplXlsxTableReaderPort.read","title":"read","text":"
read(content) -> List[dict]\n

Read typed records from xlsx content.

Parameters:

Name Type Description Default content

Materialized content (Content, bytes, or dict).

required

Returns:

Type Description List[dict]

List[dict]: Typed table records.

"},{"location":"pipelines/extraction/xlsx/banks/","title":"Banks","text":""},{"location":"pipelines/extraction/xlsx/banks/#pipelines.extraction.xlsx.banks","title":"pipelines.extraction.xlsx.banks","text":""},{"location":"pipelines/extraction/xlsx/banks/#pipelines.extraction.xlsx.banks--summary","title":"Summary","text":"

xlsx family \u2014 bank-specific ports and pipeline roots.

"},{"location":"pipelines/extraction/xlsx/banks/icici/","title":"Icici","text":""},{"location":"pipelines/extraction/xlsx/banks/icici/#pipelines.extraction.xlsx.banks.icici","title":"pipelines.extraction.xlsx.banks.icici","text":""},{"location":"pipelines/extraction/xlsx/banks/icici/#pipelines.extraction.xlsx.banks.icici--summary","title":"Summary","text":"

Icici bank-specific port implementations (xlsx table path).

Faithful port of domain/extraction/banks/icici/xlsx.py: the xlsx reader uses the shared TableParserMixin (default icici aliases) over typed worksheet rows. Ordering/balance policy stays in the shared tabular txn_dicts stage.

"},{"location":"pipelines/extraction/xlsx/banks/icici/#pipelines.extraction.xlsx.banks.icici-classes","title":"Classes","text":""},{"location":"pipelines/extraction/xlsx/banks/icici/#pipelines.extraction.xlsx.banks.icici.IciciXlsxExtractionPipeline","title":"IciciXlsxExtractionPipeline","text":"

Bases: ImplXlsxExtractionPipeline

Icici xlsx graph root \u2014 pins the Icici reader.

Attributes:

Name Type Description table_reader IciciXlsxTableReaderPort

Icici xlsx reader stage.

"},{"location":"pipelines/extraction/xlsx/banks/icici/#pipelines.extraction.xlsx.banks.icici.IciciXlsxExtractionPipeline-functions","title":"Functions","text":""},{"location":"pipelines/extraction/xlsx/banks/icici/#pipelines.extraction.xlsx.banks.icici.IciciXlsxExtractionPipeline.run","title":"run","text":"
run(source) -> List[Any]\n

Run the direct-table extraction chain.

Parameters:

Name Type Description Default source

Raw extraction source.

required

Returns:

Type Description List[Any]

List[Any]: Raw expense records.

"},{"location":"pipelines/extraction/xlsx/banks/icici/#pipelines.extraction.xlsx.banks.icici.IciciXlsxTableReaderPort","title":"IciciXlsxTableReaderPort","text":"

Bases: ImplXlsxTableReaderPort

Icici xlsx reader \u2014 inherits the default (icici) column aliases.

"},{"location":"pipelines/extraction/xlsx/banks/icici/#pipelines.extraction.xlsx.banks.icici.IciciXlsxTableReaderPort-functions","title":"Functions","text":""},{"location":"pipelines/extraction/xlsx/banks/icici/#pipelines.extraction.xlsx.banks.icici.IciciXlsxTableReaderPort.read","title":"read","text":"
read(content) -> List[dict]\n

Read typed records from xlsx content.

Parameters:

Name Type Description Default content

Materialized content (Content, bytes, or dict).

required

Returns:

Type Description List[dict]

List[dict]: Typed table records.

"}]}