Skip to content

Nodes

domain.enrichment.nodes

Summary

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.


Notes

Guarantees:

  • Nodes never perform I/O; all decision inputs come from the injected pattern registry and node config.

Lifecycle:

  • set_registry and set_config are invoked by the pipeline loaders when a pipeline is built and cached.

Classes

AmountBasedFlagNode

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

Attributes
amount_based_flag_mapping property
amount_based_flag_mapping

Return the configured amount-based flag tokens.

Returns:

Type Description

The array of flag tokens from the mapped registry pattern.

config property
config

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

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

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.

set_config
set_config(config)

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
set_registry
set_registry(registry)

Install the pattern registry on this node.

Parameters:

Name Type Description Default
registry

The PatternRegistry instance to use for lookups.

required

RegistryNode

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.

Attributes
config property
config

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

Functions
set_config
set_config(config)

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
set_registry
set_registry(registry)

Install the pattern registry on this node.

Parameters:

Name Type Description Default
registry

The PatternRegistry instance to use for lookups.

required