senzing_core

The senzing_core Python package has 4 major modules / classes. Senzing objects are created using an Abstract Factory Pattern.

Senzing classes

Module

Class

Creation

szconfigmanager

SzConfigManagerCore

sz_configmanager = sz_abstract_factory.create_configmanager()

szdiagnostic

SzDiagnosticCore

sz_diagnostic = sz_abstract_factory.create_diagnostic()

szengine

SzEngineCore

sz_engine = sz_abstract_factory.create_engine()

szproduct

SzProductCore

sz_product = sz_abstract_factory.create_product()

For the full implementation of the documentation examples, visit the source code on GitHub.

szabstractfactory

senzing_core.szabstractfactory.SzAbstractFactoryCore is an implementation of the senzing.szabstractfactory.SzAbstractFactory interface that communicates with the Senzing binaries.

class senzing_core.szabstractfactory.SzAbstractFactoryCore(instance_name: str = '', settings: str | Dict[Any, Any] = '', config_id: int = 0, verbose_logging: int = 0)[source]

Bases: SzAbstractFactory

SzAbstractFactoryCore is a factory pattern for accessing Senzing.

property config_id: int

Return the config ID the abstract factory was instantiated with. If this is 0 no config ID was specified and the current system DEFAULTCONFIGID was used.

create_configmanager() SzConfigManager[source]

The create_configmanager method creates a new implementation of an SzConfigManager object.

Args:

Returns:

A new implementation.

Return type:

SzConfigManager

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_configmanager = sz_abstract_factory.create_configmanager()
18except SzError as err:
19    print(f"\nERROR: {err}\n")

Output:

1// No output from this example.
create_diagnostic() SzDiagnostic[source]

The create_diagnostic method creates a new implementation of an SzDiagnostic object.

Args:

Returns:

A new implementation.

Return type:

SzDiagnostic

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_diagnostic = sz_abstract_factory.create_diagnostic()
18except SzError as err:
19    print(f"\nERROR: {err}\n")

Output:

1// No output from this example.
create_engine() SzEngine[source]

The create_engine method creates a new implementation of an SzEngine object.

Args:

Returns:

A new implementation.

Return type:

SzEngine

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_engine = sz_abstract_factory.create_engine()
18except SzError as err:
19    print(f"\nERROR: {err}\n")

Output:

1// No output from this example.
create_product() SzProduct[source]

The create_product method creates a new implementation of an SzProduct object.

Args:

Returns:

A new implementation.

Return type:

SzProduct

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_product = sz_abstract_factory.create_product()
18except SzError as err:
19    print(f"\nERROR: {err}\n")

Output:

1// No output from this example.
destroy() None[source]

The destroy method destroys the AbstractFactory and all objects created by the AbstractFactory.

Raises:
  • TypeError – Incorrect datatype of input parameter.

  • szexception.SzError – config_id does not exist.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_engine = sz_abstract_factory.create_engine()
18    sz_diagnostic = sz_abstract_factory.create_diagnostic()
19
20    # Do work...
21except SzError as err:
22    print(f"\nERROR: {err}\n")
23finally:
24    # Destroys the abstract factory and all objects it created, such as sz_engine and sz_diagnostic above
25    # If sz_abstract_factory goes out of scope destroy() is automatically called
26    sz_abstract_factory.destroy()
property instance_name: str

Return the instance name the abstract factory was instantiated with.

property is_destroyed: bool

Return if the instance has been destroyed.

reinitialize(config_id: int) None[source]

The reinitialize method reinitializes the Senzing objects using a specific configuration identifier. A list of available configuration identifiers can be retrieved using szconfigmanager.get_config_registry.

Parameters:

config_id (int) – The configuration ID used for the initialization

Raises:
  • TypeError – Incorrect datatype of input parameter.

  • szexception.SzError – config_id does not exist.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    # Using get_active_config_id for demonstrations purposes.
17    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
18    sz_engine = sz_abstract_factory.create_engine()
19    config_id = sz_engine.get_active_config_id()
20    sz_abstract_factory.reinitialize(config_id)
21except SzError as err:
22    print(f"\nERROR: {err}\n")
property settings: str | dict[Any, Any]

Return the settings the abstract factory was instantiated with.

property verbose_logging: int

Return the verbose logging setting the abstract factory was instantiated with.

class senzing_core.szabstractfactory.SzAbstractFactoryParametersCore[source]

Bases: TypedDict

Used to create a dictionary that can be unpacked when creating an SzAbstractFactory.

config_id: int
instance_name: str
settings: str | dict[Any, Any]
verbose_logging: int

szconfig

senzing_core.szconfig.SzConfigCore is an implementation of the senzing.szconfig.SzConfig interface that communicates with the Senzing binaries.

To use szconfig, the LD_LIBRARY_PATH environment variable must include a path to Senzing’s libraries.

Example:

export LD_LIBRARY_PATH=/opt/senzing/er/lib
class senzing_core.szconfig.SzConfigCore(**kwargs: Any)[source]

Bases: SzConfig

Use SzAbstractFactoryCore.create_config() to create an SzConfig object. The SzConfig object uses the arguments provided to SzAbstractFactoryCore().

Example:

from senzing_core import SzAbstractFactoryCore

sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
sz_config = sz_abstract_factory.create_config()

Args:

Raises:

export() str[source]

The export method retrieves the definition for this configuration.

Args:

Returns:

A string containing a JSON Document representation of the Senzing SzConfig object.

Return type:

str

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_configmanager = sz_abstract_factory.create_configmanager()
18    sz_config = sz_configmanager.create_config_from_template()
19    config_definition = sz_config.export()
20    print(f"\n{config_definition}\n")
21except SzError as err:
22    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted and pruned for easier reading.
 2// To view a complete configuration, visit /opt/senzing/er/resources/templates/g2config.json
 3
 4{
 5  "G2_CONFIG": {
 6    "CFG_ATTR": [],
 7    "CFG_CFBOM": [],
 8    "CFG_CFCALL": [],
 9    "CFG_CFRTN": [],
10    "CFG_CFUNC": [],
11    "CFG_DFBOM": [],
12    "CFG_DFCALL": [],
13    "CFG_DFUNC": [],
14    "CFG_DSRC": [],
15    "CFG_DSRC_INTEREST": [],
16    "CFG_ECLASS": [],
17    "CFG_EFBOM": [],
18    "CFG_EFCALL": [],
19    "CFG_EFUNC": [],
20    "CFG_ERFRAG": [],
21    "CFG_ERRULE": [],
22    "CFG_ETYPE": [],
23    "CFG_FBOM": [],
24    "CFG_FBOVR": [],
25    "CFG_FCLASS": [],
26    "CFG_FELEM": [],
27    "CFG_FTYPE": [],
28    "CFG_GENERIC_THRESHOLD": [],
29    "CFG_GPLAN": [],
30    "CFG_LENS": [],
31    "CFG_LENSRL": [],
32    "CFG_RCLASS": [],
33    "CFG_RTYPE": [],
34    "CFG_SFCALL": [],
35    "CFG_SFUNC": [],
36    "SYS_OOM": [],
37    "CONFIG_BASE_VERSION": {
38      "VERSION": "4.0.0",
39      "BUILD_VERSION": "4.0.0.00000",
40      "BUILD_DATE": "2025-01-01",
41      "BUILD_NUMBER": "00000",
42      "COMPATIBILITY_VERSION": {
43        "CONFIG_VERSION": "11"
44      }
45    }
46  }
47}
get_data_source_registry() str[source]

The get_data_source_registry method gets the data source registry for this configuration.

Args:

Returns:

A string containing a JSON document listing all of the data sources.

Return type:

str

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_configmanager = sz_abstract_factory.create_configmanager()
18    sz_config = sz_configmanager.create_config_from_template()
19    result = sz_config.get_data_source_registry()
20    print(f"\n{result}\n")
21except SzError as err:
22    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "DATA_SOURCES": [
 5    {
 6      "DSRC_ID": 1,
 7      "DSRC_CODE": "TEST"
 8    },
 9    {
10      "DSRC_ID": 2,
11      "DSRC_CODE": "SEARCH"
12    }
13  ]
14}
help(method_name: str = '') str

The help method returns help for a particular message.

Parameters:

method_name (str) – The name of the method. (e.g. “init”). If empty, a list of methods and descriptions is returned.

Returns:

The Help information about the requested method

Return type:

str

import_config_definition(config_definition: str) None[source]

Set the internal JSON document.

Parameters:

config_definition (str) – A Senzing configuration JSON document.

import_template() None[source]

Retrieves a Senzing configuration from the default template. The default template is the Senzing configuration JSON document file, g2config.json, located in the PIPELINE.RESOURCEPATH path.

register_data_source(data_source_code: str) str[source]

The register_data_source method adds a data source to this configuration.

Because SzConfig is an in-memory representation, the repository is not changed unless the configuration is exported and then registered via ConfigManager.

Parameters:

data_source_code (str) – Name of data source code to add.

Returns:

A string containing a JSON document listing the newly created data source.

Return type:

str

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5data_source_code = "NAME_OF_DATASOURCE"
 6instance_name = "Example"
 7settings = {
 8    "PIPELINE": {
 9        "CONFIGPATH": "/etc/opt/senzing",
10        "RESOURCEPATH": "/opt/senzing/er/resources",
11        "SUPPORTPATH": "/opt/senzing/data",
12    },
13    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
14}
15
16try:
17    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
18    sz_configmanager = sz_abstract_factory.create_configmanager()
19    sz_config = sz_configmanager.create_config_from_template()
20    result = sz_config.register_data_source(data_source_code)
21    print(f"\n{result}\n")
22except SzError as err:
23    print(f"\nERROR: {err}\n")

Output:

1// Output has been formatted for easier reading.
2
3{
4  "DSRC_ID": 1001
5}
unregister_data_source(data_source_code: str) str[source]

The unregister_data_source method removes a data source from this configuration.

Because SzConfig is an in-memory representation, the repository is not changed unless the configuration is exported and then registered via ConfigManager.

Is idempotent.

Warning: If records in the repository refer to the unregistered datasource, the configuration cannot be used as the active configuration.

Parameters:

data_source_code (str) – Name of data source code to delete.

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5data_source_code = "TEST"
 6instance_name = "Example"
 7settings = {
 8    "PIPELINE": {
 9        "CONFIGPATH": "/etc/opt/senzing",
10        "RESOURCEPATH": "/opt/senzing/er/resources",
11        "SUPPORTPATH": "/opt/senzing/data",
12    },
13    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
14}
15
16try:
17    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
18    sz_configmanager = sz_abstract_factory.create_configmanager()
19    sz_config = sz_configmanager.create_config_from_template()
20    result = sz_config.unregister_data_source(data_source_code)
21    print(f"\n{result}\n")
22except SzError as err:
23    print(f"\nERROR: {err}\n")

Output:

1// No output from this example.
verify_config_definition(config_definition: str) None[source]

Verify that a Senzing configuration JSON document is valid. This method does not update the internal Senzing configuration. If an error is not thrown, the Senzing configuration JSON is valid.

szconfigmanager

senzing_core.szconfigmanager.SzConfigManagerCore is an implementation of the senzing.szconfigmanager.SzConfigManager interface that communicates with the Senzing binaries.

To use szconfigmanager, the LD_LIBRARY_PATH environment variable must include a path to Senzing’s libraries.

Example:

export LD_LIBRARY_PATH=/opt/senzing/er/lib
class senzing_core.szconfigmanager.SzConfigManagerCore(**kwargs: Any)[source]

Bases: SzConfigManager

Use SzAbstractFactoryCore.create_configmanager() to create an SzConfigManager object. The SzConfigManager object uses the arguments provided to SzAbstractFactoryCore().

Example:

from senzing_core import SzAbstractFactoryCore

sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
sz_config_manager = sz_abstract_factory.create_configmanager()

Args:

Raises:

create_config_from_config_id(config_id: int) SzConfig[source]

The create_config_from_config_id method creates a new SzConfig instance for a configuration ID.

Parameters:

config_id (int) – The configuration identifier of the desired Senzing configuration to retrieve.

Returns:

Represents an in-memory Senzing configuration that can be modified.

Return type:

SzConfig

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_configmanager = sz_abstract_factory.create_configmanager()
18    config_id = sz_configmanager.get_default_config_id()
19    sz_config = sz_configmanager.create_config_from_config_id(config_id)
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

1// No output from this example.
create_config_from_string(config_definition: str) SzConfig[source]

The create_config_from_string method creates a new SzConfig instance from a configuration definition.

Parameters:

config_definition (str) – The Senzing configuration JSON document.

Returns:

Represents an in-memory Senzing configuration that can be modified.

Return type:

SzConfig

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1import json
 2
 3from senzing import SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7config_definition = json.dumps({"G2_CONFIG": {}})
 8instance_name = "Example"
 9settings = {
10    "PIPELINE": {
11        "CONFIGPATH": "/etc/opt/senzing",
12        "RESOURCEPATH": "/opt/senzing/er/resources",
13        "SUPPORTPATH": "/opt/senzing/data",
14    },
15    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
16}
17
18try:
19    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
20    sz_configmanager = sz_abstract_factory.create_configmanager()
21    sz_config = sz_configmanager.create_config_from_string(config_definition)
22except SzError as err:
23    print(f"\nERROR: {err}\n")

Output:

1
create_config_from_template() SzConfig[source]

The create_config_from_template method creates a new SzConfig instance from the template configuration definition.

Parameters:

config_definition (str) – The Senzing configuration JSON document.

Returns:

Represents an in-memory Senzing configuration that can be modified.

Return type:

SzConfig

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_configmanager = sz_abstract_factory.create_configmanager()
18    sz_config = sz_configmanager.create_config_from_template()
19except SzError as err:
20    print(f"\nERROR: {err}\n")

Output:

1// No output from this example.
get_config_registry() str[source]

The get_config_registry method gets the configuration registry.

The registry contains the original timestamp, original comment, and configuration ID of all configurations ever registered with the repository.

Registered configurations cannot be unregistered.

Returns:

A JSON document containing Senzing configurations.

Return type:

str

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_configmanager = sz_abstract_factory.create_configmanager()
18    config_list = sz_configmanager.get_config_registry()
19    print(f"\n{config_list}\n")
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "CONFIGS": [
 5    {
 6      "CONFIG_ID": 2521619849,
 7      "CONFIG_COMMENTS": "New default configuration added by sz_setup_config.",
 8      "SYS_CREATE_DT": "2025-05-20T14:11:59Z"
 9    },
10    {
11      "CONFIG_ID": 2918709094,
12      "CONFIG_COMMENTS": "Updated by sz_configtool",
13      "SYS_CREATE_DT": "2025-05-20T15:28:52Z"
14    }
15  ]
16}
get_default_config_id() int[source]

The get_default_config_id method gets the default configuration ID for the repository.

Unless an explicit configuration ID is specified at initialization, the default configuration ID is used.

This may not be the same as the active configuration ID.

Returns:

The current default configuration ID or zero if the default configuration has not been set.

Return type:

int

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_configmanager = sz_abstract_factory.create_configmanager()
18    config_id = sz_configmanager.get_default_config_id()
19    print(f"\n{config_id}\n")
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

1692503001
help(method_name: str = '') str

The help method returns help for a particular message.

Parameters:

method_name (str) – The name of the method. (e.g. “init”). If empty, a list of methods and descriptions is returned.

Returns:

The Help information about the requested method

Return type:

str

property is_destroyed: bool

Return if the instance has been destroyed.

register_config(config_definition: str, config_comment: str) int[source]

The register_config method registers a configuration definition in the repository.

Registered configurations do not become immediately active nor do they become the default.

Registered configurations cannot be unregistered.

Parameters:
  • config_definition (str) – The Senzing configuration JSON document.

  • config_comment (str) – free-form string of comments describing the configuration document.

Returns:

A configuration identifier.

Return type:

int

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5config_comment = "Just an empty example"
 6instance_name = "Example"
 7settings = {
 8    "PIPELINE": {
 9        "CONFIGPATH": "/etc/opt/senzing",
10        "RESOURCEPATH": "/opt/senzing/er/resources",
11        "SUPPORTPATH": "/opt/senzing/data",
12    },
13    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
14}
15
16
17try:
18    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
19    sz_configmanager = sz_abstract_factory.create_configmanager()
20    sz_config = sz_configmanager.create_config_from_template()
21    config_definition = sz_config.export()
22    config_id = sz_configmanager.register_config(config_definition, config_comment)
23except SzError as err:
24    print(f"\nERROR: {err}\n")

Output:

1// No output from this example.
replace_default_config_id(current_default_config_id: int, new_default_config_id: int) None[source]

The replace_default_config_id method replaces the existing default configuration ID with a new configuration ID.

The change is prevented if the current default configuration ID value is not as expected.

Use this in place of set_default_config_id() to handle race conditions.

Parameters:
  • current_default_config_id (int) – The configuration identifier to replace.

  • new_default_config_id (int) – The configuration identifier to use as the default.

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1import time
 2
 3from senzing import SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7config_comment = "Just an example"
 8data_source_code = f"REPLACE_DEFAULT_CONFIG_ID_{time.time()}"
 9instance_name = "Example"
10settings = {
11    "PIPELINE": {
12        "CONFIGPATH": "/etc/opt/senzing",
13        "RESOURCEPATH": "/opt/senzing/er/resources",
14        "SUPPORTPATH": "/opt/senzing/data",
15    },
16    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
17}
18
19try:
20    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
21    sz_configmanager = sz_abstract_factory.create_configmanager()
22    sz_config = sz_configmanager.create_config_from_template()
23    current_default_config_id = sz_configmanager.get_default_config_id()
24
25    # Create a new config.
26
27    sz_config = sz_configmanager.create_config_from_config_id(current_default_config_id)
28    sz_config.register_data_source(data_source_code)
29
30    # Persist the new config.
31
32    config_definition = sz_config.export()
33    new_default_config_id = sz_configmanager.register_config(config_definition, config_comment)
34
35    # Replace default config id.
36
37    sz_configmanager.replace_default_config_id(current_default_config_id, new_default_config_id)
38except SzError as err:
39    print(f"\nERROR: {err}\n")
set_default_config(config_definition: str, config_comment: str) int[source]

The set_default_config method registers a configuration in the repository and sets its ID as the default for the repository.

Convenience method for register_config() followed by set_default_config_id().

Parameters:
  • config_definition (str) – The Senzing configuration JSON document.

  • config_comment (str) – free-form string of comments describing the configuration document.

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1import time
 2
 3from senzing import SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7config_comment = "Just an example"
 8data_source_code = f"REPLACE_DEFAULT_CONFIG_ID_{time.time()}"
 9instance_name = "Example"
10settings = {
11    "PIPELINE": {
12        "CONFIGPATH": "/etc/opt/senzing",
13        "RESOURCEPATH": "/opt/senzing/er/resources",
14        "SUPPORTPATH": "/opt/senzing/data",
15    },
16    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
17}
18
19try:
20    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
21    sz_configmanager = sz_abstract_factory.create_configmanager()
22
23    # Create a new config.
24
25    sz_config = sz_configmanager.create_config_from_template()
26    sz_config.register_data_source(data_source_code)
27
28    # Persist the new default config.
29
30    config_definition = sz_config.export()
31    config_id = sz_configmanager.set_default_config(config_definition, config_comment)
32    print(config_id)
33except SzError as err:
34    print(f"\nERROR: {err}\n")

Output:

1706203482
set_default_config_id(config_id: int) None[source]

The set_default_config_id method sets the default configuration ID.

Usually this method is sufficient for setting the default configuration ID. However in concurrent environments that could encounter race conditions, consider using replace_default_config_id() instead.

Parameters:

config_id (int) – The configuration identifier of the Senzing Engine configuration to use as the default.

Raises:

TypeError – Incorrect datatype of input parameter.

Example:
 1import time
 2
 3from senzing import SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7config_comment = "Just an example"
 8data_source_code = f"REPLACE_DEFAULT_CONFIG_ID_{time.time()}"
 9instance_name = "Example"
10settings = {
11    "PIPELINE": {
12        "CONFIGPATH": "/etc/opt/senzing",
13        "RESOURCEPATH": "/opt/senzing/er/resources",
14        "SUPPORTPATH": "/opt/senzing/data",
15    },
16    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
17}
18
19try:
20    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
21    sz_configmanager = sz_abstract_factory.create_configmanager()
22
23    # Create a new config.
24
25    sz_config = sz_configmanager.create_config_from_template()
26    sz_config.register_data_source(data_source_code)
27
28    # Persist the new config.
29
30    config_definition = sz_config.export()
31    new_default_config_id = sz_configmanager.register_config(config_definition, config_comment)
32
33    # Set default config id.
34
35    sz_configmanager.set_default_config_id(new_default_config_id)
36except SzError as err:
37    print(f"\nERROR: {err}\n")

szdiagnostic

senzing_core.szdiagnostic.SzDiagnosticCore is an implementation of the senzing.szdiagnostic.SzDiagnostic interface that communicates with the Senzing binaries.

To use szdiagnostic, the LD_LIBRARY_PATH environment variable must include a path to Senzing’s libraries.

Example:

export LD_LIBRARY_PATH=/opt/senzing/er/lib
class senzing_core.szdiagnostic.SzDiagnosticCore(**kwargs: Any)[source]

Bases: SzDiagnostic

Use SzAbstractFactoryCore.create_diagnostic() to create an SzDiagnostic object. The SzDiagnostic object uses the arguments provided to SzAbstractFactoryCore().

Example:

from senzing_core import SzAbstractFactoryCore

sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
sz_diagnostic = sz_abstract_factory.create_diagnostic()

Args:

Raises:

check_repository_performance(seconds_to_run: int) str[source]

The check_repository_performance method conducts a rudimentary repository test to gauge I/O and network performance.

Typically, this is only run when troubleshooting performance.

This is a non-destructive test.

Parameters:

seconds_to_run (int) – Duration of the test in seconds.

Returns:

A string containing a JSON document.

Return type:

str

Raises:
  • TypeError – Incorrect datatype of input parameter.

  • szexception.SzError

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6seconds_to_run = 3
 7settings = {
 8    "PIPELINE": {
 9        "CONFIGPATH": "/etc/opt/senzing",
10        "RESOURCEPATH": "/opt/senzing/er/resources",
11        "SUPPORTPATH": "/opt/senzing/data",
12    },
13    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
14}
15
16try:
17    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
18    sz_diagnostic = sz_abstract_factory.create_diagnostic()
19    result = sz_diagnostic.check_repository_performance(seconds_to_run)
20    print(f"\n{result}\n")
21except SzError as err:
22    print(f"\nERROR: {err}\n")

Output:

1// Output has been formatted for easier reading.
2
3{
4  "numRecordsInserted": 227321,
5  "insertTime": 3000
6}
get_feature(feature_id: int) str[source]

Experimental/internal for Senzing support use only.

get_repository_info() str[source]

The get_repository_info method returns overview information about the repository.

Raises:

szexception.SzError

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_diagnostic = sz_abstract_factory.create_diagnostic()
18    result = sz_diagnostic.get_repository_info()
19    print(f"\n{result}\n")
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "dataStores": [
 5    {
 6      "id": "CORE",
 7      "type": "sqlite3",
 8      "location": "/tmp/sqlite/G2C.db"
 9    }
10  ]
11}
help(method_name: str = '') str

The help method returns help for a particular message.

Parameters:

method_name (str) – The name of the method. (e.g. “init”). If empty, a list of methods and descriptions is returned.

Returns:

The Help information about the requested method

Return type:

str

property is_destroyed: bool

Return if the instance has been destroyed.

purge_repository() None[source]

Warning: The purge_repository method purges all data in the repository, except the configuration.

WARNING: This method is destructive, it will delete all loaded records and entity resolution decisions.

Senzing does not provide a means to restore the data.

The only means of recovery would be restoring from a database backup.

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_diagnostic = sz_abstract_factory.create_diagnostic()
18    # WARNING
19    # WARNING - This will remove all loaded and entity resolved data from the Senzing repository, use with caution!
20    # WARNING - Uncomment the purge_repository() call below to complete a purge
21    # WARNING
22
23    # sz_diagnostic.purge_repository()
24except SzError as err:
25    print(f"\nERROR: {err}\n")

szengine

senzing_core.szengine.SzEngineCore is an implementation of the senzing.szengine.SzEngine interface that communicates with the Senzing binaries.

