Skip to content

Flags

domain.enrichment.tags.flags

Summary

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.

Classes

EntityBasedFlagsNode

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.

Attributes
config property
config

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

entity_based_flag_mapping property
entity_based_flag_mapping

Return the entity-based flag mapping.

Returns:

Type Description

The mapping dict from the registry.

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

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.

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

SetTagsNode

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.

Attributes
config property
config

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

flags_based_tags_rules property
flags_based_tags_rules

Return the flag-based tag rules.

Returns:

Type Description

The rule list from the registry.

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

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.

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