Skip to content

Resolver

domain.enrichment.entity.resolver

Summary

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.

Classes

CandidateBasedFlagsNode

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.

Attributes
candidate_based_flag_mapping property
candidate_based_flag_mapping

Return the candidate-keyword flag mapping.

Returns:

Type Description

The mapping dict from the registry.

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]

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.

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

EntityAliasNode

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.

Attributes
config property
config

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

default_logo_mapping property
default_logo_mapping

Return the default logo mapping by entity type.

Returns:

Type Description

The mapping dict from the registry, defaulting to

ENTITY_DEFAULT_LOGO_MAPPING.

entity_alias_regex property
entity_alias_regex

Return the compiled alias regex/value pairs.

Returns:

Type Description

The compiled regex-map entries from the registry.

entity_type_mapping property
entity_type_mapping

Return the entity-type mapping for assigned entities.

Returns:

Type Description

The mapping dict from the registry, defaulting to

ENTITY_TYPE_MAPPING.

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

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.

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

ExtractCandidatesNode

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.

Attributes
candidate_regex property
candidate_regex

Return the compiled candidate extraction regexes.

Returns:

Type Description

The compiled regex list from the registry.

config property
config

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

negative_candidates property
negative_candidates

Return the negative candidate tokens to skip.

Returns:

Type Description

The array of negative candidate strings from the registry.

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

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.

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

FallbackNode

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.

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
resolve
resolve(state: State) -> Iterable[State]

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.

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

NormalizeDescriptionNode

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.

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
resolve
resolve(state: State) -> Iterable[State]

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.

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

SetEntityNode

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.

Attributes
config property
config

Return the node config installed by the pipeline loader.

Returns:

Type Description

The node configuration dict, or None before wiring.

default_logo_mapping property
default_logo_mapping

Return the default logo mapping by entity type.

Returns:

Type Description

The mapping dict from the registry, defaulting to

ENTITY_DEFAULT_LOGO_MAPPING.

entity_type_mapping property
entity_type_mapping

Return the entity-type mapping for assigned entities.

Returns:

Type Description

The mapping dict from the registry, defaulting to

ENTITY_TYPE_MAPPING.

flags_based_entity_rules property
flags_based_entity_rules

Return the flag-based entity rules.

Returns:

Type Description

The rule list from the registry.

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

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.

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

Functions