To use szengine, the LD_LIBRARY_PATH environment variable must include a path to Senzing’s libraries.

Example:

export LD_LIBRARY_PATH=/opt/senzing/er/lib
class senzing_core.szengine.SzEngineCore(**kwargs: Any)[source]

Bases: SzEngine

Use SzAbstractFactoryCore.create_engine() to create an SzEngine object. The SzEngine object uses the arguments provided to SzAbstractFactoryCore().

Example:

from senzing_core import SzAbstractFactoryCore

sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
sz_engine = sz_abstract_factory.create_engine()

Args:

Raises:

add_record(data_source_code: str, record_id: str, record_definition: str, flags: int = <SzEngineFlags.SZ_NO_FLAGS: 0>) str[source]

The add_record method loads a record into the repository and performs entity resolution.

If a record already exists with the same data source code and record ID, it will be replaced.

If the record definition contains DATA_SOURCE and RECORD_ID JSON keys, the values must match the dataSourceCode and recordID parameters.

The data source code must be registered in the active configuration.

Parameters:
  • data_source_code (str) – Identifies the provenance of the data.

  • record_id (str) – The unique identifier within the records of the same data source.

  • record_definition (str) – A JSON document containing the record to be added to the Senzing repository.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_ADD_RECORD_DEFAULT_FLAGS.

Returns:

If flags are set to return the WITH_INFO response a JSON document containing the details, otherwise an empty string.

Return type:

str

Raises:

Example:
 1import json
 2
 3from senzing import SzEngineFlags, SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7data_source_code = "TEST"
 8flags = SzEngineFlags.SZ_WITH_INFO
 9instance_name = "Example"
10record_definition = json.dumps(
11    {
12        "RECORD_TYPE": "PERSON",
13        "PRIMARY_NAME_LAST": "Smith",
14        "PRIMARY_NAME_FIRST": "Robert",
15        "DATE_OF_BIRTH": "12/11/1978",
16        "ADDR_TYPE": "MAILING",
17        "ADDR_LINE1": "123 Main Street, Las Vegas NV 89132",
18        "PHONE_TYPE": "HOME",
19        "PHONE_NUMBER": "702-919-1300",
20        "EMAIL_ADDRESS": "bsmith@work.com",
21        "DATE": "1/2/18",
22        "STATUS": "Active",
23        "AMOUNT": "100",
24    }
25)
26record_id = "1"
27settings = {
28    "PIPELINE": {
29        "CONFIGPATH": "/etc/opt/senzing",
30        "RESOURCEPATH": "/opt/senzing/er/resources",
31        "SUPPORTPATH": "/opt/senzing/data",
32    },
33    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
34}
35
36try:
37    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
38    sz_engine = sz_abstract_factory.create_engine()
39    result = sz_engine.add_record(data_source_code, record_id, record_definition, flags)
40    print(f"\n{result}\n")
41except SzError as err:
42    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "DATA_SOURCE": "TEST",
 5  "RECORD_ID": "1",
 6  "AFFECTED_ENTITIES": [
 7    {
 8      "ENTITY_ID": 1
 9    },
10    {
11      "ENTITY_ID": 35
12    }
13  ]
14}
close_export_report(export_handle: int) None[source]

The close_export_report method closes an export report.

Used in conjunction with export_json_entity_report(), export_csv_entity_report(), and fetch_next().

Parameters:

export_handle (int) – A handle created by export_json_entity_report or export_csv_entity_report.

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5flags = SzEngineFlags.SZ_EXPORT_DEFAULT_FLAGS
 6instance_name = "Example"
 7settings = {
 8    "PIPELINE": {
 9        "CONFIGPATH": "/etc/opt/senzing",
10        "RESOURCEPATH": "/opt/senzing/er/resources",
11        "SUPPORTPATH": "/opt/senzing/data",
12    },
13    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
14}
15
16try:
17    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
18    sz_engine = sz_abstract_factory.create_engine()
19    export_handle = sz_engine.export_json_entity_report(flags)
20    while True:
21        fragment = sz_engine.fetch_next(export_handle)
22        if not fragment:
23            break
24        print(fragment, end="")
25    sz_engine.close_export_report(export_handle)
26except SzError as err:
27    print(f"\nERROR: {err}\n")

Output:

1{"RESOLVED_ENTITY":{"ENTITY_ID":1,"ENTITY_NAME":"","FEATURES":{},"RECORD_SUMMARY":[{"DATA_SOURCE":"TEST","RECORD_COUNT":1}],"RECORDS":[{"DATA_SOURCE":"TEST","RECORD_ID":"2","INTERNAL_ID":1,"MATCH_KEY":"","MATCH_LEVEL_CODE":"","ERRULE_CODE":"","FIRST_SEEN_DT":"2024-10-25T17:38:57Z","LAST_SEEN_DT":"2024-10-25T17:38:57Z"}]},"RELATED_ENTITIES":[]}
2{"RESOLVED_ENTITY":{"ENTITY_ID":35,"ENTITY_NAME":"Robert Smith","FEATURES":{"ADDRESS":[{"FEAT_DESC":"1515 Adela Lane Las Vegas NV 89111","LIB_FEAT_ID":22,"USAGE_TYPE":"HOME","FEAT_DESC_VALUES":[{"FEAT_DESC":"1515 Adela Lane Las Vegas NV 89111","LIB_FEAT_ID":22}]},{"FEAT_DESC":"123 Main Street, Las Vegas NV 89132","LIB_FEAT_ID":3,"USAGE_TYPE":"MAILING","FEAT_DESC_VALUES":[{"FEAT_DESC":"123 Main Street, Las Vegas NV 89132","LIB_FEAT_ID":3}]}],"DOB":[{"FEAT_DESC":"12/11/1978","LIB_FEAT_ID":2,"FEAT_DESC_VALUES":[{"FEAT_DESC":"12/11/1978","LIB_FEAT_ID":2},{"FEAT_DESC":"11/12/1978","LIB_FEAT_ID":21}]}],"EMAIL":[{"FEAT_DESC":"bsmith@work.com","LIB_FEAT_ID":5,"FEAT_DESC_VALUES":[{"FEAT_DESC":"bsmith@work.com","LIB_FEAT_ID":5}]}],"NAME":[{"FEAT_DESC":"Robert Smith","LIB_FEAT_ID":1,"USAGE_TYPE":"PRIMARY","FEAT_DESC_VALUES":[{"FEAT_DESC":"Robert Smith","LIB_FEAT_ID":1},{"FEAT_DESC":"Bob J Smith","LIB_FEAT_ID":38},{"FEAT_DESC":"Bob Smith","LIB_FEAT_ID":20}]}],"PHONE":[{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4,"USAGE_TYPE":"HOME","FEAT_DESC_VALUES":[{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4}]},{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4,"USAGE_TYPE":"MOBILE","FEAT_DESC_VALUES":[{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4}]}],"RECORD_TYPE":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10,"FEAT_DESC_VALUES":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10}]}]},"RECORD_SUMMARY":[{"DATA_SOURCE":"CUSTOMERS","RECORD_COUNT":3}],"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1001","INTERNAL_ID":35,"MATCH_KEY":"","MATCH_LEVEL_CODE":"","ERRULE_CODE":"","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"},{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1002","INTERNAL_ID":36,"MATCH_KEY":"+NAME+DOB+PHONE","MATCH_LEVEL_CODE":"RESOLVED","ERRULE_CODE":"CNAME_CFF_CEXCL","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"},{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1003","INTERNAL_ID":37,"MATCH_KEY":"+NAME+DOB+EMAIL","MATCH_LEVEL_CODE":"RESOLVED","ERRULE_CODE":"SF1_PNAME_CSTAB","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"}]},"RELATED_ENTITIES":[]}
3{"RESOLVED_ENTITY":{"ENTITY_ID":38,"ENTITY_NAME":"Edward Kusha","FEATURES":{"ADDRESS":[{"FEAT_DESC":"1304 Poppy Hills Dr Blacklick OH 43004","LIB_FEAT_ID":46,"USAGE_TYPE":"HOME","FEAT_DESC_VALUES":[{"FEAT_DESC":"1304 Poppy Hills Dr Blacklick OH 43004","LIB_FEAT_ID":46}]}],"DOB":[{"FEAT_DESC":"3/1/1970","LIB_FEAT_ID":45,"FEAT_DESC_VALUES":[{"FEAT_DESC":"3/1/1970","LIB_FEAT_ID":45}]}],"EMAIL":[{"FEAT_DESC":"Kusha123@hmail.com","LIB_FEAT_ID":48,"FEAT_DESC_VALUES":[{"FEAT_DESC":"Kusha123@hmail.com","LIB_FEAT_ID":48}]}],"NAME":[{"FEAT_DESC":"Edward Kusha","LIB_FEAT_ID":44,"USAGE_TYPE":"PRIMARY","FEAT_DESC_VALUES":[{"FEAT_DESC":"Edward Kusha","LIB_FEAT_ID":44}]}],"RECORD_TYPE":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10,"FEAT_DESC_VALUES":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10}]}],"SSN":[{"FEAT_DESC":"294-66-9999","LIB_FEAT_ID":47,"FEAT_DESC_VALUES":[{"FEAT_DESC":"294-66-9999","LIB_FEAT_ID":47}]}]},"RECORD_SUMMARY":[{"DATA_SOURCE":"CUSTOMERS","RECORD_COUNT":1}],"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1009","INTERNAL_ID":38,"MATCH_KEY":"","MATCH_LEVEL_CODE":"","ERRULE_CODE":"","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"}]},"RELATED_ENTITIES":[]}
count_redo_records() int[source]

The count_redo_records method gets the number of redo records pending processing.

Returns:

The number of redo records in Senzing’s redo queue.

Return type:

int

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_engine = sz_abstract_factory.create_engine()
18    result = sz_engine.count_redo_records()
19    print(f"\n{result}\n")
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

12
delete_record(data_source_code: str, record_id: str, flags: int = <SzEngineFlags.SZ_NO_FLAGS: 0>) str[source]

The delete_record method deletes a record from the repository and performs entity resolution.

The data source code must be registered in the active configuration.

Is idempotent.

Parameters:
  • data_source_code (str) – Identifies the provenance of the data.

  • record_id (str) – The unique identifier within the records of the same data source.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_DELETE_RECORD_DEFAULT_FLAGS.

Returns:

If flags are set to return the WITH_INFO response a JSON document containing the details, otherwise an empty string.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5data_source_code = "TEST"
 6flags = SzEngineFlags.SZ_WITH_INFO
 7instance_name = "Example"
 8record_id = "1"
 9settings = {
10    "PIPELINE": {
11        "CONFIGPATH": "/etc/opt/senzing",
12        "RESOURCEPATH": "/opt/senzing/er/resources",
13        "SUPPORTPATH": "/opt/senzing/data",
14    },
15    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
16}
17
18try:
19    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
20    sz_engine = sz_abstract_factory.create_engine()
21    result = sz_engine.delete_record(data_source_code, record_id, flags)
22    print(f"\n{result}\n")
23except SzError as err:
24    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "DATA_SOURCE": "TEST",
 5  "RECORD_ID": "1",
 6  "AFFECTED_ENTITIES": [
 7    {
 8      "ENTITY_ID": 35
 9    }
10  ],
11}
export_csv_entity_report(csv_column_list: str, flags: int = <SzEngineFlags.SZ_EXPORT_DEFAULT_FLAGS: 3734497>) int[source]

The export_csv_entity_report method initiates an export report of entity data in CSV format.

Used in conjunction with fetch_next() and close_entity_report().

The first fetch_next() call, after calling this method, returns the CSV header.

Subsequent fetch_next() calls return exported entity data in CSV format.

Use with large repositories is not advised.

Parameters:
  • csv_column_list (str) – A comma-separated list of column names for the CSV export.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_EXPORT_DEFAULT_FLAGS.

Returns:

A handle that identifies the document to be scrolled through using fetch_next.

Return type:

int

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5csv_column_list = (
 6    "RESOLVED_ENTITY_ID,RELATED_ENTITY_ID,RESOLVED_ENTITY_NAME,MATCH_LEVEL,MATCH_KEY,DATA_SOURCE,RECORD_ID"
 7)
 8flags = SzEngineFlags.SZ_EXPORT_DEFAULT_FLAGS
 9instance_name = "Example"
10settings = {
11    "PIPELINE": {
12        "CONFIGPATH": "/etc/opt/senzing",
13        "RESOURCEPATH": "/opt/senzing/er/resources",
14        "SUPPORTPATH": "/opt/senzing/data",
15    },
16    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
17}
18
19try:
20    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
21    sz_engine = sz_abstract_factory.create_engine()
22    export_handle = sz_engine.export_csv_entity_report(csv_column_list, flags)
23    while True:
24        fragment = sz_engine.fetch_next(export_handle)
25        if not fragment:
26            break
27        print(fragment, end="")
28    sz_engine.close_export_report(export_handle)
29except SzError as err:
30    print(f"\nERROR: {err}\n")

Output:

1RESOLVED_ENTITY_ID,RESOLVED_ENTITY_NAME,RELATED_ENTITY_ID,MATCH_LEVEL,MATCH_KEY,DATA_SOURCE,RECORD_ID
21,"",0,0,"","TEST","2"
335,"Robert Smith",0,0,"","CUSTOMERS","1001"
435,"Robert Smith",0,1,"+NAME+DOB+PHONE","CUSTOMERS","1002"
535,"Robert Smith",0,1,"+NAME+DOB+EMAIL","CUSTOMERS","1003"
638,"Edward Kusha",0,0,"","CUSTOMERS","1009"
export_json_entity_report(flags: int = <SzEngineFlags.SZ_EXPORT_DEFAULT_FLAGS: 3734497>) int[source]

The export_json_entity_report method initiates an export report of entity data in JSON Lines format.

Used in conjunction with fetch_next() and close_entity_report().

Each fetch_next() call returns exported entity data as a JSON object.

Use with large repositories is not advised.

Parameters:

flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_EXPORT_DEFAULT_FLAGS.

Returns:

A handle that identifies the document to be scrolled through using fetch_next.

Return type:

int

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5flags = SzEngineFlags.SZ_EXPORT_DEFAULT_FLAGS
 6instance_name = "Example"
 7settings = {
 8    "PIPELINE": {
 9        "CONFIGPATH": "/etc/opt/senzing",
10        "RESOURCEPATH": "/opt/senzing/er/resources",
11        "SUPPORTPATH": "/opt/senzing/data",
12    },
13    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
14}
15
16try:
17    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
18    sz_engine = sz_abstract_factory.create_engine()
19    export_handle = sz_engine.export_json_entity_report(flags)
20    while True:
21        fragment = sz_engine.fetch_next(export_handle)
22        if not fragment:
23            break
24        print(fragment, end="")
25    sz_engine.close_export_report(export_handle)
26except SzError as err:
27    print(f"\nERROR: {err}\n")

Output:

1{"RESOLVED_ENTITY":{"ENTITY_ID":1,"ENTITY_NAME":"","FEATURES":{},"RECORD_SUMMARY":[{"DATA_SOURCE":"TEST","RECORD_COUNT":1}],"RECORDS":[{"DATA_SOURCE":"TEST","RECORD_ID":"2","INTERNAL_ID":1,"MATCH_KEY":"","MATCH_LEVEL_CODE":"","ERRULE_CODE":"","FIRST_SEEN_DT":"2024-10-25T17:38:57Z","LAST_SEEN_DT":"2024-10-25T17:38:57Z"}]},"RELATED_ENTITIES":[]}
2{"RESOLVED_ENTITY":{"ENTITY_ID":35,"ENTITY_NAME":"Robert Smith","FEATURES":{"ADDRESS":[{"FEAT_DESC":"1515 Adela Lane Las Vegas NV 89111","LIB_FEAT_ID":22,"USAGE_TYPE":"HOME","FEAT_DESC_VALUES":[{"FEAT_DESC":"1515 Adela Lane Las Vegas NV 89111","LIB_FEAT_ID":22}]},{"FEAT_DESC":"123 Main Street, Las Vegas NV 89132","LIB_FEAT_ID":3,"USAGE_TYPE":"MAILING","FEAT_DESC_VALUES":[{"FEAT_DESC":"123 Main Street, Las Vegas NV 89132","LIB_FEAT_ID":3}]}],"DOB":[{"FEAT_DESC":"12/11/1978","LIB_FEAT_ID":2,"FEAT_DESC_VALUES":[{"FEAT_DESC":"12/11/1978","LIB_FEAT_ID":2},{"FEAT_DESC":"11/12/1978","LIB_FEAT_ID":21}]}],"EMAIL":[{"FEAT_DESC":"bsmith@work.com","LIB_FEAT_ID":5,"FEAT_DESC_VALUES":[{"FEAT_DESC":"bsmith@work.com","LIB_FEAT_ID":5}]}],"NAME":[{"FEAT_DESC":"Robert Smith","LIB_FEAT_ID":1,"USAGE_TYPE":"PRIMARY","FEAT_DESC_VALUES":[{"FEAT_DESC":"Robert Smith","LIB_FEAT_ID":1},{"FEAT_DESC":"Bob J Smith","LIB_FEAT_ID":38},{"FEAT_DESC":"Bob Smith","LIB_FEAT_ID":20}]}],"PHONE":[{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4,"USAGE_TYPE":"HOME","FEAT_DESC_VALUES":[{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4}]},{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4,"USAGE_TYPE":"MOBILE","FEAT_DESC_VALUES":[{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4}]}],"RECORD_TYPE":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10,"FEAT_DESC_VALUES":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10}]}]},"RECORD_SUMMARY":[{"DATA_SOURCE":"CUSTOMERS","RECORD_COUNT":3}],"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1001","INTERNAL_ID":35,"MATCH_KEY":"","MATCH_LEVEL_CODE":"","ERRULE_CODE":"","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"},{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1002","INTERNAL_ID":36,"MATCH_KEY":"+NAME+DOB+PHONE","MATCH_LEVEL_CODE":"RESOLVED","ERRULE_CODE":"CNAME_CFF_CEXCL","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"},{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1003","INTERNAL_ID":37,"MATCH_KEY":"+NAME+DOB+EMAIL","MATCH_LEVEL_CODE":"RESOLVED","ERRULE_CODE":"SF1_PNAME_CSTAB","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"}]},"RELATED_ENTITIES":[]}
3{"RESOLVED_ENTITY":{"ENTITY_ID":38,"ENTITY_NAME":"Edward Kusha","FEATURES":{"ADDRESS":[{"FEAT_DESC":"1304 Poppy Hills Dr Blacklick OH 43004","LIB_FEAT_ID":46,"USAGE_TYPE":"HOME","FEAT_DESC_VALUES":[{"FEAT_DESC":"1304 Poppy Hills Dr Blacklick OH 43004","LIB_FEAT_ID":46}]}],"DOB":[{"FEAT_DESC":"3/1/1970","LIB_FEAT_ID":45,"FEAT_DESC_VALUES":[{"FEAT_DESC":"3/1/1970","LIB_FEAT_ID":45}]}],"EMAIL":[{"FEAT_DESC":"Kusha123@hmail.com","LIB_FEAT_ID":48,"FEAT_DESC_VALUES":[{"FEAT_DESC":"Kusha123@hmail.com","LIB_FEAT_ID":48}]}],"NAME":[{"FEAT_DESC":"Edward Kusha","LIB_FEAT_ID":44,"USAGE_TYPE":"PRIMARY","FEAT_DESC_VALUES":[{"FEAT_DESC":"Edward Kusha","LIB_FEAT_ID":44}]}],"RECORD_TYPE":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10,"FEAT_DESC_VALUES":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10}]}],"SSN":[{"FEAT_DESC":"294-66-9999","LIB_FEAT_ID":47,"FEAT_DESC_VALUES":[{"FEAT_DESC":"294-66-9999","LIB_FEAT_ID":47}]}]},"RECORD_SUMMARY":[{"DATA_SOURCE":"CUSTOMERS","RECORD_COUNT":1}],"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1009","INTERNAL_ID":38,"MATCH_KEY":"","MATCH_LEVEL_CODE":"","ERRULE_CODE":"","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"}]},"RELATED_ENTITIES":[]}
fetch_next(export_handle: int) str[source]

The fetch_next method fetches the next line of entity data from an open export report.

Used in conjunction with export_json_entity_report(), export_csv_entity_report(), and close_entity_report().

If the export handle was obtained from export_csv_entity_report(), this returns the CSV header on the first call and exported entity data in CSV format on subsequent calls.

If the export handle was obtained from export_json_entity_report(), this returns exported entity data as a JSON object.

When None is returned, the export report is complete and the caller should invoke close_entity_report() to free resources.

Parameters:

export_handle (int) – A handle created by export_json_entity_report or export_json_entity_report.

Returns:

TODO:

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5flags = SzEngineFlags.SZ_EXPORT_DEFAULT_FLAGS
 6instance_name = "Example"
 7settings = {
 8    "PIPELINE": {
 9        "CONFIGPATH": "/etc/opt/senzing",
10        "RESOURCEPATH": "/opt/senzing/er/resources",
11        "SUPPORTPATH": "/opt/senzing/data",
12    },
13    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
14}
15
16try:
17    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
18    sz_engine = sz_abstract_factory.create_engine()
19    export_handle = sz_engine.export_json_entity_report(flags)
20    while True:
21        fragment = sz_engine.fetch_next(export_handle)
22        if not fragment:
23            break
24        print(fragment, end="")
25    sz_engine.close_export_report(export_handle)
26except SzError as err:
27    print(f"\nERROR: {err}\n")

Output:

