Skip to content

Ports

pipelines.enrichment.shared.ports

Summary

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).

Classes

AmountFlagsPort

Bases: RegistryPort, ABC

amount → amount_* candidate flags (shared by entity and tags families).

Attributes
amount_based_flag_mapping property
amount_based_flag_mapping

Flag names to evaluate, taken from the registry.

Returns:

Name Type Description
List

The registered amount-flag names.

config property
config

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

Functions
resolve abstractmethod
resolve(state: State) -> Iterable[State]

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.

set_config
set_config(config)

Inject the per-node config.

Parameters:

Name Type Description Default
config dict

Per-node config from the dagpipe spec.

required
set_registry
set_registry(registry)

Inject the merged pattern registry.

Parameters:

Name Type Description Default
registry PatternRegistry

The merged pattern registry.

required

FinalizePort

Bases: ABC

Terminal state processor: confidence sort then build the result dict.

Functions
process abstractmethod
process(states: list) -> dict

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.

RegistryPort

Bases: Node, ABC

dagpipe node with injectable PatternRegistry + per-node config.

Attributes
config property
config

Per-node config injected via set_config.

Returns:

Type Description

dict | None: The per-node config, or None before injection.

Functions
resolve abstractmethod
resolve(state: State) -> Iterable[State]

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.

set_config
set_config(config)

Inject the per-node config.

Parameters:

Name Type Description Default
config dict

Per-node config from the dagpipe spec.

required
set_registry
set_registry(registry)

Inject the merged pattern registry.

Parameters:

Name Type Description Default
registry PatternRegistry

The merged pattern registry.

required