Skip to content

Enrichment

domain.fetch_pipeline.ports.enrichment

Summary

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.

Classes

EnrichmentOrchestratorAdaptor

1
2
3
EnrichmentOrchestratorAdaptor(
    *, entity_pipeline=None, tags_pipeline=None
)

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.

Functions
enrich async
enrich(raw: RawExpense) -> EnrichedExpense

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.

Functions

get_enrichment_orchestrator

1
2
3
get_enrichment_orchestrator(
    **kwargs,
) -> EnrichmentOrchestratorAdaptor

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.