1{"RESOLVED_ENTITY":{"ENTITY_ID":1,"ENTITY_NAME":"","FEATURES":{},"RECORD_SUMMARY":[{"DATA_SOURCE":"TEST","RECORD_COUNT":1}],"RECORDS":[{"DATA_SOURCE":"TEST","RECORD_ID":"2","INTERNAL_ID":1,"MATCH_KEY":"","MATCH_LEVEL_CODE":"","ERRULE_CODE":"","FIRST_SEEN_DT":"2024-10-25T17:38:57Z","LAST_SEEN_DT":"2024-10-25T17:38:57Z"}]},"RELATED_ENTITIES":[]}
2{"RESOLVED_ENTITY":{"ENTITY_ID":35,"ENTITY_NAME":"Robert Smith","FEATURES":{"ADDRESS":[{"FEAT_DESC":"1515 Adela Lane Las Vegas NV 89111","LIB_FEAT_ID":22,"USAGE_TYPE":"HOME","FEAT_DESC_VALUES":[{"FEAT_DESC":"1515 Adela Lane Las Vegas NV 89111","LIB_FEAT_ID":22}]},{"FEAT_DESC":"123 Main Street, Las Vegas NV 89132","LIB_FEAT_ID":3,"USAGE_TYPE":"MAILING","FEAT_DESC_VALUES":[{"FEAT_DESC":"123 Main Street, Las Vegas NV 89132","LIB_FEAT_ID":3}]}],"DOB":[{"FEAT_DESC":"12/11/1978","LIB_FEAT_ID":2,"FEAT_DESC_VALUES":[{"FEAT_DESC":"12/11/1978","LIB_FEAT_ID":2},{"FEAT_DESC":"11/12/1978","LIB_FEAT_ID":21}]}],"EMAIL":[{"FEAT_DESC":"bsmith@work.com","LIB_FEAT_ID":5,"FEAT_DESC_VALUES":[{"FEAT_DESC":"bsmith@work.com","LIB_FEAT_ID":5}]}],"NAME":[{"FEAT_DESC":"Robert Smith","LIB_FEAT_ID":1,"USAGE_TYPE":"PRIMARY","FEAT_DESC_VALUES":[{"FEAT_DESC":"Robert Smith","LIB_FEAT_ID":1},{"FEAT_DESC":"Bob J Smith","LIB_FEAT_ID":38},{"FEAT_DESC":"Bob Smith","LIB_FEAT_ID":20}]}],"PHONE":[{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4,"USAGE_TYPE":"HOME","FEAT_DESC_VALUES":[{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4}]},{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4,"USAGE_TYPE":"MOBILE","FEAT_DESC_VALUES":[{"FEAT_DESC":"702-919-1300","LIB_FEAT_ID":4}]}],"RECORD_TYPE":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10,"FEAT_DESC_VALUES":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10}]}]},"RECORD_SUMMARY":[{"DATA_SOURCE":"CUSTOMERS","RECORD_COUNT":3}],"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1001","INTERNAL_ID":35,"MATCH_KEY":"","MATCH_LEVEL_CODE":"","ERRULE_CODE":"","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"},{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1002","INTERNAL_ID":36,"MATCH_KEY":"+NAME+DOB+PHONE","MATCH_LEVEL_CODE":"RESOLVED","ERRULE_CODE":"CNAME_CFF_CEXCL","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"},{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1003","INTERNAL_ID":37,"MATCH_KEY":"+NAME+DOB+EMAIL","MATCH_LEVEL_CODE":"RESOLVED","ERRULE_CODE":"SF1_PNAME_CSTAB","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"}]},"RELATED_ENTITIES":[]}
3{"RESOLVED_ENTITY":{"ENTITY_ID":38,"ENTITY_NAME":"Edward Kusha","FEATURES":{"ADDRESS":[{"FEAT_DESC":"1304 Poppy Hills Dr Blacklick OH 43004","LIB_FEAT_ID":46,"USAGE_TYPE":"HOME","FEAT_DESC_VALUES":[{"FEAT_DESC":"1304 Poppy Hills Dr Blacklick OH 43004","LIB_FEAT_ID":46}]}],"DOB":[{"FEAT_DESC":"3/1/1970","LIB_FEAT_ID":45,"FEAT_DESC_VALUES":[{"FEAT_DESC":"3/1/1970","LIB_FEAT_ID":45}]}],"EMAIL":[{"FEAT_DESC":"Kusha123@hmail.com","LIB_FEAT_ID":48,"FEAT_DESC_VALUES":[{"FEAT_DESC":"Kusha123@hmail.com","LIB_FEAT_ID":48}]}],"NAME":[{"FEAT_DESC":"Edward Kusha","LIB_FEAT_ID":44,"USAGE_TYPE":"PRIMARY","FEAT_DESC_VALUES":[{"FEAT_DESC":"Edward Kusha","LIB_FEAT_ID":44}]}],"RECORD_TYPE":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10,"FEAT_DESC_VALUES":[{"FEAT_DESC":"PERSON","LIB_FEAT_ID":10}]}],"SSN":[{"FEAT_DESC":"294-66-9999","LIB_FEAT_ID":47,"FEAT_DESC_VALUES":[{"FEAT_DESC":"294-66-9999","LIB_FEAT_ID":47}]}]},"RECORD_SUMMARY":[{"DATA_SOURCE":"CUSTOMERS","RECORD_COUNT":1}],"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":"1009","INTERNAL_ID":38,"MATCH_KEY":"","MATCH_LEVEL_CODE":"","ERRULE_CODE":"","FIRST_SEEN_DT":"2024-10-25T17:39:00Z","LAST_SEEN_DT":"2024-10-25T17:39:00Z"}]},"RELATED_ENTITIES":[]}
find_interesting_entities_by_entity_id(entity_id: int, flags: int = <SzEngineFlags.SZ_NO_FLAGS: 0>) str[source]

Experimental method.

Contact Senzing support.

find_interesting_entities_by_record_id(data_source_code: str, record_id: str, flags: int = <SzEngineFlags.SZ_NO_FLAGS: 0>) str[source]

Experimental method.

Contact Senzing support.

find_network_by_entity_id(entity_ids: ~typing.List[int], max_degrees: int, build_out_degrees: int, build_out_max_entities: int, flags: int = <SzEngineFlags.SZ_FIND_NETWORK_DEFAULT_FLAGS: 8589946880>) str[source]

The find_network_by_entity_id method retrieves a network of relationships among entities, specified by entity IDs.

Warning: Entity networks may be very large due to the volume of inter-related data in the repository. The parameters of this method can be used to limit the information returned.

Parameters:
  • entity_ids (list(int)) – The entity IDs to find the network between.

  • max_degrees (int) – The maximum number of degrees in paths between search entities.

  • build_out_degrees (int) – The number of degrees of relationships to show around each search entity.

  • build_out_max_entities (int) – The maximum number of entities to return in the discovered network.

  • flags (int, optional) – The maximum number of entities to return in the discovered network. Defaults to SzEngineFlags.SZ_FIND_NETWORK_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5build_out_degrees = 1
 6build_out_max_entities = 10
 7entity_list = [1, 4]
 8flags = SzEngineFlags.SZ_FIND_NETWORK_DEFAULT_FLAGS
 9instance_name = "Example"
10max_degrees = 2
11settings = {
12    "PIPELINE": {
13        "CONFIGPATH": "/etc/opt/senzing",
14        "RESOURCEPATH": "/opt/senzing/er/resources",
15        "SUPPORTPATH": "/opt/senzing/data",
16    },
17    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
18}
19
20try:
21    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
22    sz_engine = sz_abstract_factory.create_engine()
23    result = sz_engine.find_network_by_entity_id(
24        entity_list, max_degrees, build_out_degrees, build_out_max_entities, flags
25    )
26    print(f"\n{result}\n")
27except SzError as err:
28    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "ENTITY_PATHS": [
  5    {
  6      "START_ENTITY_ID": 1,
  7      "END_ENTITY_ID": 400018,
  8      "ENTITIES": []
  9    }
 10  ],
 11  "ENTITY_NETWORK_LINKS": [
 12    {
 13      "MIN_ENTITY_ID": 1,
 14      "MAX_ENTITY_ID": 400015,
 15      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
 16      "MATCH_KEY": "+NAME+ADDRESS-DOB",
 17      "ERRULE_CODE": "CNAME_CFF_DEXCL",
 18      "IS_DISCLOSED": 0,
 19      "IS_AMBIGUOUS": 0
 20    },
 21    {
 22      "MIN_ENTITY_ID": 1,
 23      "MAX_ENTITY_ID": 400204,
 24      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
 25      "MATCH_KEY": "+NAME",
 26      "ERRULE_CODE": "SNAME",
 27      "IS_DISCLOSED": 0,
 28      "IS_AMBIGUOUS": 0
 29    },
 30    {
 31      "MIN_ENTITY_ID": 1,
 32      "MAX_ENTITY_ID": 400215,
 33      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 34      "MATCH_KEY": "+ADDRESS+SURNAME",
 35      "ERRULE_CODE": "CFF_SURNAME",
 36      "IS_DISCLOSED": 0,
 37      "IS_AMBIGUOUS": 0
 38    },
 39    {
 40      "MIN_ENTITY_ID": 400002,
 41      "MAX_ENTITY_ID": 400018,
 42      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 43      "MATCH_KEY": "+ADDRESS+EMAIL+SURNAME-DOB-SSN",
 44      "ERRULE_CODE": "SF1",
 45      "IS_DISCLOSED": 0,
 46      "IS_AMBIGUOUS": 0
 47    },
 48    {
 49      "MIN_ENTITY_ID": 400002,
 50      "MAX_ENTITY_ID": 400020,
 51      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 52      "MATCH_KEY": "+ADDRESS+EMAIL+PNAME-DOB",
 53      "ERRULE_CODE": "SF1",
 54      "IS_DISCLOSED": 0,
 55      "IS_AMBIGUOUS": 0
 56    },
 57    {
 58      "MIN_ENTITY_ID": 400002,
 59      "MAX_ENTITY_ID": 400022,
 60      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 61      "MATCH_KEY": "+ADDRESS+EMAIL+SURNAME-DOB-SSN",
 62      "ERRULE_CODE": "SF1",
 63      "IS_DISCLOSED": 0,
 64      "IS_AMBIGUOUS": 0
 65    },
 66    {
 67      "MIN_ENTITY_ID": 400015,
 68      "MAX_ENTITY_ID": 400204,
 69      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
 70      "MATCH_KEY": "+NAME",
 71      "ERRULE_CODE": "SNAME",
 72      "IS_DISCLOSED": 0,
 73      "IS_AMBIGUOUS": 0
 74    },
 75    {
 76      "MIN_ENTITY_ID": 400018,
 77      "MAX_ENTITY_ID": 400020,
 78      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 79      "MATCH_KEY": "+ADDRESS+EMAIL+SURNAME-DOB",
 80      "ERRULE_CODE": "SF1",
 81      "IS_DISCLOSED": 0,
 82      "IS_AMBIGUOUS": 0
 83    },
 84    {
 85      "MIN_ENTITY_ID": 400018,
 86      "MAX_ENTITY_ID": 400022,
 87      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 88      "MATCH_KEY": "+ADDRESS+EMAIL+SURNAME-DOB-SSN",
 89      "ERRULE_CODE": "SF1",
 90      "IS_DISCLOSED": 0,
 91      "IS_AMBIGUOUS": 0
 92    },
 93    {
 94      "MIN_ENTITY_ID": 400020,
 95      "MAX_ENTITY_ID": 400022,
 96      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 97      "MATCH_KEY": "+DOB+ADDRESS+EMAIL+SURNAME",
 98      "ERRULE_CODE": "SF1",
 99      "IS_DISCLOSED": 0,
100      "IS_AMBIGUOUS": 0
101    }
102  ],
103  "ENTITIES": [
104    {
105      "RESOLVED_ENTITY": {
106        "ENTITY_ID": 1,
107        "ENTITY_NAME": "Robert Smith",
108        "RECORD_SUMMARY": [
109          {
110            "DATA_SOURCE": "TEST",
111            "RECORD_COUNT": 1
112          },
113          {
114            "DATA_SOURCE": "CUSTOMERS",
115            "RECORD_COUNT": 4
116          }
117        ]
118      }
119    },
120    {
121      "RESOLVED_ENTITY": {
122        "ENTITY_ID": 400002,
123        "ENTITY_NAME": "Marie Kusha",
124        "RECORD_SUMMARY": [
125          {
126            "DATA_SOURCE": "CUSTOMERS",
127            "RECORD_COUNT": 4
128          }
129        ]
130      }
131    },
132    {
133      "RESOLVED_ENTITY": {
134        "ENTITY_ID": 400015,
135        "ENTITY_NAME": "Robert E Smith Sr",
136        "RECORD_SUMMARY": [
137          {
138            "DATA_SOURCE": "CUSTOMERS",
139            "RECORD_COUNT": 1
140          },
141          {
142            "DATA_SOURCE": "WATCHLIST",
143            "RECORD_COUNT": 1
144          }
145        ]
146      }
147    },
148    {
149      "RESOLVED_ENTITY": {
150        "ENTITY_ID": 400018,
151        "ENTITY_NAME": "Eddie Kusha",
152        "RECORD_SUMMARY": [
153          {
154            "DATA_SOURCE": "CUSTOMERS",
155            "RECORD_COUNT": 3
156          },
157          {
158            "DATA_SOURCE": "WATCHLIST",
159            "RECORD_COUNT": 2
160          }
161        ]
162      }
163    },
164    {
165      "RESOLVED_ENTITY": {
166        "ENTITY_ID": 400020,
167        "ENTITY_NAME": "Mark Kusha",
168        "RECORD_SUMMARY": [
169          {
170            "DATA_SOURCE": "CUSTOMERS",
171            "RECORD_COUNT": 1
172          }
173        ]
174      }
175    },
176    {
177      "RESOLVED_ENTITY": {
178        "ENTITY_ID": 400022,
179        "ENTITY_NAME": "Marsha Kusha",
180        "RECORD_SUMMARY": [
181          {
182            "DATA_SOURCE": "CUSTOMERS",
183            "RECORD_COUNT": 1
184          },
185          {
186            "DATA_SOURCE": "WATCHLIST",
187            "RECORD_COUNT": 1
188          }
189        ]
190      }
191    },
192    {
193      "RESOLVED_ENTITY": {
194        "ENTITY_ID": 400204,
195        "ENTITY_NAME": "Robert Smith",
196        "RECORD_SUMMARY": [
197          {
198            "DATA_SOURCE": "WATCHLIST",
199            "RECORD_COUNT": 1
200          }
201        ]
202      }
203    },
204    {
205      "RESOLVED_ENTITY": {
206        "ENTITY_ID": 400215,
207        "ENTITY_NAME": "Patricia Smith",
208        "RECORD_SUMMARY": [
209          {
210            "DATA_SOURCE": "WATCHLIST",
211            "RECORD_COUNT": 1
212          }
213        ]
214      }
215    }
216  ]
217}
find_network_by_record_id(record_keys: ~typing.List[~typing.Tuple[str, str]], max_degrees: int, build_out_degrees: int, build_out_max_entities: int, flags: int = <SzEngineFlags.SZ_FIND_NETWORK_DEFAULT_FLAGS: 8589946880>) str[source]

The find_network_by_record_id method retrieves a network of relationships among entities, specified by record IDs.

Warning: Entity networks may be very large due to the volume of inter-related data in the repository. The parameters of this method can be used to limit the information returned.

Parameters:
  • record_keys (list(tuple(str, str))) – The data source codes and record IDs to find the network between.

  • max_degrees (int) – The maximum number of degrees in paths between search entities.

  • build_out_degrees (int) – The number of degrees of relationships to show around each search entity.

  • build_out_max_entities (int) – The maximum number of entities to return in the discovered network.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_FIND_NETWORK_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5build_out_degrees = 1
 6build_out_max_entities = 10
 7flags = SzEngineFlags.SZ_FIND_NETWORK_DEFAULT_FLAGS
 8instance_name = "Example"
 9max_degrees = 2
10record_list = [("CUSTOMERS", "1001"), ("CUSTOMERS", "1009")]
11settings = {
12    "PIPELINE": {
13        "CONFIGPATH": "/etc/opt/senzing",
14        "RESOURCEPATH": "/opt/senzing/er/resources",
15        "SUPPORTPATH": "/opt/senzing/data",
16    },
17    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
18}
19
20try:
21    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
22    sz_engine = sz_abstract_factory.create_engine()
23    result = sz_engine.find_network_by_record_id(
24        record_list, max_degrees, build_out_degrees, build_out_max_entities, flags
25    )
26    print(f"\n{result}\n")
27except SzError as err:
28    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "ENTITY_PATHS": [
  5    {
  6      "START_ENTITY_ID": 1,
  7      "END_ENTITY_ID": 400018,
  8      "ENTITIES": []
  9    }
 10  ],
 11  "ENTITY_NETWORK_LINKS": [
 12    {
 13      "MIN_ENTITY_ID": 1,
 14      "MAX_ENTITY_ID": 400015,
 15      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
 16      "MATCH_KEY": "+NAME+ADDRESS-DOB",
 17      "ERRULE_CODE": "CNAME_CFF_DEXCL",
 18      "IS_DISCLOSED": 0,
 19      "IS_AMBIGUOUS": 0
 20    },
 21    {
 22      "MIN_ENTITY_ID": 1,
 23      "MAX_ENTITY_ID": 400204,
 24      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
 25      "MATCH_KEY": "+NAME",
 26      "ERRULE_CODE": "SNAME",
 27      "IS_DISCLOSED": 0,
 28      "IS_AMBIGUOUS": 0
 29    },
 30    {
 31      "MIN_ENTITY_ID": 1,
 32      "MAX_ENTITY_ID": 400215,
 33      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 34      "MATCH_KEY": "+ADDRESS+SURNAME",
 35      "ERRULE_CODE": "CFF_SURNAME",
 36      "IS_DISCLOSED": 0,
 37      "IS_AMBIGUOUS": 0
 38    },
 39    {
 40      "MIN_ENTITY_ID": 400002,
 41      "MAX_ENTITY_ID": 400018,
 42      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 43      "MATCH_KEY": "+ADDRESS+EMAIL+SURNAME-DOB-SSN",
 44      "ERRULE_CODE": "SF1",
 45      "IS_DISCLOSED": 0,
 46      "IS_AMBIGUOUS": 0
 47    },
 48    {
 49      "MIN_ENTITY_ID": 400002,
 50      "MAX_ENTITY_ID": 400020,
 51      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 52      "MATCH_KEY": "+ADDRESS+EMAIL+PNAME-DOB",
 53      "ERRULE_CODE": "SF1",
 54      "IS_DISCLOSED": 0,
 55      "IS_AMBIGUOUS": 0
 56    },
 57    {
 58      "MIN_ENTITY_ID": 400002,
 59      "MAX_ENTITY_ID": 400022,
 60      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 61      "MATCH_KEY": "+ADDRESS+EMAIL+SURNAME-DOB-SSN",
 62      "ERRULE_CODE": "SF1",
 63      "IS_DISCLOSED": 0,
 64      "IS_AMBIGUOUS": 0
 65    },
 66    {
 67      "MIN_ENTITY_ID": 400015,
 68      "MAX_ENTITY_ID": 400204,
 69      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
 70      "MATCH_KEY": "+NAME",
 71      "ERRULE_CODE": "SNAME",
 72      "IS_DISCLOSED": 0,
 73      "IS_AMBIGUOUS": 0
 74    },
 75    {
 76      "MIN_ENTITY_ID": 400018,
 77      "MAX_ENTITY_ID": 400020,
 78      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 79      "MATCH_KEY": "+ADDRESS+EMAIL+SURNAME-DOB",
 80      "ERRULE_CODE": "SF1",
 81      "IS_DISCLOSED": 0,
 82      "IS_AMBIGUOUS": 0
 83    },
 84    {
 85      "MIN_ENTITY_ID": 400018,
 86      "MAX_ENTITY_ID": 400022,
 87      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 88      "MATCH_KEY": "+ADDRESS+EMAIL+SURNAME-DOB-SSN",
 89      "ERRULE_CODE": "SF1",
 90      "IS_DISCLOSED": 0,
 91      "IS_AMBIGUOUS": 0
 92    },
 93    {
 94      "MIN_ENTITY_ID": 400020,
 95      "MAX_ENTITY_ID": 400022,
 96      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 97      "MATCH_KEY": "+DOB+ADDRESS+EMAIL+SURNAME",
 98      "ERRULE_CODE": "SF1",
 99      "IS_DISCLOSED": 0,
100      "IS_AMBIGUOUS": 0
101    }
102  ],
103  "ENTITIES": [
104    {
105      "RESOLVED_ENTITY": {
106        "ENTITY_ID": 1,
107        "ENTITY_NAME": "Robert Smith",
108        "RECORD_SUMMARY": [
109          {
110            "DATA_SOURCE": "TEST",
111            "RECORD_COUNT": 1
112          },
113          {
114            "DATA_SOURCE": "CUSTOMERS",
115            "RECORD_COUNT": 4
116          }
117        ]
118      }
119    },
120    {
121      "RESOLVED_ENTITY": {
122        "ENTITY_ID": 400002,
123        "ENTITY_NAME": "Marie Kusha",
124        "RECORD_SUMMARY": [
125          {
126            "DATA_SOURCE": "CUSTOMERS",
127            "RECORD_COUNT": 4
128          }
129        ]
130      }
131    },
132    {
133      "RESOLVED_ENTITY": {
134        "ENTITY_ID": 400015,
135        "ENTITY_NAME": "Robert E Smith Sr",
136        "RECORD_SUMMARY": [
137          {
138            "DATA_SOURCE": "CUSTOMERS",
139            "RECORD_COUNT": 1
140          },
141          {
142            "DATA_SOURCE": "WATCHLIST",
143            "RECORD_COUNT": 1
144          }
145        ]
146      }
147    },
148    {
149      "RESOLVED_ENTITY": {
150        "ENTITY_ID": 400018,
151        "ENTITY_NAME": "Eddie Kusha",
152        "RECORD_SUMMARY": [
153          {
154            "DATA_SOURCE": "CUSTOMERS",
155            "RECORD_COUNT": 3
156          },
157          {
158            "DATA_SOURCE": "WATCHLIST",
159            "RECORD_COUNT": 2
160          }
161        ]
162      }
163    },
164    {
165      "RESOLVED_ENTITY": {
166        "ENTITY_ID": 400020,
167        "ENTITY_NAME": "Mark Kusha",
168        "RECORD_SUMMARY": [
169          {
170            "DATA_SOURCE": "CUSTOMERS",
171            "RECORD_COUNT": 1
172          }
173        ]
174      }
175    },
176    {
177      "RESOLVED_ENTITY": {
178        "ENTITY_ID": 400022,
179        "ENTITY_NAME": "Marsha Kusha",
180        "RECORD_SUMMARY": [
181          {
182            "DATA_SOURCE": "CUSTOMERS",
183            "RECORD_COUNT": 1
184          },
185          {
186            "DATA_SOURCE": "WATCHLIST",
187            "RECORD_COUNT": 1
188          }
189        ]
190      }
191    },
192    {
193      "RESOLVED_ENTITY": {
194        "ENTITY_ID": 400204,
195        "ENTITY_NAME": "Robert Smith",
196        "RECORD_SUMMARY": [
197          {
198            "DATA_SOURCE": "WATCHLIST",
199            "RECORD_COUNT": 1
200          }
201        ]
202      }
203    },
204    {
205      "RESOLVED_ENTITY": {
206        "ENTITY_ID": 400215,
207        "ENTITY_NAME": "Patricia Smith",
208        "RECORD_SUMMARY": [
209          {
210            "DATA_SOURCE": "WATCHLIST",
211            "RECORD_COUNT": 1
212          }
213        ]
214      }
215    }
216  ]
217}
find_path_by_entity_id(start_entity_id: int, end_entity_id: int, max_degrees: int, avoid_entity_ids: ~typing.List[int] | None = None, required_data_sources: ~typing.List[str] | None = None, flags: int = <SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS: 1073754112>) str[source]

The find_path_by_entity_id method searches for the shortest relationship path between two entities, specified by entity IDs.

The returned path is the shortest path among the paths that satisfy the parameters.

Parameters:
  • start_entity_id (int) – The entity ID for the starting entity of the search path.

  • end_entity_id (int) – The entity ID for the ending entity of the search path.

  • max_degrees (int) – The maximum number of degrees in paths between search entities.

  • avoid_entity_ids (list(int), optional) – The entity IDs to avoid when finding a path.

  • required_data_sources (list(str), optional) – The data source code(s) that must be in a path.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS.

Returns:

A JSON document with an ENTITY_PATHS section that details the path between the entities.

Return type:

str

Raises:

Example:
 1from typing import List
 2
 3from senzing import SzEngineFlags, SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7avoid_entity_ids: List[int] = []
 8end_entity_id = 400215
 9flags = SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS
10instance_name = "Example"
11max_degrees = 2
12required_data_sources: List[str] = []
13settings = {
14    "PIPELINE": {
15        "CONFIGPATH": "/etc/opt/senzing",
16        "RESOURCEPATH": "/opt/senzing/er/resources",
17        "SUPPORTPATH": "/opt/senzing/data",
18    },
19    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
20}
21start_entity_id = 1
22
23try:
24    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
25    sz_engine = sz_abstract_factory.create_engine()
26    result = sz_engine.find_path_by_entity_id(
27        start_entity_id,
28        end_entity_id,
29        max_degrees,
30        avoid_entity_ids,
31        required_data_sources,
32        flags,
33    )
34    print(f"\n{result}\n")
35except SzError as err:
36    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "ENTITY_PATHS": [
 5    {
 6      "START_ENTITY_ID": 1,
 7      "END_ENTITY_ID": 400215,
 8      "ENTITIES": [
 9        1,
10        400215
11      ]
12    }
13  ],
14  "ENTITY_PATH_LINKS": [
15    {
16      "MIN_ENTITY_ID": 1,
17      "MAX_ENTITY_ID": 400215,
18      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
19      "MATCH_KEY": "+ADDRESS+SURNAME",
20      "ERRULE_CODE": "CFF_SURNAME",
21      "IS_DISCLOSED": 0,
22      "IS_AMBIGUOUS": 0
23    }
24  ],
25  "ENTITIES": [
26    {
27      "RESOLVED_ENTITY": {
28        "ENTITY_ID": 1,
29        "ENTITY_NAME": "Robert Smith",
30        "RECORD_SUMMARY": [
31          {
32            "DATA_SOURCE": "TEST",
33            "RECORD_COUNT": 1
34          },
35          {
36            "DATA_SOURCE": "CUSTOMERS",
37            "RECORD_COUNT": 4
38          }
39        ]
40      }
41    },
42    {
43      "RESOLVED_ENTITY": {
44        "ENTITY_ID": 400215,
45        "ENTITY_NAME": "Patricia Smith",
46        "RECORD_SUMMARY": [
47          {
48            "DATA_SOURCE": "WATCHLIST",
49            "RECORD_COUNT": 1
50          }
51        ]
52      }
53    }
54  ]
55}
find_path_by_record_id(start_data_source_code: str, start_record_id: str, end_data_source_code: str, end_record_id: str, max_degrees: int, avoid_record_keys: ~typing.List[~typing.Tuple[str, str]] | None = None, required_data_sources: ~typing.List[str] | None = None, flags: int = <SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS: 1073754112>) str[source]

