trendminer.sdk.context.workflow module

This module provides user-facing API’s for interacting with Context Workflow.

class trendminer.sdk.context.workflow.ContextWorkflow(name: str, states: list[str], identifier: str | None = None)

Bases: ABC

Context Workflow determines the events attachable to items of the associated type.

name

Context workflow name

Type:

str

states

States of the workflow

Type:

list of str

identifier

Unique identifier for context workflow generated by TrendMiner

Type:

str, optional

Example

# Create an implementation of context workflow
workflow = client.context.workflow(name ='context_workflow_name', states=['Start', 'End'])
class trendminer.sdk.context.workflow.ContextWorkflowAPI

Bases: ABC

ContextWorkflowAPI class for creation and retrieval of context workflows.

all() list[trendminer.sdk.context.workflow.ContextWorkflow]

Retrieve all instances of context workflow from Trendminer.

Returns:

List of all the retrieved context workflows

Return type:

list

Example

# Retrieve all the context workflows
workflows = client.context.workflow.all()
abstract get(ref: str) ContextWorkflow

Retrieves a context workflow from Trendminer using different retrieval methods, these methods encompass querying by context workflow identifier and name.

Note

The value of ‘ref’ will be checked with identifier and then name. The first matching result will be returned based on this order.

Parameters:

ref (str) –

Reference by which a unique context workflow can be retrieved from Trendminer such as:

  • identifier

  • name

Returns:

The context workflow pointed by the given reference. Returns the provided input directly if it’s the correct type, None or a LazyAttribute

Return type:

ContextWorkflow

Example

# Retrieving context workflow using name
workflow = client.context.workflow.get('context_workflow_name')
get_by_identifier(ref: str) ContextWorkflow

Retrieve a context workflow by its identifier.

Parameters:

ref (str) – Context workflow identifier

Returns:

The corresponding context workflow instance

Return type:

ContextWorkflow

Example

# Retrieving context workflow from an identifier
workflow = client.context.workflow.get_by_identifier('0b7ce8d5-2ac0-44d0-8574-3928a995ad60')
get_by_name(ref: str) ContextWorkflow

Retrieve context workflow by its name.

Parameters:

ref (str) – Context workflow name

Returns:

The corresponding context workflow instance

Return type:

ContextWorkflow

Example

# Retrieving context workflow from a name
workflow = client.context.workflow.get_by_name('context_workflow_name')
abstract list(refs: list[str]) list[trendminer.sdk.context.workflow.ContextWorkflow]

Retrieves a list of Context Workflow from Trendminer using different retrieval methods, these methods encompass querying by context workflow identifier, name.

Note

Each value of input list will be checked with identifier, and then name, the first matching result will be returned based on this order

Parameters:

refs (list[str]) –

List of references representing unique instances on Trendminer. References by which a unique context workflow can be retrieved from Trendminer such as:

  • identifier

  • name

Returns:

List context workflow retrieved from given references

Return type:

list

Example

# Retrieving list of context workflow
workflows = client.context.worklow.list(['context_workflow_name', '0b7ce8d5-2ac0-44d0-8574-3928a995ad60'])
search(*args, **kwargs) list[trendminer.sdk.context.workflow.ContextWorkflow]

Search context workflow using various search keywords. It executes search methods based on the provided keywords and returns a collection of unique results. Duplicate instances are filtered out when multiple methods return overlapping instances.

Note

Atleast one of the below mentioned Keyword Arguments should be provided. Otherwise, an empty list will be returned. If multiple keywords are provided, they will be combined using an AND operation.

Keyword Arguments:

name (str) – Context Workflow name as referance

Returns:

List context workflow meeting the search criteria

Return type:

list

Example

# Context workflow search is performed using name
workflows = client.context.workflow.search(name='context_workflow_name')