The find_path_by_record_id method searches for the shortest relationship path between two entities, specified by record IDs.

The returned path is the shortest path among the paths that satisfy the parameters.

Parameters:
  • start_data_source_code (str) – Identifies the provenance of the record for the starting entity of the search path.

  • start_record_id (str) – The unique identifier within the records of the same data source for the starting entity of the search path.

  • end_data_source_code (str) – Identifies the provenance of the record for the ending entity of the search path.

  • end_record_id (str) – The unique identifier within the records of the same data source for the ending entity of the search path.

  • max_degrees (int) – The maximum number of degrees in paths between search entities.

  • avoid_record_keys (list(tuple(str, str)), optional) – The data source codes and record IDs to avoid when finding a path.

  • required_data_sources (list(str), optional) – The data source code(s) that must be in a path.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from typing import List, Tuple
 2
 3from senzing import SzEngineFlags, SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7avoid_record_keys: List[Tuple[str, str]] = []
 8end_data_source_code = "WATCHLIST"
 9end_record_id = "1007"
10flags = SzEngineFlags.SZ_FIND_PATH_DEFAULT_FLAGS
11instance_name = "Example"
12max_degrees = 2
13required_data_sources: List[str] = []
14settings = {
15    "PIPELINE": {
16        "CONFIGPATH": "/etc/opt/senzing",
17        "RESOURCEPATH": "/opt/senzing/er/resources",
18        "SUPPORTPATH": "/opt/senzing/data",
19    },
20    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
21}
22start_data_source_code = "CUSTOMERS"
23start_record_id = "1001"
24
25try:
26    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
27    sz_engine = sz_abstract_factory.create_engine()
28    result = sz_engine.find_path_by_record_id(
29        start_data_source_code,
30        start_record_id,
31        end_data_source_code,
32        end_record_id,
33        max_degrees,
34        avoid_record_keys,
35        required_data_sources,
36        flags,
37    )
38    print(f"\n{result}\n")
39except SzError as err:
40    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "ENTITY_PATHS": [
 5    {
 6      "START_ENTITY_ID": 1,
 7      "END_ENTITY_ID": 400215,
 8      "ENTITIES": [
 9        1,
10        400215
11      ]
12    }
13  ],
14  "ENTITY_PATH_LINKS": [
15    {
16      "MIN_ENTITY_ID": 1,
17      "MAX_ENTITY_ID": 400215,
18      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
19      "MATCH_KEY": "+ADDRESS+SURNAME",
20      "ERRULE_CODE": "CFF_SURNAME",
21      "IS_DISCLOSED": 0,
22      "IS_AMBIGUOUS": 0
23    }
24  ],
25  "ENTITIES": [
26    {
27      "RESOLVED_ENTITY": {
28        "ENTITY_ID": 1,
29        "ENTITY_NAME": "Robert Smith",
30        "RECORD_SUMMARY": [
31          {
32            "DATA_SOURCE": "TEST",
33            "RECORD_COUNT": 1
34          },
35          {
36            "DATA_SOURCE": "CUSTOMERS",
37            "RECORD_COUNT": 4
38          }
39        ]
40      }
41    },
42    {
43      "RESOLVED_ENTITY": {
44        "ENTITY_ID": 400215,
45        "ENTITY_NAME": "Patricia Smith",
46        "RECORD_SUMMARY": [
47          {
48            "DATA_SOURCE": "WATCHLIST",
49            "RECORD_COUNT": 1
50          }
51        ]
52      }
53    }
54  ]
55}
get_active_config_id() int[source]

The get_active_config_id method gets the currently active configuration ID.

May not be the default configuration ID.

Returns:

The identifier of the active Senzing Engine configuration.

Return type:

int

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_engine = sz_abstract_factory.create_engine()
18    result = sz_engine.get_active_config_id()
19    print(f"\n{result}\n")
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

14030462317
get_entity_by_entity_id(entity_id: int, flags: int = <SzEngineFlags.SZ_ENTITY_DEFAULT_FLAGS: 3734464>) str[source]

The get_entity_by_entity_id method retrieves information about an entity, specified by entity ID.

Parameters:
  • entity_id (int) – The unique identifier of an entity.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_ENTITY_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5entity_id = 1
 6flags = SzEngineFlags.SZ_ENTITY_DEFAULT_FLAGS
 7instance_name = "Example"
 8settings = {
 9    "PIPELINE": {
10        "CONFIGPATH": "/etc/opt/senzing",
11        "RESOURCEPATH": "/opt/senzing/er/resources",
12        "SUPPORTPATH": "/opt/senzing/data",
13    },
14    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
15}
16
17try:
18    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
19    sz_engine = sz_abstract_factory.create_engine()
20    result = sz_engine.get_entity_by_entity_id(entity_id, flags)
21    print(f"\n{result}\n")
22except SzError as err:
23    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "RESOLVED_ENTITY": {
  5    "ENTITY_ID": 1,
  6    "ENTITY_NAME": "Robert Smith",
  7    "FEATURES": {
  8      "ADDRESS": [
  9        {
 10          "FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 11          "LIB_FEAT_ID": 200059,
 12          "USAGE_TYPE": "HOME",
 13          "FEAT_DESC_VALUES": [
 14            {
 15              "FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 16              "LIB_FEAT_ID": 200059
 17            },
 18            {
 19              "FEAT_DESC": "1515 Adela Ln Las Vegas NV 89132",
 20              "LIB_FEAT_ID": 200046
 21            }
 22          ]
 23        },
 24        {
 25          "FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 26          "LIB_FEAT_ID": 3,
 27          "USAGE_TYPE": "MAILING",
 28          "FEAT_DESC_VALUES": [
 29            {
 30              "FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 31              "LIB_FEAT_ID": 3
 32            }
 33          ]
 34        }
 35      ],
 36      "DOB": [
 37        {
 38          "FEAT_DESC": "11/12/1979",
 39          "LIB_FEAT_ID": 200045,
 40          "FEAT_DESC_VALUES": [
 41            {
 42              "FEAT_DESC": "11/12/1979",
 43              "LIB_FEAT_ID": 200045
 44            }
 45          ]
 46        },
 47        {
 48          "FEAT_DESC": "12/11/1978",
 49          "LIB_FEAT_ID": 2,
 50          "FEAT_DESC_VALUES": [
 51            {
 52              "FEAT_DESC": "12/11/1978",
 53              "LIB_FEAT_ID": 2
 54            },
 55            {
 56              "FEAT_DESC": "11/12/1978",
 57              "LIB_FEAT_ID": 200058
 58            }
 59          ]
 60        }
 61      ],
 62      "EMAIL": [
 63        {
 64          "FEAT_DESC": "bsmith@work.com",
 65          "LIB_FEAT_ID": 5,
 66          "FEAT_DESC_VALUES": [
 67            {
 68              "FEAT_DESC": "bsmith@work.com",
 69              "LIB_FEAT_ID": 5
 70            }
 71          ]
 72        }
 73      ],
 74      "NAME": [
 75        {
 76          "FEAT_DESC": "B Smith",
 77          "LIB_FEAT_ID": 200044,
 78          "USAGE_TYPE": "PRIMARY",
 79          "FEAT_DESC_VALUES": [
 80            {
 81              "FEAT_DESC": "B Smith",
 82              "LIB_FEAT_ID": 200044
 83            }
 84          ]
 85        },
 86        {
 87          "FEAT_DESC": "Robert Smith",
 88          "LIB_FEAT_ID": 1,
 89          "USAGE_TYPE": "PRIMARY",
 90          "FEAT_DESC_VALUES": [
 91            {
 92              "FEAT_DESC": "Robert Smith",
 93              "LIB_FEAT_ID": 1
 94            },
 95            {
 96              "FEAT_DESC": "Bob J Smith",
 97              "LIB_FEAT_ID": 200001
 98            },
 99            {
100              "FEAT_DESC": "Bob Smith",
101              "LIB_FEAT_ID": 200057
102            }
103          ]
104        }
105      ],
106      "PHONE": [
107        {
108          "FEAT_DESC": "702-919-1300",
109          "LIB_FEAT_ID": 4,
110          "USAGE_TYPE": "HOME",
111          "FEAT_DESC_VALUES": [
112            {
113              "FEAT_DESC": "702-919-1300",
114              "LIB_FEAT_ID": 4
115            }
116          ]
117        },
118        {
119          "FEAT_DESC": "702-919-1300",
120          "LIB_FEAT_ID": 4,
121          "USAGE_TYPE": "MOBILE",
122          "FEAT_DESC_VALUES": [
123            {
124              "FEAT_DESC": "702-919-1300",
125              "LIB_FEAT_ID": 4
126            }
127          ]
128        }
129      ],
130      "RECORD_TYPE": [
131        {
132          "FEAT_DESC": "PERSON",
133          "LIB_FEAT_ID": 10,
134          "FEAT_DESC_VALUES": [
135            {
136              "FEAT_DESC": "PERSON",
137              "LIB_FEAT_ID": 10
138            }
139          ]
140        }
141      ]
142    },
143    "RECORD_SUMMARY": [
144      {
145        "DATA_SOURCE": "TEST",
146        "RECORD_COUNT": 1
147      },
148      {
149        "DATA_SOURCE": "CUSTOMERS",
150        "RECORD_COUNT": 4
151      }
152    ],
153    "RECORDS": [
154      {
155        "DATA_SOURCE": "CUSTOMERS",
156        "RECORD_ID": "1004",
157        "INTERNAL_ID": 400010,
158        "MATCH_KEY": "",
159        "MATCH_LEVEL_CODE": "",
160        "ERRULE_CODE": "",
161        "FIRST_SEEN_DT": "2025-05-20T16:04:03Z",
162        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
163      },
164      {
165        "DATA_SOURCE": "TEST",
166        "RECORD_ID": "1",
167        "INTERNAL_ID": 1,
168        "MATCH_KEY": "+NAME+DOB+PHONE+EMAIL",
169        "MATCH_LEVEL_CODE": "RESOLVED",
170        "ERRULE_CODE": "SF1_SNAME_CFF_CSTAB",
171        "FIRST_SEEN_DT": "2025-05-20T14:26:26Z",
172        "LAST_SEEN_DT": "2025-05-20T14:33:12Z"
173      },
174      {
175        "DATA_SOURCE": "CUSTOMERS",
176        "RECORD_ID": "1003",
177        "INTERNAL_ID": 400001,
178        "MATCH_KEY": "+NAME+DOB+EMAIL",
179        "MATCH_LEVEL_CODE": "RESOLVED",
180        "ERRULE_CODE": "SF1_PNAME_CSTAB",
181        "FIRST_SEEN_DT": "2025-05-20T16:04:03Z",
182        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
183      },
184      {
185        "DATA_SOURCE": "CUSTOMERS",
186        "RECORD_ID": "1002",
187        "INTERNAL_ID": 400011,
188        "MATCH_KEY": "+NAME+DOB+ADDRESS",
189        "MATCH_LEVEL_CODE": "RESOLVED",
190        "ERRULE_CODE": "CNAME_CFF_CEXCL",
191        "FIRST_SEEN_DT": "2025-05-20T16:04:03Z",
192        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
193      },
194      {
195        "DATA_SOURCE": "CUSTOMERS",
196        "RECORD_ID": "1001",
197        "INTERNAL_ID": 500001,
198        "MATCH_KEY": "+NAME+DOB+ADDRESS+PHONE+EMAIL",
199        "MATCH_LEVEL_CODE": "RESOLVED",
200        "ERRULE_CODE": "SF1_SNAME_CFF_CSTAB",
201        "FIRST_SEEN_DT": "2025-05-20T16:17:16Z",
202        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
203      }
204    ]
205  },
206  "RELATED_ENTITIES": [
207    {
208      "ENTITY_ID": 400015,
209      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
210      "MATCH_KEY": "+NAME+ADDRESS-DOB",
211      "ERRULE_CODE": "CNAME_CFF_DEXCL",
212      "IS_DISCLOSED": 0,
213      "IS_AMBIGUOUS": 0,
214      "ENTITY_NAME": "Robert E Smith Sr",
215      "RECORD_SUMMARY": [
216        {
217          "DATA_SOURCE": "CUSTOMERS",
218          "RECORD_COUNT": 1
219        },
220        {
221          "DATA_SOURCE": "WATCHLIST",
222          "RECORD_COUNT": 1
223        }
224      ]
225    },
226    {
227      "ENTITY_ID": 400204,
228      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
229      "MATCH_KEY": "+NAME",
230      "ERRULE_CODE": "SNAME",
231      "IS_DISCLOSED": 0,
232      "IS_AMBIGUOUS": 0,
233      "ENTITY_NAME": "Robert Smith",
234      "RECORD_SUMMARY": [
235        {
236          "DATA_SOURCE": "WATCHLIST",
237          "RECORD_COUNT": 1
238        }
239      ]
240    },
241    {
242      "ENTITY_ID": 400215,
243      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
244      "MATCH_KEY": "+SURNAME+ADDRESS",
245      "ERRULE_CODE": "CFF_SURNAME",
246      "IS_DISCLOSED": 0,
247      "IS_AMBIGUOUS": 0,
248      "ENTITY_NAME": "Patricia Smith",
249      "RECORD_SUMMARY": [
250        {
251          "DATA_SOURCE": "WATCHLIST",
252          "RECORD_COUNT": 1
253        }
254      ]
255    }
256  ]
257}
get_entity_by_record_id(data_source_code: str, record_id: str, flags: int = <SzEngineFlags.SZ_ENTITY_DEFAULT_FLAGS: 3734464>) str[source]

The get_entity_by_record_id method retrieves information about an entity, specified by record ID.

Parameters:
  • data_source_code (str) – Identifies the provenance of the data.

  • record_id (str) – The unique identifier within the records of the same data source.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_ENTITY_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5data_source_code = "CUSTOMERS"
 6flags = SzEngineFlags.SZ_ENTITY_DEFAULT_FLAGS
 7instance_name = "Example"
 8settings = {
 9    "PIPELINE": {
10        "CONFIGPATH": "/etc/opt/senzing",
11        "RESOURCEPATH": "/opt/senzing/er/resources",
12        "SUPPORTPATH": "/opt/senzing/data",
13    },
14    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
15}
16record_id = "1001"
17
18try:
19    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
20    sz_engine = sz_abstract_factory.create_engine()
21    result = sz_engine.get_entity_by_record_id(data_source_code, record_id, flags)
22    print(f"\n{result}\n")
23except SzError as err:
24    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "RESOLVED_ENTITY": {
  5    "ENTITY_ID": 1,
  6    "ENTITY_NAME": "Robert Smith",
  7    "FEATURES": {
  8      "ADDRESS": [
  9        {
 10          "FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 11          "LIB_FEAT_ID": 200059,
 12          "USAGE_TYPE": "HOME",
 13          "FEAT_DESC_VALUES": [
 14            {
 15              "FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 16              "LIB_FEAT_ID": 200059
 17            },
 18            {
 19              "FEAT_DESC": "1515 Adela Ln Las Vegas NV 89132",
 20              "LIB_FEAT_ID": 200046
 21            }
 22          ]
 23        },
 24        {
 25          "FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 26          "LIB_FEAT_ID": 3,
 27          "USAGE_TYPE": "MAILING",
 28          "FEAT_DESC_VALUES": [
 29            {
 30              "FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 31              "LIB_FEAT_ID": 3
 32            }
 33          ]
 34        }
 35      ],
 36      "DOB": [
 37        {
 38          "FEAT_DESC": "11/12/1979",
 39          "LIB_FEAT_ID": 200045,
 40          "FEAT_DESC_VALUES": [
 41            {
 42              "FEAT_DESC": "11/12/1979",
 43              "LIB_FEAT_ID": 200045
 44            }
 45          ]
 46        },
 47        {
 48          "FEAT_DESC": "12/11/1978",
 49          "LIB_FEAT_ID": 2,
 50          "FEAT_DESC_VALUES": [
 51            {
 52              "FEAT_DESC": "12/11/1978",
 53              "LIB_FEAT_ID": 2
 54            },
 55            {
 56              "FEAT_DESC": "11/12/1978",
 57              "LIB_FEAT_ID": 200058
 58            }
 59          ]
 60        }
 61      ],
 62      "EMAIL": [
 63        {
 64          "FEAT_DESC": "bsmith@work.com",
 65          "LIB_FEAT_ID": 5,
 66          "FEAT_DESC_VALUES": [
 67            {
 68              "FEAT_DESC": "bsmith@work.com",
 69              "LIB_FEAT_ID": 5
 70            }
 71          ]
 72        }
 73      ],
 74      "NAME": [
 75        {
 76          "FEAT_DESC": "B Smith",
 77          "LIB_FEAT_ID": 200044,
 78          "USAGE_TYPE": "PRIMARY",
 79          "FEAT_DESC_VALUES": [
 80            {
 81              "FEAT_DESC": "B Smith",
 82              "LIB_FEAT_ID": 200044
 83            }
 84          ]
 85        },
 86        {
 87          "FEAT_DESC": "Robert Smith",
 88          "LIB_FEAT_ID": 1,
 89          "USAGE_TYPE": "PRIMARY",
 90          "FEAT_DESC_VALUES": [
 91            {
 92              "FEAT_DESC": "Robert Smith",
 93              "LIB_FEAT_ID": 1
 94            },
 95            {
 96              "FEAT_DESC": "Bob J Smith",
 97              "LIB_FEAT_ID": 200001
 98            },
 99            {
100              "FEAT_DESC": "Bob Smith",
101              "LIB_FEAT_ID": 200057
102            }
103          ]
104        }
105      ],
106      "PHONE": [
107        {
108          "FEAT_DESC": "702-919-1300",
109          "LIB_FEAT_ID": 4,
110          "USAGE_TYPE": "HOME",
111          "FEAT_DESC_VALUES": [
112            {
113              "FEAT_DESC": "702-919-1300",
114              "LIB_FEAT_ID": 4
115            }
116          ]
117        },
118        {
119          "FEAT_DESC": "702-919-1300",
120          "LIB_FEAT_ID": 4,
121          "USAGE_TYPE": "MOBILE",
122          "FEAT_DESC_VALUES": [
123            {
124              "FEAT_DESC": "702-919-1300",
125              "LIB_FEAT_ID": 4
126            }
127          ]
128        }
129      ],
130      "RECORD_TYPE": [
131        {
132          "FEAT_DESC": "PERSON",
133          "LIB_FEAT_ID": 10,
134          "FEAT_DESC_VALUES": [
135            {
136              "FEAT_DESC": "PERSON",
137              "LIB_FEAT_ID": 10
138            }
139          ]
140        }
141      ]
142    },
143    "RECORD_SUMMARY": [
144      {
145        "DATA_SOURCE": "TEST",
146        "RECORD_COUNT": 1
147      },
148      {
149        "DATA_SOURCE": "CUSTOMERS",
150        "RECORD_COUNT": 4
151      }
152    ],
153    "RECORDS": [
154      {
155        "DATA_SOURCE": "CUSTOMERS",
156        "RECORD_ID": "1004",
157        "INTERNAL_ID": 400010,
158        "MATCH_KEY": "",
159        "MATCH_LEVEL_CODE": "",
160        "ERRULE_CODE": "",
161        "FIRST_SEEN_DT": "2025-05-20T16:04:03Z",
162        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
163      },
164      {
165        "DATA_SOURCE": "TEST",
166        "RECORD_ID": "1",
167        "INTERNAL_ID": 1,
168        "MATCH_KEY": "+NAME+DOB+PHONE+EMAIL",
169        "MATCH_LEVEL_CODE": "RESOLVED",
170        "ERRULE_CODE": "SF1_SNAME_CFF_CSTAB",
171        "FIRST_SEEN_DT": "2025-05-20T14:26:26Z",
172        "LAST_SEEN_DT": "2025-05-20T14:33:12Z"
173      },
174      {
175        "DATA_SOURCE": "CUSTOMERS",
176        "RECORD_ID": "1003",
177        "INTERNAL_ID": 400001,
178        "MATCH_KEY": "+NAME+DOB+EMAIL",
179        "MATCH_LEVEL_CODE": "RESOLVED",
180        "ERRULE_CODE": "SF1_PNAME_CSTAB",
181        "FIRST_SEEN_DT": "2025-05-20T16:04:03Z",
182        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
183      },
184      {
185        "DATA_SOURCE": "CUSTOMERS",
186        "RECORD_ID": "1002",
187        "INTERNAL_ID": 400011,
188        "MATCH_KEY": "+NAME+DOB+ADDRESS",
189        "MATCH_LEVEL_CODE": "RESOLVED",
190        "ERRULE_CODE": "CNAME_CFF_CEXCL",
191        "FIRST_SEEN_DT": "2025-05-20T16:04:03Z",
192        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
193      },
194      {
195        "DATA_SOURCE": "CUSTOMERS",
196        "RECORD_ID": "1001",
197        "INTERNAL_ID": 500001,
198        "MATCH_KEY": "+NAME+DOB+ADDRESS+PHONE+EMAIL",
199        "MATCH_LEVEL_CODE": "RESOLVED",
200        "ERRULE_CODE": "SF1_SNAME_CFF_CSTAB",
201        "FIRST_SEEN_DT": "2025-05-20T16:17:16Z",
202        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
203      }
204    ]
205  },
206  "RELATED_ENTITIES": [
207    {
208      "ENTITY_ID": 400015,
209      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
210      "MATCH_KEY": "+NAME+ADDRESS-DOB",
211      "ERRULE_CODE": "CNAME_CFF_DEXCL",
212      "IS_DISCLOSED": 0,
213      "IS_AMBIGUOUS": 0,
214      "ENTITY_NAME": "Robert E Smith Sr",
215      "RECORD_SUMMARY": [
216        {
217          "DATA_SOURCE": "CUSTOMERS",
218          "RECORD_COUNT": 1
219        },
220        {
221          "DATA_SOURCE": "WATCHLIST",
222          "RECORD_COUNT": 1
223        }
224      ]
225    },
226    {
227      "ENTITY_ID": 400204,
228      "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
229      "MATCH_KEY": "+NAME",
230      "ERRULE_CODE": "SNAME",
231      "IS_DISCLOSED": 0,
232      "IS_AMBIGUOUS": 0,
233      "ENTITY_NAME": "Robert Smith",
234      "RECORD_SUMMARY": [
235        {
236          "DATA_SOURCE": "WATCHLIST",
237          "RECORD_COUNT": 1
238        }
239      ]
240    },
241    {
242      "ENTITY_ID": 400215,
243      "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
244      "MATCH_KEY": "+SURNAME+ADDRESS",
245      "ERRULE_CODE": "CFF_SURNAME",
246      "IS_DISCLOSED": 0,
247      "IS_AMBIGUOUS": 0,
248      "ENTITY_NAME": "Patricia Smith",
249      "RECORD_SUMMARY": [
250        {
251          "DATA_SOURCE": "WATCHLIST",
252          "RECORD_COUNT": 1
253        }
254      ]
255    }
256  ]
257}
get_record(data_source_code: str, record_id: str, flags: int = <SzEngineFlags.SZ_ENTITY_INCLUDE_RECORD_JSON_DATA: 65536>) str[source]

The get_record method retrieves information about a record.

The information contains the original record data that was loaded and may contain other information depending on the flags parameter.

Parameters:
  • data_source_code (str) – Identifies the provenance of the data.

  • record_id (str) – The unique identifier within the records of the same data source.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_RECORD_DEFAULT_FLAGS.

Returns:

A JSON document of a single record.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5data_source_code = "CUSTOMERS"
 6flags = SzEngineFlags.SZ_RECORD_DEFAULT_FLAGS
 7instance_name = "Example"
 8record_id = "1001"
 9settings = {
10    "PIPELINE": {
11        "CONFIGPATH": "/etc/opt/senzing",
12        "RESOURCEPATH": "/opt/senzing/er/resources",
13        "SUPPORTPATH": "/opt/senzing/data",
14    },
15    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
16}
17
18
19try:
20    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
21    sz_engine = sz_abstract_factory.create_engine()
22    result = sz_engine.get_record(data_source_code, record_id, flags)
23    print(f"\n{result}\n")
24except SzError as err:
25    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "DATA_SOURCE": "CUSTOMERS",
 5  "RECORD_ID": "1001",
 6  "JSON_DATA": {
 7    "DATA_SOURCE": "CUSTOMERS",
 8    "RECORD_ID": "1001",
 9    "RECORD_TYPE": "PERSON",
10    "PRIMARY_NAME_LAST": "Smith",
11    "PRIMARY_NAME_FIRST": "Robert",
12    "DATE_OF_BIRTH": "12/11/1978",
13    "ADDR_TYPE": "MAILING",
14    "ADDR_LINE1": "123 Main Street, Las Vegas NV 89132",
15    "PHONE_TYPE": "HOME",
16    "PHONE_NUMBER": "702-919-1300",
17    "EMAIL_ADDRESS": "bsmith@work.com",
18    "DATE": "1/2/18",
19    "STATUS": "Active",
20    "AMOUNT": "100"
21  }
22}
get_record_preview(record_definition: str, flags: int = <SzEngineFlags.SZ_ENTITY_INCLUDE_RECORD_FEATURE_DETAILS: 34359738368>) str[source]

The get_record_preview method describes the features resulting from the hypothetical load of a record.

Used to preview the features for a record that has not been loaded.

Parameters:
  • record_definition (str) – A JSON document containing the record to be tested.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_RECORD_PREVIEW_DEFAULT_FLAGS.

Returns:

A JSON document containing metadata as specified by the flags.

Return type:

str

Raises:

Example:
 1import json
 2
 3from senzing import SzEngineFlags, SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7instance_name = "Example"
 8flags = SzEngineFlags.SZ_RECORD_PREVIEW_DEFAULT_FLAGS
 9record_definition = json.dumps(
10    {
11        "RECORD_TYPE": "PERSON",
12        "PRIMARY_NAME_LAST": "Smith",
13        "PRIMARY_NAME_FIRST": "Robert",
14        "DATE_OF_BIRTH": "12/11/1978",
15        "ADDR_TYPE": "MAILING",
16        "ADDR_LINE1": "123 Main Street, Las Vegas NV 89132",
17        "PHONE_TYPE": "HOME",
18        "PHONE_NUMBER": "702-919-1300",
19        "EMAIL_ADDRESS": "bsmith@work.com",
20        "DATE": "1/2/18",
21        "STATUS": "Active",
22        "AMOUNT": "100",
23    }
24)
25settings = {
26    "PIPELINE": {
27        "CONFIGPATH": "/etc/opt/senzing",
28        "RESOURCEPATH": "/opt/senzing/er/resources",
29        "SUPPORTPATH": "/opt/senzing/data",
30    },
31    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
32}
33
34try:
35    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
36    sz_engine = sz_abstract_factory.create_engine()
37    result = sz_engine.get_record_preview(record_definition, flags)
38    print(f"\n{result}\n")
39except SzError as err:
40    print(f"\nERROR: {err}\n")

Output:

 1{
 2  "FEATURES": {
 3    "NAME": [
 4      {
 5        "LIB_FEAT_ID": -2,
 6        "USAGE_TYPE": "PRIMARY",
 7        "FEAT_DESC": "Robert Smith",
 8        "ATTRIBUTES": {
 9          "PRIMARY_NAME_LAST": "Smith",
10          "PRIMARY_NAME_FIRST": "Robert"
11        }
12      }
13    ],
14    "DOB": [
15      {
16        "LIB_FEAT_ID": -3,
17        "FEAT_DESC": "12/11/1978",
18        "ATTRIBUTES": {
19          "DATE_OF_BIRTH": "12/11/1978"
20        }
21      }
22    ],
23    "ADDRESS": [
24      {
25        "LIB_FEAT_ID": -4,
26        "USAGE_TYPE": "MAILING",
27        "FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
28        "ATTRIBUTES": {
29          "ADDR_LINE1": "123 Main Street, Las Vegas NV 89132"
30        }
31      }
32    ],
33    "PHONE": [
34      {
35        "LIB_FEAT_ID": -5,
36        "USAGE_TYPE": "HOME",
37        "FEAT_DESC": "702-919-1300",
38        "ATTRIBUTES": {
39          "PHONE_NUMBER": "702-919-1300"
40        }
41      }
42    ],
43    "EMAIL": [
44      {
45        "LIB_FEAT_ID": -6,
46        "FEAT_DESC": "bsmith@work.com",
47        "ATTRIBUTES": {
48          "EMAIL_ADDRESS": "bsmith@work.com"
49        }
50      }
51    ],
52    "RECORD_TYPE": [
53      {
54        "LIB_FEAT_ID": -11,
55        "FEAT_DESC": "PERSON",
56        "ATTRIBUTES": {
57          "RECORD_TYPE": "PERSON"
58        }
59      }
60    ]
61  }
62}
get_redo_record() str[source]

The get_redo_record method retrieves and removes a pending redo record.

An empty value will be returned if there are no pending redo records.

Use processRedoRecord() to process the result of this function.

Once a redo record is retrieved, it is no longer tracked by Senzing.

The redo record may be stored externally for later processing.

See also countRedoRecords(), processRedoRecord()

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_engine = sz_abstract_factory.create_engine()
18    result = sz_engine.get_redo_record()
19    print(f"\n{result}\n")
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

1// Output has been formatted for easier reading.
2
3{
4  "REASON": "deferred delete",
5  "DATA_SOURCE": "CUSTOMERS",
6  "RECORD_ID": "1001",
7  "DSRC_ACTION": "X"
8}
get_stats() str[source]

The get_stats method gets and resets the internal engine workload statistics for the current operating system process.

The output is helpful when interacting with Senzing support.

Best practice to periodically log the results.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_engine = sz_abstract_factory.create_engine()
18    result = sz_engine.get_stats()
19    print(f"\n{result}\n")
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "workload": {
  5    "apiVersion": "4.0.0.25134",
  6    "loadedRecords": -1,
  7    "addedRecords": 0,
  8    "bulkAddedRecords": 0,
  9    "optimizedOut": 0,
 10    "optimizedOutSkipped": 0,
 11    "newObsEnt": 0,
 12    "obsEntHashSame": 0,
 13    "obsEntHashDiff": 0,
 14    "partiallyResolved": 0,
 15    "deletedRecords": 0,
 16    "changeDeletes": 0,
 17    "reevaluations": 0,
 18    "repairedEntities": 0,
 19    "duration": 0,
 20    "retries": 0,
 21    "candidates": 0,
 22    "actualAmbiguousTest": 0,
 23    "cachedAmbiguousTest": 0,
 24    "libFeatCacheHit": 93,
 25    "libFeatCacheMiss": 67,
 26    "resFeatStatCacheHit": 0,
 27    "resFeatStatCacheMiss": 0,
 28    "libFeatInsert": 0,
 29    "resFeatStatInsert": 0,
 30    "resFeatStatUpdateAttempt": 0,
 31    "resFeatStatUpdateFail": 0,
 32    "unresolveTest": 0,
 33    "abortedUnresolve": 0,
 34    "lockWaits": {
 35      "maxRefreshLocksMS": 0,
 36      "totalRefreshLocksMS": 0,
 37      "countRefreshLocks": 0
 38    },
 39    "unresolveTriggers": {
 40      "normalResolve": 0,
 41      "update": 0,
 42      "relLink": 0,
 43      "extensiveResolve": 0,
 44      "ambiguousNoResolve": 0,
 45      "ambiguousMultiResolve": 0
 46    },
 47    "reresolveTriggers": {
 48      "abortRetry": 0,
 49      "unresolveMovement": 0,
 50      "multipleResolvableCandidates": 0,
 51      "resolveNewFeatures": 0,
 52      "newFeatureFTypes": []
 53    },
 54    "reresolveSkipped": 0,
 55    "filteredObsFeat": 0,
 56    "expressedFeatureCalls": [],
 57    "expressedFeaturesCreated": [],
 58    "scoredPairs": [
 59      {
 60        "ADDRESS": 2
 61      },
 62      {
 63        "DOB": 4
 64      },
 65      {
 66        "NAME": 6
 67      }
 68    ],
 69    "cacheHit": [],
 70    "cacheMiss": [
 71      {
 72        "ADDRESS": 2
 73      },
 74      {
 75        "DOB": 4
 76      },
 77      {
 78        "NAME": 6
 79      }
 80    ],
 81    "redoTriggers": [],
 82    "latchContention": [],
 83    "highContentionFeat": [],
 84    "highContentionResEnt": [],
 85    "genericDetect": [],
 86    "candidateBuilders": [],
 87    "suppressedCandidateBuilders": [],
 88    "suppressedScoredFeatureType": [],
 89    "suppressedCandidateBuildersForReresolve": [],
 90    "suppressedScoredFeatureTypeForReresolve": [],
 91    "suppressedDisclosedRelationshipDomainCount": 0,
 92    "corruptEntityTestDiagnosis": {
 93      "corruptionTypes": 0
 94    },
 95    "threadState": {
 96      "active": 0,
 97      "idle": 1,
 98      "governorContention": 0,
 99      "sqlExecuting": 0,
100      "loader": 0,
101      "resolver": 0,
102      "scoring": 0,
103      "dataLatchContention": 0,
104      "obsEntContention": 0,
105      "resEntContention": 0
106    },
107    "systemResources": {
108      "initResources": [
109        {
110          "physicalCores": 10
111        },
112        {
113          "logicalCores": 10
114        },
115        {
116          "totalMemory": "31.3GB"
117        },
118        {
119          "availableMemory": "21.4GB"
120        }
121      ],
122      "currResources": [
123        {
124          "availableMemory": "17.8GB"
125        },
126        {
127          "processMemory": "2.0GB"
128        },
129        {
130          "activeThreads": 0
131        },
132        {
133          "workerThreads": 1
134        },
135        {
136          "systemLoad": [
137            {
138              "cpuUser": 5.697687
139            },
140            {
141              "cpuNice": 0.000053
142            },
143            {
144              "cpuSystem": 14.274692
145            },
146            {
147              "cpuIdle": 79.633011
148            },
149            {
150              "cpuWait": 0.060391
151            },
152            {
153              "cpuSoftIrq": 0.334167
154            }
155          ]
156        }
157      ]
158    }
159  }
160}
get_virtual_entity_by_record_id(record_keys: ~typing.List[~typing.Tuple[str, str]], flags: int = <SzEngineFlags.SZ_ENTITY_CORE_FLAGS: 63488>) str[source]

The get_virtual_entity_by_record_id method describes how an entity would look if composed of a given set of records.

Virtual entities do not have relationships.

Parameters:
  • record_keys (list(tuple(str, str))) – The data source codes and record IDs identifying records to create the virtual entity from.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_VIRTUAL_ENTITY_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5flags = SzEngineFlags.SZ_VIRTUAL_ENTITY_DEFAULT_FLAGS
 6instance_name = "Example"
 7record_list = [
 8    ("CUSTOMERS", "1001"),
 9    ("CUSTOMERS", "1002"),
10]
11settings = {
12    "PIPELINE": {
13        "CONFIGPATH": "/etc/opt/senzing",
14        "RESOURCEPATH": "/opt/senzing/er/resources",
15        "SUPPORTPATH": "/opt/senzing/data",
16    },
17    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
18}
19
20try:
21    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
22    sz_engine = sz_abstract_factory.create_engine()
23    result = sz_engine.get_virtual_entity_by_record_id(record_list, flags)
24    print(f"\n{result}\n")
25except SzError as err:
26    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "RESOLVED_ENTITY": {
  5    "ENTITY_ID": 400011,
  6    "ENTITY_NAME": "Bob Smith",
  7    "FEATURES": {
  8      "ADDRESS": [
  9        {
 10          "FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 11          "LIB_FEAT_ID": 200059,
 12          "USAGE_TYPE": "HOME",
 13          "FEAT_DESC_VALUES": [
 14            {
 15              "FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 16              "LIB_FEAT_ID": 200059
 17            }
 18          ]
 19        },
 20        {
 21          "FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 22          "LIB_FEAT_ID": 3,
 23          "USAGE_TYPE": "MAILING",
 24          "FEAT_DESC_VALUES": [
 25            {
 26              "FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 27              "LIB_FEAT_ID": 3
 28            }
 29          ]
 30        }
 31      ],
 32      "DOB": [
 33        {
 34          "FEAT_DESC": "12/11/1978",
 35          "LIB_FEAT_ID": 2,
 36          "FEAT_DESC_VALUES": [
 37            {
 38              "FEAT_DESC": "12/11/1978",
 39              "LIB_FEAT_ID": 2
 40            },
 41            {
 42              "FEAT_DESC": "11/12/1978",
 43              "LIB_FEAT_ID": 200058
 44            }
 45          ]
 46        }
 47      ],
 48      "EMAIL": [
 49        {
 50          "FEAT_DESC": "bsmith@work.com",
 51          "LIB_FEAT_ID": 5,
 52          "FEAT_DESC_VALUES": [
 53            {
 54              "FEAT_DESC": "bsmith@work.com",
 55              "LIB_FEAT_ID": 5
 56            }
 57          ]
 58        }
 59      ],
 60      "NAME": [
 61        {
 62          "FEAT_DESC": "Robert Smith",
 63          "LIB_FEAT_ID": 1,
 64          "USAGE_TYPE": "PRIMARY",
 65          "FEAT_DESC_VALUES": [
 66            {
 67              "FEAT_DESC": "Robert Smith",
 68              "LIB_FEAT_ID": 1
 69            },
 70            {
 71              "FEAT_DESC": "Bob Smith",
 72              "LIB_FEAT_ID": 200057
 73            }
 74          ]
 75        }
 76      ],
 77      "PHONE": [
 78        {
 79          "FEAT_DESC": "702-919-1300",
 80          "LIB_FEAT_ID": 4,
 81          "USAGE_TYPE": "HOME",
 82          "FEAT_DESC_VALUES": [
 83            {
 84              "FEAT_DESC": "702-919-1300",
 85              "LIB_FEAT_ID": 4
 86            }
 87          ]
 88        },
 89        {
 90          "FEAT_DESC": "702-919-1300",
 91          "LIB_FEAT_ID": 4,
 92          "USAGE_TYPE": "MOBILE",
 93          "FEAT_DESC_VALUES": [
 94            {
 95              "FEAT_DESC": "702-919-1300",
 96              "LIB_FEAT_ID": 4
 97            }
 98          ]
 99        }
100      ],
101      "RECORD_TYPE": [
102        {
103          "FEAT_DESC": "PERSON",
104          "LIB_FEAT_ID": 10,
105          "FEAT_DESC_VALUES": [
106            {
107              "FEAT_DESC": "PERSON",
108              "LIB_FEAT_ID": 10
109            }
110          ]
111        }
112      ]
113    },
114    "RECORD_SUMMARY": [
115      {
116        "DATA_SOURCE": "CUSTOMERS",
117        "RECORD_COUNT": 2
118      }
119    ],
120    "RECORDS": [
121      {
122        "DATA_SOURCE": "CUSTOMERS",
123        "RECORD_ID": "1002",
124        "INTERNAL_ID": 400011,
125        "FIRST_SEEN_DT": "2025-05-20T16:04:03Z",
126        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
127      },
128      {
129        "DATA_SOURCE": "CUSTOMERS",
130        "RECORD_ID": "1001",
131        "INTERNAL_ID": 500001,
132        "FIRST_SEEN_DT": "2025-05-20T16:17:16Z",
133        "LAST_SEEN_DT": "2025-05-20T16:17:16Z"
134      }
135    ]
136  }
137}
help(method_name: str = '') str

The help method returns help for a particular message.

Parameters:

method_name (str) – The name of the method. (e.g. “init”). If empty, a list of methods and descriptions is returned.

Returns:

The Help information about the requested method

Return type:

str

how_entity_by_entity_id(entity_id: int, flags: int = <SzEngineFlags.SZ_INCLUDE_FEATURE_SCORES: 67108864>) str[source]

The how_entity_by_entity_id method explains how an entity was constructed from its records.

Parameters:
  • entity_id (int) – The unique identifier of an entity.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_HOW_ENTITY_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5entity_id = 1
 6flags = SzEngineFlags.SZ_HOW_ENTITY_DEFAULT_FLAGS
 7instance_name = "Example"
 8settings = {
 9    "PIPELINE": {
10        "CONFIGPATH": "/etc/opt/senzing",
11        "RESOURCEPATH": "/opt/senzing/er/resources",
12        "SUPPORTPATH": "/opt/senzing/data",
13    },
14    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
15}
16
17try:
18    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
19    sz_engine = sz_abstract_factory.create_engine()
20    result = sz_engine.how_entity_by_entity_id(entity_id, flags)
21    print(f"\n{result}\n")
22except SzError as err:
23    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "HOW_RESULTS": {
  5    "RESOLUTION_STEPS": [
  6      {
  7        "STEP": 1,
  8        "VIRTUAL_ENTITY_1": {
  9          "VIRTUAL_ENTITY_ID": "V400010",
 10          "MEMBER_RECORDS": [
 11            {
 12              "INTERNAL_ID": 400010,
 13              "RECORDS": [
 14                {
 15                  "DATA_SOURCE": "CUSTOMERS",
 16                  "RECORD_ID": "1004"
 17                }
 18              ]
 19            }
 20          ]
 21        },
 22        "VIRTUAL_ENTITY_2": {
 23          "VIRTUAL_ENTITY_ID": "V400011",
 24          "MEMBER_RECORDS": [
 25            {
 26              "INTERNAL_ID": 400011,
 27              "RECORDS": [
 28                {
 29                  "DATA_SOURCE": "CUSTOMERS",
 30                  "RECORD_ID": "1002"
 31                }
 32              ]
 33            }
 34          ]
 35        },
 36        "INBOUND_VIRTUAL_ENTITY_ID": "V400010",
 37        "RESULT_VIRTUAL_ENTITY_ID": "V400010-S1",
 38        "MATCH_INFO": {
 39          "MATCH_KEY": "+NAME+DOB+ADDRESS",
 40          "ERRULE_CODE": "CNAME_CFF_CEXCL",
 41          "CANDIDATE_KEYS": {
 42            "ADDR_KEY": [
 43              {
 44                "FEAT_ID": 200048,
 45                "FEAT_DESC": "1515|ATL||LS FKS"
 46              }
 47            ]
 48          },
 49          "FEATURE_SCORES": {
 50            "ADDRESS": [
 51              {
 52                "INBOUND_FEAT_ID": 200046,
 53                "INBOUND_FEAT_DESC": "1515 Adela Ln Las Vegas NV 89132",
 54                "INBOUND_FEAT_USAGE_TYPE": "HOME",
 55                "CANDIDATE_FEAT_ID": 200059,
 56                "CANDIDATE_FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 57                "CANDIDATE_FEAT_USAGE_TYPE": "HOME",
 58                "SCORE": 96,
 59                "ADDITIONAL_SCORES": {
 60                  "FULL_SCORE": 96
 61                },
 62                "SCORE_BUCKET": "CLOSE",
 63                "SCORE_BEHAVIOR": "FF"
 64              }
 65            ],
 66            "DOB": [
 67              {
 68                "INBOUND_FEAT_ID": 200045,
 69                "INBOUND_FEAT_DESC": "11/12/1979",
 70                "INBOUND_FEAT_USAGE_TYPE": "",
 71                "CANDIDATE_FEAT_ID": 200058,
 72                "CANDIDATE_FEAT_DESC": "11/12/1978",
 73                "CANDIDATE_FEAT_USAGE_TYPE": "",
 74                "SCORE": 92,
 75                "ADDITIONAL_SCORES": {
 76                  "FULL_SCORE": 92
 77                },
 78                "SCORE_BUCKET": "CLOSE",
 79                "SCORE_BEHAVIOR": "FMES"
 80              }
 81            ],
 82            "NAME": [
 83              {
 84                "INBOUND_FEAT_ID": 200044,
 85                "INBOUND_FEAT_DESC": "B Smith",
 86                "INBOUND_FEAT_USAGE_TYPE": "PRIMARY",
 87                "CANDIDATE_FEAT_ID": 200057,
 88                "CANDIDATE_FEAT_DESC": "Bob Smith",
 89                "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
 90                "SCORE": 92,
 91                "ADDITIONAL_SCORES": {
 92                  "GNR_FN": 92,
 93                  "GNR_SN": 100,
 94                  "GNR_GN": 85,
 95                  "GENERATION_MATCH": -1,
 96                  "GNR_ON": -1
 97                },
 98                "SCORE_BUCKET": "CLOSE",
 99                "SCORE_BEHAVIOR": "NAME"
100              }
101            ],
102            "RECORD_TYPE": [
103              {
104                "INBOUND_FEAT_ID": 10,
105                "INBOUND_FEAT_DESC": "PERSON",
106                "INBOUND_FEAT_USAGE_TYPE": "",
107                "CANDIDATE_FEAT_ID": 10,
108                "CANDIDATE_FEAT_DESC": "PERSON",
109                "CANDIDATE_FEAT_USAGE_TYPE": "",
110                "SCORE": 100,
111                "ADDITIONAL_SCORES": {
112                  "FULL_SCORE": 100
113                },
114                "SCORE_BUCKET": "SAME",
115                "SCORE_BEHAVIOR": "FVME"
116              }
117            ]
118          }
119        }
120      },
121      {
122        "STEP": 2,
123        "VIRTUAL_ENTITY_1": {
124          "VIRTUAL_ENTITY_ID": "V1",
125          "MEMBER_RECORDS": [
126            {
127              "INTERNAL_ID": 1,
128              "RECORDS": [
129                {
130                  "DATA_SOURCE": "TEST",
131                  "RECORD_ID": "1"
132                }
133              ]
134            }
135          ]
136        },
137        "VIRTUAL_ENTITY_2": {
138          "VIRTUAL_ENTITY_ID": "V400010-S1",
139          "MEMBER_RECORDS": [
140            {
141              "INTERNAL_ID": 400010,
142              "RECORDS": [
143                {
144                  "DATA_SOURCE": "CUSTOMERS",
145                  "RECORD_ID": "1004"
146                }
147              ]
148            },
149            {
150              "INTERNAL_ID": 400011,
151              "RECORDS": [
152                {
153                  "DATA_SOURCE": "CUSTOMERS",
154                  "RECORD_ID": "1002"
155                }
156              ]
157            }
158          ]
159        },
160        "INBOUND_VIRTUAL_ENTITY_ID": "V400010-S1",
161        "RESULT_VIRTUAL_ENTITY_ID": "V1-S2",
162        "MATCH_INFO": {
163          "MATCH_KEY": "+NAME+DOB+PHONE+EMAIL",
164          "ERRULE_CODE": "SF1_SNAME_CFF_CSTAB",
165          "CANDIDATE_KEYS": {
166            "EMAIL_KEY": [
167              {
168                "FEAT_ID": 11,
169                "FEAT_DESC": "bsmith@WORK.COM"
170              }
171            ],
172            "NAMEDATE_KEY": [
173              {
174                "FEAT_ID": 14,
175                "FEAT_DESC": "RPRT|SM0|DOB.MMDD_HASH=1211"
176              },
177              {
178                "FEAT_ID": 15,
179                "FEAT_DESC": "RPRT|SM0|DOB=71211"
180              }
181            ],
182            "NAMEPHONE_KEY": [
183              {
184                "FEAT_ID": 19,
185                "FEAT_DESC": "RPRT|SM0|PHONE.PHONE_LAST_5=91300"
186              }
187            ],
188            "NAMEREGION_KEY": [
189              {
190                "FEAT_ID": 18,
191                "FEAT_DESC": "RPRT|SM0|ADDRESS.CITY_STD=LS FKS"
192              }
193            ],
194            "NAME_KEY": [
195              {
196                "FEAT_ID": 6,
197                "FEAT_DESC": "RPRT|SM0"
198              }
199            ],
200            "PHONE_KEY": [
201              {
202                "FEAT_ID": 9,
203                "FEAT_DESC": "7029191300"
204              }
205            ]
206          },
207          "FEATURE_SCORES": {
208            "ADDRESS": [
209              {
210                "INBOUND_FEAT_ID": 200059,
211                "INBOUND_FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
212                "INBOUND_FEAT_USAGE_TYPE": "HOME",
213                "CANDIDATE_FEAT_ID": 3,
214                "CANDIDATE_FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
215                "CANDIDATE_FEAT_USAGE_TYPE": "MAILING",
216                "SCORE": 42,
217                "ADDITIONAL_SCORES": {
218                  "FULL_SCORE": 42
219                },
220                "SCORE_BUCKET": "NO_CHANCE",
221                "SCORE_BEHAVIOR": "FF"
222              }
223            ],
224            "DOB": [
225              {
226                "INBOUND_FEAT_ID": 200058,
227                "INBOUND_FEAT_DESC": "11/12/1978",
228                "INBOUND_FEAT_USAGE_TYPE": "",
229                "CANDIDATE_FEAT_ID": 2,
230                "CANDIDATE_FEAT_DESC": "12/11/1978",
231                "CANDIDATE_FEAT_USAGE_TYPE": "",
232                "SCORE": 95,
233                "ADDITIONAL_SCORES": {
234                  "FULL_SCORE": 95
235                },
236                "SCORE_BUCKET": "CLOSE",
237                "SCORE_BEHAVIOR": "FMES"
238              }
239            ],
240            "EMAIL": [
241              {
242                "INBOUND_FEAT_ID": 5,
243                "INBOUND_FEAT_DESC": "bsmith@work.com",
244                "INBOUND_FEAT_USAGE_TYPE": "",
245                "CANDIDATE_FEAT_ID": 5,
246                "CANDIDATE_FEAT_DESC": "bsmith@work.com",
247                "CANDIDATE_FEAT_USAGE_TYPE": "",
248                "SCORE": 100,
249                "ADDITIONAL_SCORES": {
250                  "FULL_SCORE": 100
251                },
252                "SCORE_BUCKET": "SAME",
253                "SCORE_BEHAVIOR": "F1"
254              }
255            ],
256            "NAME": [
257              {
258                "INBOUND_FEAT_ID": 200057,
259                "INBOUND_FEAT_DESC": "Bob Smith",
260                "INBOUND_FEAT_USAGE_TYPE": "PRIMARY",
261                "CANDIDATE_FEAT_ID": 1,
262                "CANDIDATE_FEAT_DESC": "Robert Smith",
263                "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
264                "SCORE": 97,
265                "ADDITIONAL_SCORES": {
266                  "GNR_FN": 97,
267                  "GNR_SN": 100,
268                  "GNR_GN": 95,
269                  "GENERATION_MATCH": -1,
270                  "GNR_ON": -1
271                },
272                "SCORE_BUCKET": "CLOSE",
273                "SCORE_BEHAVIOR": "NAME"
274              }
275            ],
276            "PHONE": [
277              {
278                "INBOUND_FEAT_ID": 4,
279                "INBOUND_FEAT_DESC": "702-919-1300",
280                "INBOUND_FEAT_USAGE_TYPE": "MOBILE",
281                "CANDIDATE_FEAT_ID": 4,
282                "CANDIDATE_FEAT_DESC": "702-919-1300",
283                "CANDIDATE_FEAT_USAGE_TYPE": "HOME",
284                "SCORE": 100,
285                "ADDITIONAL_SCORES": {
286                  "FULL_SCORE": 100
287                },
288                "SCORE_BUCKET": "SAME",
289                "SCORE_BEHAVIOR": "FF"
290              }
291            ],
292            "RECORD_TYPE": [
293              {
294                "INBOUND_FEAT_ID": 10,
295                "INBOUND_FEAT_DESC": "PERSON",
296                "INBOUND_FEAT_USAGE_TYPE": "",
297                "CANDIDATE_FEAT_ID": 10,
298                "CANDIDATE_FEAT_DESC": "PERSON",
299                "CANDIDATE_FEAT_USAGE_TYPE": "",
300                "SCORE": 100,
301                "ADDITIONAL_SCORES": {
302                  "FULL_SCORE": 100
303                },
304                "SCORE_BUCKET": "SAME",
305                "SCORE_BEHAVIOR": "FVME"
306              }
307            ]
308          }
309        }
310      },
311      {
312        "STEP": 3,
313        "VIRTUAL_ENTITY_1": {
314          "VIRTUAL_ENTITY_ID": "V1-S2",
315          "MEMBER_RECORDS": [
316            {
317              "INTERNAL_ID": 1,
318              "RECORDS": [
319                {
320                  "DATA_SOURCE": "TEST",
321                  "RECORD_ID": "1"
322                }
323              ]
324            },
325            {
326              "INTERNAL_ID": 400010,
327              "RECORDS": [
328                {
329                  "DATA_SOURCE": "CUSTOMERS",
330                  "RECORD_ID": "1004"
331                }
332              ]
333            },
334            {
335              "INTERNAL_ID": 400011,
336              "RECORDS": [
337                {
338                  "DATA_SOURCE": "CUSTOMERS",
339                  "RECORD_ID": "1002"
340                }
341              ]
342            }
343          ]
344        },
345        "VIRTUAL_ENTITY_2": {
346          "VIRTUAL_ENTITY_ID": "V500001",
347          "MEMBER_RECORDS": [
348            {
349              "INTERNAL_ID": 500001,
350              "RECORDS": [
351                {
352                  "DATA_SOURCE": "CUSTOMERS",
353                  "RECORD_ID": "1001"
354                }
355              ]
356            }
357          ]
358        },
359        "INBOUND_VIRTUAL_ENTITY_ID": "V1-S2",
360        "RESULT_VIRTUAL_ENTITY_ID": "V1-S3",
361        "MATCH_INFO": {
362          "MATCH_KEY": "+NAME+DOB+ADDRESS+PHONE+EMAIL",
363          "ERRULE_CODE": "SF1_SNAME_CFF_CSTAB",
364          "CANDIDATE_KEYS": {
365            "ADDR_KEY": [
366              {
367                "FEAT_ID": 7,
368                "FEAT_DESC": "123|MN||LS FKS"
369              },
370              {
371                "FEAT_ID": 8,
372                "FEAT_DESC": "123|MN||89132"
373              }
374            ],
375            "DOB": [
376              {
377                "FEAT_ID": 2,
378                "FEAT_DESC": "12/11/1978"
379              }
380            ],
381            "EMAIL_KEY": [
382              {
383                "FEAT_ID": 11,
384                "FEAT_DESC": "bsmith@WORK.COM"
385              }
386            ],
387            "NAMEADDR_KEY": [
388              {
389                "FEAT_ID": 12,
390                "FEAT_DESC": "RPRT|SM0|ADDR_KEY.EXPRESSION=123|MN||89132"
391              },
392              {
393                "FEAT_ID": 13,
394                "FEAT_DESC": "RPRT|SM0|ADDR_KEY.EXPRESSION=123|MN||LS FKS"
395              }
396            ],
397            "NAMEDATE_KEY": [
398              {
399                "FEAT_ID": 14,
400                "FEAT_DESC": "RPRT|SM0|DOB.MMDD_HASH=1211"
401              },
402              {
403                "FEAT_ID": 15,
404                "FEAT_DESC": "RPRT|SM0|DOB=71211"
405              },
406              {
407                "FEAT_ID": 16,
408                "FEAT_DESC": "RPRT|SM0|DOB.MMYY_HASH=1278"
409              }
410            ],
411            "NAMEPHONE_KEY": [
412              {
413                "FEAT_ID": 19,
414                "FEAT_DESC": "RPRT|SM0|PHONE.PHONE_LAST_5=91300"
415              }
416            ],
417            "NAMEREGION_KEY": [
418              {
419                "FEAT_ID": 17,
420                "FEAT_DESC": "RPRT|SM0|POST=89132"
421              },
422              {
423                "FEAT_ID": 18,
424                "FEAT_DESC": "RPRT|SM0|ADDRESS.CITY_STD=LS FKS"
425              }
426            ],
427            "NAME_KEY": [
428              {
429                "FEAT_ID": 6,
430                "FEAT_DESC": "RPRT|SM0"
431              }
432            ],
433            "PHONE_KEY": [
434              {
435                "FEAT_ID": 9,
436                "FEAT_DESC": "7029191300"
437              }
438            ]
439          },
440          "FEATURE_SCORES": {
441            "ADDRESS": [
442              {
443                "INBOUND_FEAT_ID": 3,
444                "INBOUND_FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
445                "INBOUND_FEAT_USAGE_TYPE": "MAILING",
446                "CANDIDATE_FEAT_ID": 3,
447                "CANDIDATE_FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
448                "CANDIDATE_FEAT_USAGE_TYPE": "MAILING",
449                "SCORE": 100,
450                "ADDITIONAL_SCORES": {
451                  "FULL_SCORE": 100
452                },
453                "SCORE_BUCKET": "SAME",
454                "SCORE_BEHAVIOR": "FF"
455              }
456            ],
457            "DOB": [
458              {
459                "INBOUND_FEAT_ID": 2,
460                "INBOUND_FEAT_DESC": "12/11/1978",
461                "INBOUND_FEAT_USAGE_TYPE": "",
462                "CANDIDATE_FEAT_ID": 2,
463                "CANDIDATE_FEAT_DESC": "12/11/1978",
464                "CANDIDATE_FEAT_USAGE_TYPE": "",
465                "SCORE": 100,
466                "ADDITIONAL_SCORES": {
467                  "FULL_SCORE": 100
468                },
469                "SCORE_BUCKET": "SAME",
470                "SCORE_BEHAVIOR": "FMES"
471              }
472            ],
473            "EMAIL": [
474              {
475                "INBOUND_FEAT_ID": 5,
476                "INBOUND_FEAT_DESC": "bsmith@work.com",
477                "INBOUND_FEAT_USAGE_TYPE": "",
478                "CANDIDATE_FEAT_ID": 5,
479                "CANDIDATE_FEAT_DESC": "bsmith@work.com",
480                "CANDIDATE_FEAT_USAGE_TYPE": "",
481                "SCORE": 100,
482                "ADDITIONAL_SCORES": {
483                  "FULL_SCORE": 100
484                },
485                "SCORE_BUCKET": "SAME",
486                "SCORE_BEHAVIOR": "F1"
487              }
488            ],
489            "NAME": [
490              {
491                "INBOUND_FEAT_ID": 1,
492                "INBOUND_FEAT_DESC": "Robert Smith",
493                "INBOUND_FEAT_USAGE_TYPE": "PRIMARY",
494                "CANDIDATE_FEAT_ID": 1,
495                "CANDIDATE_FEAT_DESC": "Robert Smith",
496                "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
497                "SCORE": 100,
498                "ADDITIONAL_SCORES": {
499                  "GNR_FN": 100,
500                  "GNR_SN": 100,
501                  "GNR_GN": 100,
502                  "GENERATION_MATCH": -1,
503                  "GNR_ON": -1
504                },
505                "SCORE_BUCKET": "SAME",
506                "SCORE_BEHAVIOR": "NAME"
507              }
508            ],
509            "PHONE": [
510              {
511                "INBOUND_FEAT_ID": 4,
512                "INBOUND_FEAT_DESC": "702-919-1300",
513                "INBOUND_FEAT_USAGE_TYPE": "HOME",
514                "CANDIDATE_FEAT_ID": 4,
515                "CANDIDATE_FEAT_DESC": "702-919-1300",
516                "CANDIDATE_FEAT_USAGE_TYPE": "HOME",
517                "SCORE": 100,
518                "ADDITIONAL_SCORES": {
519                  "FULL_SCORE": 100
520                },
521                "SCORE_BUCKET": "SAME",
522                "SCORE_BEHAVIOR": "FF"
523              }
524            ],
525            "RECORD_TYPE": [
526              {
527                "INBOUND_FEAT_ID": 10,
528                "INBOUND_FEAT_DESC": "PERSON",
529                "INBOUND_FEAT_USAGE_TYPE": "",
530                "CANDIDATE_FEAT_ID": 10,
531                "CANDIDATE_FEAT_DESC": "PERSON",
532                "CANDIDATE_FEAT_USAGE_TYPE": "",
533                "SCORE": 100,
534                "ADDITIONAL_SCORES": {
535                  "FULL_SCORE": 100
536                },
537                "SCORE_BUCKET": "SAME",
538                "SCORE_BEHAVIOR": "FVME"
539              }
540            ]
541          }
542        }
543      },
544      {
545        "STEP": 4,
546        "VIRTUAL_ENTITY_1": {
547          "VIRTUAL_ENTITY_ID": "V1-S3",
548          "MEMBER_RECORDS": [
549            {
550              "INTERNAL_ID": 1,
551              "RECORDS": [
552                {
553                  "DATA_SOURCE": "TEST",
554                  "RECORD_ID": "1"
555                }
556              ]
557            },
558            {
559              "INTERNAL_ID": 400010,
560              "RECORDS": [
561                {
562                  "DATA_SOURCE": "CUSTOMERS",
563                  "RECORD_ID": "1004"
564                }
565              ]
566            },
567            {
568              "INTERNAL_ID": 400011,
569              "RECORDS": [
570                {
571                  "DATA_SOURCE": "CUSTOMERS",
572                  "RECORD_ID": "1002"
573                }
574              ]
575            },
576            {
577              "INTERNAL_ID": 500001,
578              "RECORDS": [
579                {
580                  "DATA_SOURCE": "CUSTOMERS",
581                  "RECORD_ID": "1001"
582                }
583              ]
584            }
585          ]
586        },
587        "VIRTUAL_ENTITY_2": {
588          "VIRTUAL_ENTITY_ID": "V400001",
589          "MEMBER_RECORDS": [
590            {
591              "INTERNAL_ID": 400001,
592              "RECORDS": [
593                {
594                  "DATA_SOURCE": "CUSTOMERS",
595                  "RECORD_ID": "1003"
596                }
597              ]
598            }
599          ]
600        },
601        "INBOUND_VIRTUAL_ENTITY_ID": "V1-S3",
602        "RESULT_VIRTUAL_ENTITY_ID": "V1-S4",
603        "MATCH_INFO": {
604          "MATCH_KEY": "+NAME+DOB+EMAIL",
605          "ERRULE_CODE": "SF1_PNAME_CSTAB",
606          "CANDIDATE_KEYS": {
607            "DOB": [
608              {
609                "FEAT_ID": 2,
610                "FEAT_DESC": "12/11/1978"
611              }
612            ],
613            "EMAIL_KEY": [
614              {
615                "FEAT_ID": 11,
616                "FEAT_DESC": "bsmith@WORK.COM"
617              }
618            ],
619            "NAMEDATE_KEY": [
620              {
621                "FEAT_ID": 14,
622                "FEAT_DESC": "RPRT|SM0|DOB.MMDD_HASH=1211"
623              },
624              {
625                "FEAT_ID": 15,
626                "FEAT_DESC": "RPRT|SM0|DOB=71211"
627              },
628              {
629                "FEAT_ID": 16,
630                "FEAT_DESC": "RPRT|SM0|DOB.MMYY_HASH=1278"
631              },
632              {
633                "FEAT_ID": 200005,
634                "FEAT_DESC": "PP|SM0|DOB=71211"
635              },
636              {
637                "FEAT_ID": 200007,
638                "FEAT_DESC": "PP|SM0|DOB.MMDD_HASH=1211"
639              }
640            ],
641            "NAME_KEY": [
642              {
643                "FEAT_ID": 6,
644                "FEAT_DESC": "RPRT|SM0"
645              },
646              {
647                "FEAT_ID": 200002,
648                "FEAT_DESC": "PP|SM0"
649              }
650            ]
651          },
652          "FEATURE_SCORES": {
653            "DOB": [
654              {
655                "INBOUND_FEAT_ID": 2,
656                "INBOUND_FEAT_DESC": "12/11/1978",
657                "INBOUND_FEAT_USAGE_TYPE": "",
658                "CANDIDATE_FEAT_ID": 2,
659                "CANDIDATE_FEAT_DESC": "12/11/1978",
660                "CANDIDATE_FEAT_USAGE_TYPE": "",
661                "SCORE": 100,
662                "ADDITIONAL_SCORES": {
663                  "FULL_SCORE": 100
664                },
665                "SCORE_BUCKET": "SAME",
666                "SCORE_BEHAVIOR": "FMES"
667              }
668            ],
669            "EMAIL": [
670              {
671                "INBOUND_FEAT_ID": 5,
672                "INBOUND_FEAT_DESC": "bsmith@work.com",
673                "INBOUND_FEAT_USAGE_TYPE": "",
674                "CANDIDATE_FEAT_ID": 5,
675                "CANDIDATE_FEAT_DESC": "bsmith@work.com",
676                "CANDIDATE_FEAT_USAGE_TYPE": "",
677                "SCORE": 100,
678                "ADDITIONAL_SCORES": {
679                  "FULL_SCORE": 100
680                },
681                "SCORE_BUCKET": "SAME",
682                "SCORE_BEHAVIOR": "F1"
683              }
684            ],
685            "NAME": [
686              {
687                "INBOUND_FEAT_ID": 200057,
688                "INBOUND_FEAT_DESC": "Bob Smith",
689                "INBOUND_FEAT_USAGE_TYPE": "PRIMARY",
690                "CANDIDATE_FEAT_ID": 200001,
691                "CANDIDATE_FEAT_DESC": "Bob J Smith",
692                "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
693                "SCORE": 93,
694                "ADDITIONAL_SCORES": {
695                  "GNR_FN": 93,
696                  "GNR_SN": 100,
697                  "GNR_GN": 93,
698                  "GENERATION_MATCH": -1,
699                  "GNR_ON": -1
700                },
701                "SCORE_BUCKET": "CLOSE",
702                "SCORE_BEHAVIOR": "NAME"
703              }
704            ],
705            "RECORD_TYPE": [
706              {
707                "INBOUND_FEAT_ID": 10,
708                "INBOUND_FEAT_DESC": "PERSON",
709                "INBOUND_FEAT_USAGE_TYPE": "",
710                "CANDIDATE_FEAT_ID": 10,
711                "CANDIDATE_FEAT_DESC": "PERSON",
712                "CANDIDATE_FEAT_USAGE_TYPE": "",
713                "SCORE": 100,
714                "ADDITIONAL_SCORES": {
715                  "FULL_SCORE": 100
716                },
717                "SCORE_BUCKET": "SAME",
718                "SCORE_BEHAVIOR": "FVME"
719              }
720            ]
721          }
722        }
723      }
724    ],
725    "FINAL_STATE": {
726      "NEED_REEVALUATION": 0,
727      "VIRTUAL_ENTITIES": [
728        {
729          "VIRTUAL_ENTITY_ID": "V1-S4",
730          "MEMBER_RECORDS": [
731            {
732              "INTERNAL_ID": 1,
733              "RECORDS": [
734                {
735                  "DATA_SOURCE": "TEST",
736                  "RECORD_ID": "1"
737                }
738              ]
739            },
740            {
741              "INTERNAL_ID": 400001,
742              "RECORDS": [
743                {
744                  "DATA_SOURCE": "CUSTOMERS",
745                  "RECORD_ID": "1003"
746                }
747              ]
748            },
749            {
750              "INTERNAL_ID": 400010,
751              "RECORDS": [
752                {
753                  "DATA_SOURCE": "CUSTOMERS",
754                  "RECORD_ID": "1004"
755                }
756              ]
757            },
758            {
759              "INTERNAL_ID": 400011,
760              "RECORDS": [
761                {
762                  "DATA_SOURCE": "CUSTOMERS",
763                  "RECORD_ID": "1002"
764                }
765              ]
766            },
767            {
768              "INTERNAL_ID": 500001,
769              "RECORDS": [
770                {
771                  "DATA_SOURCE": "CUSTOMERS",
772                  "RECORD_ID": "1001"
773                }
774              ]
775            }
776          ]
777        }
778      ]
779    }
780  }
781}
property is_destroyed: bool

Return if the instance has been destroyed.

prime_engine() None[source]

The prime_engine method pre-loads engine resources.

Explicitly calling this method ensures the performance cost is incurred at a predictable time rather than unexpectedly with the first call requiring the resources.

Raises:

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_engine = sz_abstract_factory.create_engine()
18    sz_engine.prime_engine()
19except SzError as err:
20    print(f"\nERROR: {err}\n")
process_redo_record(redo_record: str, flags: int = <SzEngineFlags.SZ_NO_FLAGS: 0>) str[source]

The process_redo_record method processes the provided redo record.

This operation performs entity resolution.

Calling processRedoRecord() has the potential to create more redo records in certain situations.

See also getRedoRecord(), countRedoRecords()

Parameters:
  • redo_record (str) – A redo record retrieved from get_redo_record.

  • flags (int, optional) – Flags used to control information returned. Defaults to 0.

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5flags = SzEngineFlags.SZ_WITH_INFO
 6instance_name = "Example"
 7settings = {
 8    "PIPELINE": {
 9        "CONFIGPATH": "/etc/opt/senzing",
10        "RESOURCEPATH": "/opt/senzing/er/resources",
11        "SUPPORTPATH": "/opt/senzing/data",
12    },
13    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
14}
15
16try:
17    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
18    sz_engine = sz_abstract_factory.create_engine()
19    while True:
20        redo_record = sz_engine.get_redo_record()
21        if not redo_record:
22            break
23        result = sz_engine.process_redo_record(redo_record, flags)
24        print(result)
25except SzError as err:
26    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "DATA_SOURCE": "CUSTOMERS",
 5  "RECORD_ID": "2207",
 6  "AFFECTED_ENTITIES": [
 7    {
 8      "ENTITY_ID": 305
 9    }
10  ]
11}
reevaluate_entity(entity_id: int, flags: int = <SzEngineFlags.SZ_NO_FLAGS: 0>) str[source]

The reevaluate_entity method reevaluates an entity by entity ID.

This operation performs entity resolution.

If the entity is not found, then no changes are made.

Parameters:
  • entity_id (int) – The unique identifier of an entity.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_REEVALUATE_ENTITY_DEFAULT_FLAGS.

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5entity_id = 1
 6flags = SzEngineFlags.SZ_WITH_INFO
 7instance_name = "Example"
 8settings = {
 9    "PIPELINE": {
10        "CONFIGPATH": "/etc/opt/senzing",
11        "RESOURCEPATH": "/opt/senzing/er/resources",
12        "SUPPORTPATH": "/opt/senzing/data",
13    },
14    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
15}
16
17try:
18    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
19    sz_engine = sz_abstract_factory.create_engine()
20    result = sz_engine.reevaluate_entity(entity_id, flags)
21    print(f"\n{result}\n")
22except SzError as err:
23    print(f"\nERROR: {err}\n")

Output:

1// Output has been formatted for easier reading.
2
3{
4  "AFFECTED_ENTITIES": [
5    {
6      "ENTITY_ID": 1
7    }
8  ]
9}
reevaluate_record(data_source_code: str, record_id: str, flags: int = <SzEngineFlags.SZ_NO_FLAGS: 0>) str[source]

The reevaluate_record method reevaluates an entity by record ID.

This operation performs entity resolution.

If the record is not found, then no changes are made.

Parameters:
  • data_source_code (str) – Identifies the provenance of the data.

  • record_id (str) – The unique identifier within the records of the same data source.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_REEVALUATE_RECORD_DEFAULT_FLAGS.

Returns:

If flags are set to return the WITH_INFO response a JSON document containing the details, otherwise an empty string.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5data_source_code = "CUSTOMERS"
 6flags = SzEngineFlags.SZ_WITH_INFO
 7instance_name = "Example"
 8record_id = "1001"
 9settings = {
10    "PIPELINE": {
11        "CONFIGPATH": "/etc/opt/senzing",
12        "RESOURCEPATH": "/opt/senzing/er/resources",
13        "SUPPORTPATH": "/opt/senzing/data",
14    },
15    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
16}
17
18try:
19    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
20    sz_engine = sz_abstract_factory.create_engine()
21    result = sz_engine.reevaluate_record(data_source_code, record_id, flags)
22    print(f"\n{result}\n")
23except SzError as err:
24    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "DATA_SOURCE": "CUSTOMERS",
 5  "RECORD_ID": "1001",
 6  "AFFECTED_ENTITIES": [
 7    {
 8      "ENTITY_ID": 35
 9    }
10  ]
11}
search_by_attributes(attributes: str, flags: int = <SzEngineFlags.SZ_SEARCH_BY_ATTRIBUTES_ALL: 201340943>, search_profile: str = '') str[source]

The search_by_attributes method searches for entities that match or relate to the provided attributes.

The default search profile is SEARCH. Alternatively, INGEST may be used.

Parameters:
  • attributes (str) – A JSON document with the attribute data to search for.

  • flags (int, optional) – _description_. Defaults to SzEngineFlags.SZ_SEARCH_BY_ATTRIBUTES_DEFAULT_FLAGS.

  • search_profile (str) – The name of a configured search profile. Defaults to SEARCH.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1import json
 2
 3from senzing import SzEngineFlags, SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7attributes = json.dumps({"NAME_FULL": "Bob Smith", "EMAIL_ADDRESS": "bsmith@work.com"})
 8flags = SzEngineFlags.SZ_SEARCH_BY_ATTRIBUTES_DEFAULT_FLAGS
 9instance_name = "Example"
10settings = {
11    "PIPELINE": {
12        "CONFIGPATH": "/etc/opt/senzing",
13        "RESOURCEPATH": "/opt/senzing/er/resources",
14        "SUPPORTPATH": "/opt/senzing/data",
15    },
16    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
17}
18
19try:
20    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
21    sz_engine = sz_abstract_factory.create_engine()
22    result = sz_engine.search_by_attributes(attributes, flags)
23    print(f"\n{result}\n")
24except SzError as err:
25    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "RESOLVED_ENTITIES": [
  5    {
  6      "MATCH_INFO": {
  7        "MATCH_LEVEL_CODE": "RESOLVED",
  8        "MATCH_KEY": "+NAME+EMAIL",
  9        "ERRULE_CODE": "SF1_CNAME",
 10        "CANDIDATE_KEYS": {
 11          "EMAIL_KEY": [
 12            {
 13              "FEAT_ID": 11,
 14              "FEAT_DESC": "bsmith@WORK.COM"
 15            }
 16          ],
 17          "NAME_KEY": [
 18            {
 19              "FEAT_ID": 6,
 20              "FEAT_DESC": "RPRT|SM0"
 21            },
 22            {
 23              "FEAT_ID": 200002,
 24              "FEAT_DESC": "PP|SM0"
 25            }
 26          ]
 27        },
 28        "FEATURE_SCORES": {
 29          "EMAIL": [
 30            {
 31              "INBOUND_FEAT_ID": 5,
 32              "INBOUND_FEAT_DESC": "bsmith@work.com",
 33              "INBOUND_FEAT_USAGE_TYPE": "",
 34              "CANDIDATE_FEAT_ID": 5,
 35              "CANDIDATE_FEAT_DESC": "bsmith@work.com",
 36              "CANDIDATE_FEAT_USAGE_TYPE": "",
 37              "SCORE": 100,
 38              "ADDITIONAL_SCORES": {
 39                "FULL_SCORE": 100
 40              },
 41              "SCORE_BUCKET": "SAME",
 42              "SCORE_BEHAVIOR": "F1"
 43            }
 44          ],
 45          "NAME": [
 46            {
 47              "INBOUND_FEAT_ID": -2,
 48              "INBOUND_FEAT_DESC": "Bob Smith",
 49              "INBOUND_FEAT_USAGE_TYPE": "",
 50              "CANDIDATE_FEAT_ID": 1,
 51              "CANDIDATE_FEAT_DESC": "Robert Smith",
 52              "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
 53              "SCORE": 97,
 54              "ADDITIONAL_SCORES": {
 55                "GNR_FN": 97,
 56                "GNR_SN": -1,
 57                "GNR_GN": -1,
 58                "GENERATION_MATCH": -1,
 59                "GNR_ON": -1
 60              },
 61              "SCORE_BUCKET": "CLOSE",
 62              "SCORE_BEHAVIOR": "NAME"
 63            }
 64          ]
 65        }
 66      },
 67      "ENTITY": {
 68        "RESOLVED_ENTITY": {
 69          "ENTITY_ID": 1,
 70          "ENTITY_NAME": "Robert Smith",
 71          "FEATURES": {
 72            "ADDRESS": [
 73              {
 74                "FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 75                "LIB_FEAT_ID": 200059,
 76                "USAGE_TYPE": "HOME",
 77                "FEAT_DESC_VALUES": [
 78                  {
 79                    "FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 80                    "LIB_FEAT_ID": 200059
 81                  },
 82                  {
 83                    "FEAT_DESC": "1515 Adela Ln Las Vegas NV 89132",
 84                    "LIB_FEAT_ID": 200046
 85                  }
 86                ]
 87              },
 88              {
 89                "FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 90                "LIB_FEAT_ID": 3,
 91                "USAGE_TYPE": "MAILING",
 92                "FEAT_DESC_VALUES": [
 93                  {
 94                    "FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 95                    "LIB_FEAT_ID": 3
 96                  }
 97                ]
 98              }
 99            ],
100            "DOB": [
101              {
102                "FEAT_DESC": "11/12/1979",
103                "LIB_FEAT_ID": 200045,
104                "FEAT_DESC_VALUES": [
105                  {
106                    "FEAT_DESC": "11/12/1979",
107                    "LIB_FEAT_ID": 200045
108                  }
109                ]
110              },
111              {
112                "FEAT_DESC": "12/11/1978",
113                "LIB_FEAT_ID": 2,
114                "FEAT_DESC_VALUES": [
115                  {
116                    "FEAT_DESC": "12/11/1978",
117                    "LIB_FEAT_ID": 2
118                  },
119                  {
120                    "FEAT_DESC": "11/12/1978",
121                    "LIB_FEAT_ID": 200058
122                  }
123                ]
124              }
125            ],
126            "EMAIL": [
127              {
128                "FEAT_DESC": "bsmith@work.com",
129                "LIB_FEAT_ID": 5,
130                "FEAT_DESC_VALUES": [
131                  {
132                    "FEAT_DESC": "bsmith@work.com",
133                    "LIB_FEAT_ID": 5
134                  }
135                ]
136              }
137            ],
138            "NAME": [
139              {
140                "FEAT_DESC": "B Smith",
141                "LIB_FEAT_ID": 200044,
142                "USAGE_TYPE": "PRIMARY",
143                "FEAT_DESC_VALUES": [
144                  {
145                    "FEAT_DESC": "B Smith",
146                    "LIB_FEAT_ID": 200044
147                  }
148                ]
149              },
150              {
151                "FEAT_DESC": "Robert Smith",
152                "LIB_FEAT_ID": 1,
153                "USAGE_TYPE": "PRIMARY",
154                "FEAT_DESC_VALUES": [
155                  {
156                    "FEAT_DESC": "Robert Smith",
157                    "LIB_FEAT_ID": 1
158                  },
159                  {
160                    "FEAT_DESC": "Bob J Smith",
161                    "LIB_FEAT_ID": 200001
162                  },
163                  {
164                    "FEAT_DESC": "Bob Smith",
165                    "LIB_FEAT_ID": 200057
166                  }
167                ]
168              }
169            ],
170            "PHONE": [
171              {
172                "FEAT_DESC": "702-919-1300",
173                "LIB_FEAT_ID": 4,
174                "USAGE_TYPE": "HOME",
175                "FEAT_DESC_VALUES": [
176                  {
177                    "FEAT_DESC": "702-919-1300",
178                    "LIB_FEAT_ID": 4
179                  }
180                ]
181              },
182              {
183                "FEAT_DESC": "702-919-1300",
184                "LIB_FEAT_ID": 4,
185                "USAGE_TYPE": "MOBILE",
186                "FEAT_DESC_VALUES": [
187                  {
188                    "FEAT_DESC": "702-919-1300",
189                    "LIB_FEAT_ID": 4
190                  }
191                ]
192              }
193            ],
194            "RECORD_TYPE": [
195              {
196                "FEAT_DESC": "PERSON",
197                "LIB_FEAT_ID": 10,
198                "FEAT_DESC_VALUES": [
199                  {
200                    "FEAT_DESC": "PERSON",
201                    "LIB_FEAT_ID": 10
202                  }
203                ]
204              }
205            ]
206          },
207          "RECORD_SUMMARY": [
208            {
209              "DATA_SOURCE": "TEST",
210              "RECORD_COUNT": 1
211            },
212            {
213              "DATA_SOURCE": "CUSTOMERS",
214              "RECORD_COUNT": 4
215            }
216          ]
217        }
218      }
219    },
220    {
221      "MATCH_INFO": {
222        "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
223        "MATCH_KEY": "+NAME",
224        "ERRULE_CODE": "SNAME",
225        "CANDIDATE_KEYS": {
226          "NAME_KEY": [
227            {
228              "FEAT_ID": 6,
229              "FEAT_DESC": "RPRT|SM0"
230            }
231          ]
232        },
233        "FEATURE_SCORES": {
234          "NAME": [
235            {
236              "INBOUND_FEAT_ID": -2,
237              "INBOUND_FEAT_DESC": "Bob Smith",
238              "INBOUND_FEAT_USAGE_TYPE": "",
239              "CANDIDATE_FEAT_ID": 200087,
240              "CANDIDATE_FEAT_DESC": "Robbie Smith",
241              "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
242              "SCORE": 97,
243              "ADDITIONAL_SCORES": {
244                "GNR_FN": 97,
245                "GNR_SN": -1,
246                "GNR_GN": -1,
247                "GENERATION_MATCH": -1,
248                "GNR_ON": -1
249              },
250              "SCORE_BUCKET": "CLOSE",
251              "SCORE_BEHAVIOR": "NAME"
252            }
253          ]
254        }
255      },
256      "ENTITY": {
257        "RESOLVED_ENTITY": {
258          "ENTITY_ID": 400015,
259          "ENTITY_NAME": "Robert E Smith Sr",
260          "FEATURES": {
261            "ADDRESS": [
262              {
263                "FEAT_DESC": "123 E Main St Henderson NV 89132",
264                "LIB_FEAT_ID": 200088,
265                "USAGE_TYPE": "MAILING",
266                "FEAT_DESC_VALUES": [
267                  {
268                    "FEAT_DESC": "123 E Main St Henderson NV 89132",
269                    "LIB_FEAT_ID": 200088
270                  }
271                ]
272              },
273              {
274                "FEAT_DESC": "123 Main St, Las Vegas",
275                "LIB_FEAT_ID": 201464,
276                "USAGE_TYPE": "MAILING",
277                "FEAT_DESC_VALUES": [
278                  {
279                    "FEAT_DESC": "123 Main St, Las Vegas",
280                    "LIB_FEAT_ID": 201464
281                  }
282                ]
283              }
284            ],
285            "DOB": [
286              {
287                "FEAT_DESC": "3/31/1954",
288                "LIB_FEAT_ID": 201463,
289                "FEAT_DESC_VALUES": [
290                  {
291                    "FEAT_DESC": "3/31/1954",
292                    "LIB_FEAT_ID": 201463
293                  }
294                ]
295              }
296            ],
297            "DRLIC": [
298              {
299                "FEAT_DESC": "112233 NV",
300                "LIB_FEAT_ID": 200089,
301                "FEAT_DESC_VALUES": [
302                  {
303                    "FEAT_DESC": "112233 NV",
304                    "LIB_FEAT_ID": 200089
305                  }
306                ]
307              }
308            ],
309            "NAME": [
310              {
311                "FEAT_DESC": "Robert E Smith Sr",
312                "LIB_FEAT_ID": 201462,
313                "USAGE_TYPE": "PRIMARY",
314                "FEAT_DESC_VALUES": [
315                  {
316                    "FEAT_DESC": "Robert E Smith Sr",
317                    "LIB_FEAT_ID": 201462
318                  },
319                  {
320                    "FEAT_DESC": "Robbie Smith",
321                    "LIB_FEAT_ID": 200087
322                  }
323                ]
324              }
325            ],
326            "RECORD_TYPE": [
327              {
328                "FEAT_DESC": "PERSON",
329                "LIB_FEAT_ID": 10,
330                "FEAT_DESC_VALUES": [
331                  {
332                    "FEAT_DESC": "PERSON",
333                    "LIB_FEAT_ID": 10
334                  }
335                ]
336              }
337            ]
338          },
339          "RECORD_SUMMARY": [
340            {
341              "DATA_SOURCE": "CUSTOMERS",
342              "RECORD_COUNT": 1
343            },
344            {
345              "DATA_SOURCE": "WATCHLIST",
346              "RECORD_COUNT": 1
347            }
348          ]
349        }
350      }
351    },
352    {
353      "MATCH_INFO": {
354        "MATCH_LEVEL_CODE": "POSSIBLY_SAME",
355        "MATCH_KEY": "+NAME",
356        "ERRULE_CODE": "SNAME",
357        "CANDIDATE_KEYS": {
358          "NAME_KEY": [
359            {
360              "FEAT_ID": 6,
361              "FEAT_DESC": "RPRT|SM0"
362            }
363          ]
364        },
365        "FEATURE_SCORES": {
366          "EMAIL": [
367            {
368              "INBOUND_FEAT_ID": 5,
369              "INBOUND_FEAT_DESC": "bsmith@work.com",
370              "INBOUND_FEAT_USAGE_TYPE": "",
371              "CANDIDATE_FEAT_ID": 201427,
372              "CANDIDATE_FEAT_DESC": "robert.smith@email.com",
373              "CANDIDATE_FEAT_USAGE_TYPE": "",
374              "SCORE": 0,
375              "ADDITIONAL_SCORES": {
376                "FULL_SCORE": 0
377              },
378              "SCORE_BUCKET": "NO_CHANCE",
379              "SCORE_BEHAVIOR": "F1"
380            }
381          ],
382          "NAME": [
383            {
384              "INBOUND_FEAT_ID": -2,
385              "INBOUND_FEAT_DESC": "Bob Smith",
386              "INBOUND_FEAT_USAGE_TYPE": "",
387              "CANDIDATE_FEAT_ID": 1,
388              "CANDIDATE_FEAT_DESC": "Robert Smith",
389              "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
390              "SCORE": 97,
391              "ADDITIONAL_SCORES": {
392                "GNR_FN": 97,
393                "GNR_SN": -1,
394                "GNR_GN": -1,
395                "GENERATION_MATCH": -1,
396                "GNR_ON": -1
397              },
398              "SCORE_BUCKET": "CLOSE",
399              "SCORE_BEHAVIOR": "NAME"
400            }
401          ]
402        }
403      },
404      "ENTITY": {
405        "RESOLVED_ENTITY": {
406          "ENTITY_ID": 400204,
407          "ENTITY_NAME": "Robert Smith",
408          "FEATURES": {
409            "EMAIL": [
410              {
411                "FEAT_DESC": "robert.smith@email.com",
412                "LIB_FEAT_ID": 201427,
413                "FEAT_DESC_VALUES": [
414                  {
415                    "FEAT_DESC": "robert.smith@email.com",
416                    "LIB_FEAT_ID": 201427
417                  }
418                ]
419              }
420            ],
421            "NAME": [
422              {
423                "FEAT_DESC": "Robert Smith",
424                "LIB_FEAT_ID": 1,
425                "USAGE_TYPE": "PRIMARY",
426                "FEAT_DESC_VALUES": [
427                  {
428                    "FEAT_DESC": "Robert Smith",
429                    "LIB_FEAT_ID": 1
430                  }
431                ]
432              }
433            ],
434            "RECORD_TYPE": [
435              {
436                "FEAT_DESC": "PERSON",
437                "LIB_FEAT_ID": 10,
438                "FEAT_DESC_VALUES": [
439                  {
440                    "FEAT_DESC": "PERSON",
441                    "LIB_FEAT_ID": 10
442                  }
443                ]
444              }
445            ]
446          },
447          "RECORD_SUMMARY": [
448            {
449              "DATA_SOURCE": "WATCHLIST",
450              "RECORD_COUNT": 1
451            }
452          ]
453        }
454      }
455    }
456  ],
457  "SEARCH_STATISTICS": [
458    {
459      "CANDIDATE_KEYS": {
460        "FEATURE_TYPES": [
461          {
462            "FTYPE_CODE": "NAME_KEY",
463            "FOUND": 2,
464            "NOT_FOUND": 0,
465            "GENERIC": 0
466          },
467          {
468            "FTYPE_CODE": "EMAIL_KEY",
469            "FOUND": 1,
470            "NOT_FOUND": 0,
471            "GENERIC": 0
472          }
473        ],
474        "SUMMARY": {
475          "FOUND": 3,
476          "NOT_FOUND": 0,
477          "GENERIC": 0
478        }
479      }
480    }
481  ]
482}
why_entities(entity_id_1: int, entity_id_2: int, flags: int = <SzEngineFlags.SZ_INCLUDE_FEATURE_SCORES: 67108864>) str[source]

The why_entities method describes the ways two entities relate to each other.

Parameters:
  • entity_id_1 (int) – The entity ID for the starting entity of the search path.

  • entity_id_2 (int) – The entity ID for the ending entity of the search path.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_WHY_ENTITIES_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5entity_id_1 = 1
 6entity_id_2 = 400215
 7flags = SzEngineFlags.SZ_WHY_ENTITIES_DEFAULT_FLAGS
 8instance_name = "Example"
 9settings = {
10    "PIPELINE": {
11        "CONFIGPATH": "/etc/opt/senzing",
12        "RESOURCEPATH": "/opt/senzing/er/resources",
13        "SUPPORTPATH": "/opt/senzing/data",
14    },
15    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
16}
17
18try:
19    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
20    sz_engine = sz_abstract_factory.create_engine()
21    result = sz_engine.why_entities(
22        entity_id_1,
23        entity_id_2,
24        flags,
25    )
26    print(f"\n{result}\n")
27except SzError as err:
28    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "WHY_RESULTS": [
  5    {
  6      "ENTITY_ID": 1,
  7      "ENTITY_ID_2": 400215,
  8      "MATCH_INFO": {
  9        "WHY_KEY": "+SURNAME+ADDRESS",
 10        "WHY_ERRULE_CODE": "CFF_SURNAME",
 11        "MATCH_LEVEL_CODE": "POSSIBLY_RELATED",
 12        "CANDIDATE_KEYS": {
 13          "ADDR_KEY": [
 14            {
 15              "FEAT_ID": 200049,
 16              "FEAT_DESC": "1515|ATL||89132"
 17            }
 18          ]
 19        },
 20        "FEATURE_SCORES": {
 21          "ADDRESS": [
 22            {
 23              "INBOUND_FEAT_ID": 200046,
 24              "INBOUND_FEAT_DESC": "1515 Adela Ln Las Vegas NV 89132",
 25              "INBOUND_FEAT_USAGE_TYPE": "HOME",
 26              "CANDIDATE_FEAT_ID": 201474,
 27              "CANDIDATE_FEAT_DESC": "1515 Adela Ln, LV, NV 89132",
 28              "CANDIDATE_FEAT_USAGE_TYPE": "HOME",
 29              "SCORE": 100,
 30              "ADDITIONAL_SCORES": {
 31                "FULL_SCORE": 100
 32              },
 33              "SCORE_BUCKET": "SAME",
 34              "SCORE_BEHAVIOR": "FF"
 35            }
 36          ],
 37          "EMAIL": [
 38            {
 39              "INBOUND_FEAT_ID": 5,
 40              "INBOUND_FEAT_DESC": "bsmith@work.com",
 41              "INBOUND_FEAT_USAGE_TYPE": "",
 42              "CANDIDATE_FEAT_ID": 201475,
 43              "CANDIDATE_FEAT_DESC": "psmith@email.com",
 44              "CANDIDATE_FEAT_USAGE_TYPE": "",
 45              "SCORE": 0,
 46              "ADDITIONAL_SCORES": {
 47                "FULL_SCORE": 0
 48              },
 49              "SCORE_BUCKET": "NO_CHANCE",
 50              "SCORE_BEHAVIOR": "F1"
 51            }
 52          ],
 53          "NAME": [
 54            {
 55              "INBOUND_FEAT_ID": 1,
 56              "INBOUND_FEAT_DESC": "Robert Smith",
 57              "INBOUND_FEAT_USAGE_TYPE": "PRIMARY",
 58              "CANDIDATE_FEAT_ID": 200291,
 59              "CANDIDATE_FEAT_DESC": "Patricia Smith",
 60              "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
 61              "SCORE": 49,
 62              "ADDITIONAL_SCORES": {
 63                "GNR_FN": 49,
 64                "GNR_SN": 100,
 65                "GNR_GN": 0,
 66                "GENERATION_MATCH": -1,
 67                "GNR_ON": -1
 68              },
 69              "SCORE_BUCKET": "NO_CHANCE",
 70              "SCORE_BEHAVIOR": "NAME"
 71            }
 72          ],
 73          "RECORD_TYPE": [
 74            {
 75              "INBOUND_FEAT_ID": 10,
 76              "INBOUND_FEAT_DESC": "PERSON",
 77              "INBOUND_FEAT_USAGE_TYPE": "",
 78              "CANDIDATE_FEAT_ID": 10,
 79              "CANDIDATE_FEAT_DESC": "PERSON",
 80              "CANDIDATE_FEAT_USAGE_TYPE": "",
 81              "SCORE": 100,
 82              "ADDITIONAL_SCORES": {
 83                "FULL_SCORE": 100
 84              },
 85              "SCORE_BUCKET": "SAME",
 86              "SCORE_BEHAVIOR": "FVME"
 87            }
 88          ]
 89        },
 90        "DISCLOSED_RELATIONS": {}
 91      }
 92    }
 93  ],
 94  "ENTITIES": [
 95    {
 96      "RESOLVED_ENTITY": {
 97        "ENTITY_ID": 1
 98      }
 99    },
100    {
101      "RESOLVED_ENTITY": {
102        "ENTITY_ID": 400215
103      }
104    }
105  ]
106}
why_record_in_entity(data_source_code: str, record_id: str, flags: int = <SzEngineFlags.SZ_INCLUDE_FEATURE_SCORES: 67108864>) str[source]

The why_record_in_entity method describes the ways a record relates to the rest of its respective entity.

Parameters:
  • data_source_code (str) – Identifies the provenance of the data.

  • record_id (str) – The unique identifier within the records of the same data source.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_WHY_RECORD_IN_ENTITY_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5data_source_code = "CUSTOMERS"
 6flags = SzEngineFlags.SZ_WHY_RECORD_IN_ENTITY_DEFAULT_FLAGS
 7instance_name = "Example"
 8record_id = "1001"
 9settings = {
10    "PIPELINE": {
11        "CONFIGPATH": "/etc/opt/senzing",
12        "RESOURCEPATH": "/opt/senzing/er/resources",
13        "SUPPORTPATH": "/opt/senzing/data",
14    },
15    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
16}
17
18try:
19    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
20    sz_engine = sz_abstract_factory.create_engine()
21    result = sz_engine.why_record_in_entity(
22        data_source_code,
23        record_id,
24        flags,
25    )
26    print(f"\n{result}\n")
27except SzError as err:
28    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "WHY_RESULTS": [
  5    {
  6      "INTERNAL_ID": 500001,
  7      "ENTITY_ID": 1,
  8      "FOCUS_RECORDS": [
  9        {
 10          "DATA_SOURCE": "CUSTOMERS",
 11          "RECORD_ID": "1001"
 12        }
 13      ],
 14      "MATCH_INFO": {
 15        "WHY_KEY": "+NAME+DOB+ADDRESS+PHONE+EMAIL",
 16        "WHY_ERRULE_CODE": "SF1_SNAME_CFF_CSTAB",
 17        "MATCH_LEVEL_CODE": "RESOLVED",
 18        "CANDIDATE_KEYS": {
 19          "ADDR_KEY": [
 20            {
 21              "FEAT_ID": 7,
 22              "FEAT_DESC": "123|MN||LS FKS"
 23            },
 24            {
 25              "FEAT_ID": 8,
 26              "FEAT_DESC": "123|MN||89132"
 27            }
 28          ],
 29          "DOB": [
 30            {
 31              "FEAT_ID": 2,
 32              "FEAT_DESC": "12/11/1978"
 33            }
 34          ],
 35          "EMAIL_KEY": [
 36            {
 37              "FEAT_ID": 11,
 38              "FEAT_DESC": "bsmith@WORK.COM"
 39            }
 40          ],
 41          "NAMEADDR_KEY": [
 42            {
 43              "FEAT_ID": 12,
 44              "FEAT_DESC": "RPRT|SM0|ADDR_KEY.EXPRESSION=123|MN||89132"
 45            },
 46            {
 47              "FEAT_ID": 13,
 48              "FEAT_DESC": "RPRT|SM0|ADDR_KEY.EXPRESSION=123|MN||LS FKS"
 49            }
 50          ],
 51          "NAMEDATE_KEY": [
 52            {
 53              "FEAT_ID": 14,
 54              "FEAT_DESC": "RPRT|SM0|DOB.MMDD_HASH=1211"
 55            },
 56            {
 57              "FEAT_ID": 15,
 58              "FEAT_DESC": "RPRT|SM0|DOB=71211"
 59            },
 60            {
 61              "FEAT_ID": 16,
 62              "FEAT_DESC": "RPRT|SM0|DOB.MMYY_HASH=1278"
 63            }
 64          ],
 65          "NAMEPHONE_KEY": [
 66            {
 67              "FEAT_ID": 19,
 68              "FEAT_DESC": "RPRT|SM0|PHONE.PHONE_LAST_5=91300"
 69            }
 70          ],
 71          "NAMEREGION_KEY": [
 72            {
 73              "FEAT_ID": 17,
 74              "FEAT_DESC": "RPRT|SM0|POST=89132"
 75            },
 76            {
 77              "FEAT_ID": 18,
 78              "FEAT_DESC": "RPRT|SM0|ADDRESS.CITY_STD=LS FKS"
 79            }
 80          ],
 81          "NAME_KEY": [
 82            {
 83              "FEAT_ID": 6,
 84              "FEAT_DESC": "RPRT|SM0"
 85            }
 86          ],
 87          "PHONE_KEY": [
 88            {
 89              "FEAT_ID": 9,
 90              "FEAT_DESC": "7029191300"
 91            }
 92          ]
 93        },
 94        "FEATURE_SCORES": {
 95          "ADDRESS": [
 96            {
 97              "INBOUND_FEAT_ID": 3,
 98              "INBOUND_FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 99              "INBOUND_FEAT_USAGE_TYPE": "MAILING",
100              "CANDIDATE_FEAT_ID": 3,
101              "CANDIDATE_FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
102              "CANDIDATE_FEAT_USAGE_TYPE": "MAILING",
103              "SCORE": 100,
104              "ADDITIONAL_SCORES": {
105                "FULL_SCORE": 100
106              },
107              "SCORE_BUCKET": "SAME",
108              "SCORE_BEHAVIOR": "FF"
109            }
110          ],
111          "DOB": [
112            {
113              "INBOUND_FEAT_ID": 2,
114              "INBOUND_FEAT_DESC": "12/11/1978",
115              "INBOUND_FEAT_USAGE_TYPE": "",
116              "CANDIDATE_FEAT_ID": 2,
117              "CANDIDATE_FEAT_DESC": "12/11/1978",
118              "CANDIDATE_FEAT_USAGE_TYPE": "",
119              "SCORE": 100,
120              "ADDITIONAL_SCORES": {
121                "FULL_SCORE": 100
122              },
123              "SCORE_BUCKET": "SAME",
124              "SCORE_BEHAVIOR": "FMES"
125            }
126          ],
127          "EMAIL": [
128            {
129              "INBOUND_FEAT_ID": 5,
130              "INBOUND_FEAT_DESC": "bsmith@work.com",
131              "INBOUND_FEAT_USAGE_TYPE": "",
132              "CANDIDATE_FEAT_ID": 5,
133              "CANDIDATE_FEAT_DESC": "bsmith@work.com",
134              "CANDIDATE_FEAT_USAGE_TYPE": "",
135              "SCORE": 100,
136              "ADDITIONAL_SCORES": {
137                "FULL_SCORE": 100
138              },
139              "SCORE_BUCKET": "SAME",
140              "SCORE_BEHAVIOR": "F1"
141            }
142          ],
143          "NAME": [
144            {
145              "INBOUND_FEAT_ID": 1,
146              "INBOUND_FEAT_DESC": "Robert Smith",
147              "INBOUND_FEAT_USAGE_TYPE": "PRIMARY",
148              "CANDIDATE_FEAT_ID": 1,
149              "CANDIDATE_FEAT_DESC": "Robert Smith",
150              "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
151              "SCORE": 100,
152              "ADDITIONAL_SCORES": {
153                "GNR_FN": 100,
154                "GNR_SN": 100,
155                "GNR_GN": 100,
156                "GENERATION_MATCH": -1,
157                "GNR_ON": -1
158              },
159              "SCORE_BUCKET": "SAME",
160              "SCORE_BEHAVIOR": "NAME"
161            }
162          ],
163          "PHONE": [
164            {
165              "INBOUND_FEAT_ID": 4,
166              "INBOUND_FEAT_DESC": "702-919-1300",
167              "INBOUND_FEAT_USAGE_TYPE": "HOME",
168              "CANDIDATE_FEAT_ID": 4,
169              "CANDIDATE_FEAT_DESC": "702-919-1300",
170              "CANDIDATE_FEAT_USAGE_TYPE": "HOME",
171              "SCORE": 100,
172              "ADDITIONAL_SCORES": {
173                "FULL_SCORE": 100
174              },
175              "SCORE_BUCKET": "SAME",
176              "SCORE_BEHAVIOR": "FF"
177            }
178          ],
179          "RECORD_TYPE": [
180            {
181              "INBOUND_FEAT_ID": 10,
182              "INBOUND_FEAT_DESC": "PERSON",
183              "INBOUND_FEAT_USAGE_TYPE": "",
184              "CANDIDATE_FEAT_ID": 10,
185              "CANDIDATE_FEAT_DESC": "PERSON",
186              "CANDIDATE_FEAT_USAGE_TYPE": "",
187              "SCORE": 100,
188              "ADDITIONAL_SCORES": {
189                "FULL_SCORE": 100
190              },
191              "SCORE_BUCKET": "SAME",
192              "SCORE_BEHAVIOR": "FVME"
193            }
194          ]
195        }
196      }
197    }
198  ],
199  "ENTITIES": [
200    {
201      "RESOLVED_ENTITY": {
202        "ENTITY_ID": 1
203      }
204    }
205  ]
206}
why_records(data_source_code_1: str, record_id_1: str, data_source_code_2: str, record_id_2: str, flags: int = <SzEngineFlags.SZ_INCLUDE_FEATURE_SCORES: 67108864>) str[source]

The why_records method describes the ways two records relate to each other.

Parameters:
  • data_source_code_1 (str) – Identifies the provenance of the data.

  • record_id_1 (str) – The unique identifier within the records of the same data source.

  • data_source_code_2 (str) – Identifies the provenance of the data.

  • record_id_2 (str) – The unique identifier within the records of the same data source.

  • flags (int, optional) – Flags used to control information returned. Defaults to SzEngineFlags.SZ_WHY_RECORDS_DEFAULT_FLAGS.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1from senzing import SzEngineFlags, SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5data_source_code_1 = "CUSTOMERS"
 6data_source_code_2 = "CUSTOMERS"
 7flags = SzEngineFlags.SZ_WHY_RECORDS_DEFAULT_FLAGS
 8instance_name = "Example"
 9record_id_1 = "1001"
10record_id_2 = "1002"
11settings = {
12    "PIPELINE": {
13        "CONFIGPATH": "/etc/opt/senzing",
14        "RESOURCEPATH": "/opt/senzing/er/resources",
15        "SUPPORTPATH": "/opt/senzing/data",
16    },
17    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
18}
19
20try:
21    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
22    sz_engine = sz_abstract_factory.create_engine()
23    result = sz_engine.why_records(
24        data_source_code_1,
25        record_id_1,
26        data_source_code_2,
27        record_id_2,
28        flags,
29    )
30    print(f"\n{result}\n")
31except SzError as err:
32    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted and pruned for easier reading.
  2
  3{
  4  "WHY_RESULTS": [
  5    {
  6      "INTERNAL_ID": 500001,
  7      "ENTITY_ID": 1,
  8      "FOCUS_RECORDS": [
  9        {
 10          "DATA_SOURCE": "CUSTOMERS",
 11          "RECORD_ID": "1001"
 12        }
 13      ],
 14      "INTERNAL_ID_2": 400011,
 15      "ENTITY_ID_2": 1,
 16      "FOCUS_RECORDS_2": [
 17        {
 18          "DATA_SOURCE": "CUSTOMERS",
 19          "RECORD_ID": "1002"
 20        }
 21      ],
 22      "MATCH_INFO": {
 23        "WHY_KEY": "+NAME+DOB+PHONE",
 24        "WHY_ERRULE_CODE": "CNAME_CFF_CEXCL",
 25        "MATCH_LEVEL_CODE": "RESOLVED",
 26        "CANDIDATE_KEYS": {
 27          "NAMEDATE_KEY": [
 28            {
 29              "FEAT_ID": 14,
 30              "FEAT_DESC": "RPRT|SM0|DOB.MMDD_HASH=1211"
 31            },
 32            {
 33              "FEAT_ID": 15,
 34              "FEAT_DESC": "RPRT|SM0|DOB=71211"
 35            }
 36          ],
 37          "NAMEPHONE_KEY": [
 38            {
 39              "FEAT_ID": 19,
 40              "FEAT_DESC": "RPRT|SM0|PHONE.PHONE_LAST_5=91300"
 41            }
 42          ],
 43          "NAMEREGION_KEY": [
 44            {
 45              "FEAT_ID": 18,
 46              "FEAT_DESC": "RPRT|SM0|ADDRESS.CITY_STD=LS FKS"
 47            }
 48          ],
 49          "NAME_KEY": [
 50            {
 51              "FEAT_ID": 6,
 52              "FEAT_DESC": "RPRT|SM0"
 53            }
 54          ],
 55          "PHONE_KEY": [
 56            {
 57              "FEAT_ID": 9,
 58              "FEAT_DESC": "7029191300"
 59            }
 60          ]
 61        },
 62        "FEATURE_SCORES": {
 63          "ADDRESS": [
 64            {
 65              "INBOUND_FEAT_ID": 3,
 66              "INBOUND_FEAT_DESC": "123 Main Street, Las Vegas NV 89132",
 67              "INBOUND_FEAT_USAGE_TYPE": "MAILING",
 68              "CANDIDATE_FEAT_ID": 200059,
 69              "CANDIDATE_FEAT_DESC": "1515 Adela Lane Las Vegas NV 89111",
 70              "CANDIDATE_FEAT_USAGE_TYPE": "HOME",
 71              "SCORE": 42,
 72              "ADDITIONAL_SCORES": {
 73                "FULL_SCORE": 42
 74              },
 75              "SCORE_BUCKET": "NO_CHANCE",
 76              "SCORE_BEHAVIOR": "FF"
 77            }
 78          ],
 79          "DOB": [
 80            {
 81              "INBOUND_FEAT_ID": 2,
 82              "INBOUND_FEAT_DESC": "12/11/1978",
 83              "INBOUND_FEAT_USAGE_TYPE": "",
 84              "CANDIDATE_FEAT_ID": 200058,
 85              "CANDIDATE_FEAT_DESC": "11/12/1978",
 86              "CANDIDATE_FEAT_USAGE_TYPE": "",
 87              "SCORE": 95,
 88              "ADDITIONAL_SCORES": {
 89                "FULL_SCORE": 95
 90              },
 91              "SCORE_BUCKET": "CLOSE",
 92              "SCORE_BEHAVIOR": "FMES"
 93            }
 94          ],
 95          "NAME": [
 96            {
 97              "INBOUND_FEAT_ID": 1,
 98              "INBOUND_FEAT_DESC": "Robert Smith",
 99              "INBOUND_FEAT_USAGE_TYPE": "PRIMARY",
100              "CANDIDATE_FEAT_ID": 200057,
101              "CANDIDATE_FEAT_DESC": "Bob Smith",
102              "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
103              "SCORE": 97,
104              "ADDITIONAL_SCORES": {
105                "GNR_FN": 97,
106                "GNR_SN": 100,
107                "GNR_GN": 95,
108                "GENERATION_MATCH": -1,
109                "GNR_ON": -1
110              },
111              "SCORE_BUCKET": "CLOSE",
112              "SCORE_BEHAVIOR": "NAME"
113            }
114          ],
115          "PHONE": [
116            {
117              "INBOUND_FEAT_ID": 4,
118              "INBOUND_FEAT_DESC": "702-919-1300",
119              "INBOUND_FEAT_USAGE_TYPE": "HOME",
120              "CANDIDATE_FEAT_ID": 4,
121              "CANDIDATE_FEAT_DESC": "702-919-1300",
122              "CANDIDATE_FEAT_USAGE_TYPE": "MOBILE",
123              "SCORE": 100,
124              "ADDITIONAL_SCORES": {
125                "FULL_SCORE": 100
126              },
127              "SCORE_BUCKET": "SAME",
128              "SCORE_BEHAVIOR": "FF"
129            }
130          ],
131          "RECORD_TYPE": [
132            {
133              "INBOUND_FEAT_ID": 10,
134              "INBOUND_FEAT_DESC": "PERSON",
135              "INBOUND_FEAT_USAGE_TYPE": "",
136              "CANDIDATE_FEAT_ID": 10,
137              "CANDIDATE_FEAT_DESC": "PERSON",
138              "CANDIDATE_FEAT_USAGE_TYPE": "",
139              "SCORE": 100,
140              "ADDITIONAL_SCORES": {
141                "FULL_SCORE": 100
142              },
143              "SCORE_BUCKET": "SAME",
144              "SCORE_BEHAVIOR": "FVME"
145            }
146          ]
147        },
148        "DISCLOSED_RELATIONS": {}
149      }
150    }
151  ],
152  "ENTITIES": [
153    {
154      "RESOLVED_ENTITY": {
155        "ENTITY_ID": 1
156      }
157    }
158  ]
159}

The why_search method describes the ways a set of search attributes relate to an entity.

The default search profile is SEARCH. Alternatively, INGEST may be used.

Parameters:
  • attributes (str) – A JSON document with the attribute data to search for.

  • entity_id (int) – The identifier of the entity to retrieve.

  • flags (int, optional) – _description_. Defaults to SzEngineFlags.SZ_WHY_SEARCH_DEFAULT_FLAGS.

  • search_profile (str) – The name of a configured search profile. Defaults to SEARCH.

Returns:

A JSON document.

Return type:

str

Raises:

Example:
 1import json
 2
 3from senzing import SzEngineFlags, SzError
 4
 5from senzing_core import SzAbstractFactoryCore
 6
 7attributes = json.dumps({"NAME_FULL": "BOB SMITH", "EMAIL_ADDRESS": "bsmith@work.com"})
 8entity_id = 1
 9flags = SzEngineFlags.SZ_WHY_SEARCH_DEFAULT_FLAGS
10instance_name = "Example"
11settings = {
12    "PIPELINE": {
13        "CONFIGPATH": "/etc/opt/senzing",
14        "RESOURCEPATH": "/opt/senzing/er/resources",
15        "SUPPORTPATH": "/opt/senzing/data",
16    },
17    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
18}
19
20try:
21    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
22    sz_engine = sz_abstract_factory.create_engine()
23    result = sz_engine.why_search(attributes, entity_id, flags)
24    print(f"\n{result}\n")
25except SzError as err:
26    print(f"\nERROR: {err}\n")

Output:

  1// Output has been formatted for easier reading.
  2
  3{
  4  "WHY_RESULTS": [
  5    {
  6      "ENTITY_ID": 1,
  7      "MATCH_INFO": {
  8        "WHY_KEY": "+NAME+EMAIL",
  9        "WHY_ERRULE_CODE": "SF1_CNAME",
 10        "MATCH_LEVEL_CODE": "RESOLVED",
 11        "CANDIDATE_KEYS": {
 12          "EMAIL_KEY": [
 13            {
 14              "FEAT_ID": 11,
 15              "FEAT_DESC": "bsmith@WORK.COM"
 16            }
 17          ],
 18          "NAME_KEY": [
 19            {
 20              "FEAT_ID": 6,
 21              "FEAT_DESC": "RPRT|SM0"
 22            },
 23            {
 24              "FEAT_ID": 200002,
 25              "FEAT_DESC": "PP|SM0"
 26            }
 27          ]
 28        },
 29        "FEATURE_SCORES": {
 30          "EMAIL": [
 31            {
 32              "INBOUND_FEAT_ID": 5,
 33              "INBOUND_FEAT_DESC": "bsmith@work.com",
 34              "INBOUND_FEAT_USAGE_TYPE": "",
 35              "CANDIDATE_FEAT_ID": 5,
 36              "CANDIDATE_FEAT_DESC": "bsmith@work.com",
 37              "CANDIDATE_FEAT_USAGE_TYPE": "",
 38              "SCORE": 100,
 39              "ADDITIONAL_SCORES": {
 40                "FULL_SCORE": 100
 41              },
 42              "SCORE_BUCKET": "SAME",
 43              "SCORE_BEHAVIOR": "F1"
 44            }
 45          ],
 46          "NAME": [
 47            {
 48              "INBOUND_FEAT_ID": -2,
 49              "INBOUND_FEAT_DESC": "BOB SMITH",
 50              "INBOUND_FEAT_USAGE_TYPE": "",
 51              "CANDIDATE_FEAT_ID": 1,
 52              "CANDIDATE_FEAT_DESC": "Robert Smith",
 53              "CANDIDATE_FEAT_USAGE_TYPE": "PRIMARY",
 54              "SCORE": 97,
 55              "ADDITIONAL_SCORES": {
 56                "GNR_FN": 97,
 57                "GNR_SN": -1,
 58                "GNR_GN": -1,
 59                "GENERATION_MATCH": -1,
 60                "GNR_ON": -1
 61              },
 62              "SCORE_BUCKET": "CLOSE",
 63              "SCORE_BEHAVIOR": "NAME"
 64            }
 65          ]
 66        },
 67        "DISCLOSED_RELATIONS": {}
 68      }
 69    }
 70  ],
 71  "SEARCH_REQUEST": {
 72    "JSON_DATA": "{\"NAME_FULL\": \"BOB SMITH\", \"EMAIL_ADDRESS\": \"bsmith@work.com\"}",
 73    "SEARCH_PROFILE": "SEARCH",
 74    "FEATURES": {
 75      "NAME": [
 76        {
 77          "LIB_FEAT_ID": -2,
 78          "USAGE_TYPE": "",
 79          "FEAT_DESC": "BOB SMITH",
 80          "ATTRIBUTES": {
 81            "NAME_FULL": "BOB SMITH"
 82          },
 83          "USED_FOR_CAND": "N",
 84          "USED_FOR_SCORING": "Y",
 85          "ENTITY_COUNT": 0,
 86          "CANDIDATE_CAP_REACHED": "N",
 87          "SCORING_CAP_REACHED": "N"
 88        }
 89      ],
 90      "EMAIL": [
 91        {
 92          "LIB_FEAT_ID": 5,
 93          "USAGE_TYPE": "",
 94          "FEAT_DESC": "bsmith@work.com",
 95          "ATTRIBUTES": {
 96            "EMAIL_ADDRESS": "bsmith@work.com"
 97          },
 98          "USED_FOR_CAND": "N",
 99          "USED_FOR_SCORING": "Y",
100          "ENTITY_COUNT": 1,
101          "CANDIDATE_CAP_REACHED": "N",
102          "SCORING_CAP_REACHED": "N"
103        }
104      ],
105      "NAME_KEY": [
106        {
107          "LIB_FEAT_ID": 6,
108          "FEAT_DESC": "RPRT|SM0",
109          "USED_FOR_CAND": "Y",
110          "USED_FOR_SCORING": "N",
111          "ENTITY_COUNT": 3,
112          "CANDIDATE_CAP_REACHED": "N",
113          "SCORING_CAP_REACHED": "N"
114        },
115        {
116          "LIB_FEAT_ID": 200002,
117          "FEAT_DESC": "PP|SM0",
118          "USED_FOR_CAND": "Y",
119          "USED_FOR_SCORING": "N",
120          "ENTITY_COUNT": 1,
121          "CANDIDATE_CAP_REACHED": "N",
122          "SCORING_CAP_REACHED": "N"
123        }
124      ],
125      "EMAIL_KEY": [
126        {
127          "LIB_FEAT_ID": 11,
128          "FEAT_DESC": "bsmith@WORK.COM",
129          "USED_FOR_CAND": "Y",
130          "USED_FOR_SCORING": "N",
131          "ENTITY_COUNT": 1,
132          "CANDIDATE_CAP_REACHED": "N",
133          "SCORING_CAP_REACHED": "N"
134        }
135      ]
136    }
137  },
138  "SEARCH_STATISTICS": [
139    {
140      "CANDIDATE_KEYS": {
141        "FEATURE_TYPES": [
142          {
143            "FTYPE_CODE": "NAME_KEY",
144            "FOUND": 2,
145            "NOT_FOUND": 0,
146            "GENERIC": 0
147          },
148          {
149            "FTYPE_CODE": "EMAIL_KEY",
150            "FOUND": 1,
151            "NOT_FOUND": 0,
152            "GENERIC": 0
153          }
154        ],
155        "SUMMARY": {
156          "FOUND": 3,
157          "NOT_FOUND": 0,
158          "GENERIC": 0
159        }
160      }
161    }
162  ],
163  "ENTITIES": [
164    {
165      "RESOLVED_ENTITY": {
166        "ENTITY_ID": 1
167      }
168    }
169  ]
170}

szproduct

senzing_core.szproduct.SzProductCore is an implementation of the senzing.szproduct.SzProduct interface that communicates with the Senzing binaries.

To use szproduct, the LD_LIBRARY_PATH environment variable must include a path to Senzing’s libraries.

Example:

export LD_LIBRARY_PATH=/opt/senzing/er/lib
class senzing_core.szproduct.SzProductCore(**kwargs: Any)[source]

Bases: SzProduct

Use SzAbstractFactoryCore.create_product() to create an SzProduct object. The SzProduct object uses the arguments provided to the SzAbstractFactoryCore().

Example:

from senzing_core import SzAbstractFactoryCore

sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
sz_product = sz_abstract_factory.create_product()

Args:

Raises:

get_license() str[source]

The get_license method gets the details and entitlements of the applied product license.

The details do not include the license key.

Returns:

A JSON document containing Senzing license metadata.

Return type:

str

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_product = sz_abstract_factory.create_product()
18    result = sz_product.get_license()
19    print(f"\n{result}\n")
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "customer": "Senzing Public Test License",
 5  "contract": "EVALUATION - support@senzing.com",
 6  "issueDate": "2024-10-15",
 7  "licenseType": "EVAL (Solely for non-productive use)",
 8  "licenseLevel": "STANDARD",
 9  "billing": "MONTHLY",
10  "expireDate": "2025-10-16",
11  "recordLimit": 500
12}
get_version() str[source]

The get_version method gets the product version details.

Returns:

A JSON document containing metadata about the Senzing Engine version being used.

Return type:

str

Example:
 1from senzing import SzError
 2
 3from senzing_core import SzAbstractFactoryCore
 4
 5instance_name = "Example"
 6settings = {
 7    "PIPELINE": {
 8        "CONFIGPATH": "/etc/opt/senzing",
 9        "RESOURCEPATH": "/opt/senzing/er/resources",
10        "SUPPORTPATH": "/opt/senzing/data",
11    },
12    "SQL": {"CONNECTION": "sqlite3://na:na@/tmp/sqlite/G2C.db"},
13}
14
15try:
16    sz_abstract_factory = SzAbstractFactoryCore(instance_name, settings)
17    sz_product = sz_abstract_factory.create_product()
18    result = sz_product.get_version()
19    print(f"\n{result}\n")
20except SzError as err:
21    print(f"\nERROR: {err}\n")

Output:

 1// Output has been formatted for easier reading.
 2
 3{
 4  "PRODUCT_NAME": "Senzing SDK",
 5  "VERSION": "4.0.0",
 6  "BUILD_VERSION": "4.0.0.24289",
 7  "BUILD_DATE": "2024-10-15",
 8  "BUILD_NUMBER": "2024_10_15__14_21",
 9  "COMPATIBILITY_VERSION": {
10    "CONFIG_VERSION": "11"
11  },
12  "SCHEMA_VERSION": {
13    "ENGINE_SCHEMA_VERSION": "4.0",
14    "MINIMUM_REQUIRED_SCHEMA_VERSION": "4.0",
15    "MAXIMUM_REQUIRED_SCHEMA_VERSION": "4.99"
16  }
17}
help(method_name: str = '') str

The help method returns help for a particular message.

Parameters:

method_name (str) – The name of the method. (e.g. “init”). If empty, a list of methods and descriptions is returned.

Returns:

The Help information about the requested method

Return type:

str

property is_destroyed: bool

Return if the instance has been destroyed.