Concepts

Understand concepts and how they are utilized in procedures defined by BDK.

What are Concepts?

Concepts define how data flows in and out of a procedure:

  • Input concepts represent the inputs that a procedure requires.

  • Output concepts represent the results that a procedure generates.

Concept Types

Input and output concepts can be defined as either standard or custom types.

Standard Types

The following Python data types can be used to define concepts:

Category
Supported Python Data Types

Text

str

Number

float, int

Boolean

bool

Bytes

bytes

Date

datetime.datetime, datetime.date, datetime.time

File

typing.IO

UUID

uuid.UUID

Table

pyarrow.Table, arro3.core.Table, nanoarrow.ArrayStream

Lists

List[str], List[int]

Dictionary

Dict[str, Any]

Note:Anycan be any of the other supported types.

Custom Types

Concepts can also be custom types. Custom concepts must be marked with the @concept decorator. Using a dataclass is recommended. For example:


Concepts vs. Parameters

Concepts and parameters are two different entities that are closely related.

Concepts

Concepts are operated on by Kognitos procedures. Some concepts are included in the name of the @procedure decorator.

Parameters

Parameters are operated on by Python functions. They are defined in a function's signature and are specific to the function's implementation.

An internal mapping is created between a Python function and a Kognitos procedure. To ensure a correct mapping, concepts and parameters must match.


Concept-Parameter Matching

Concepts and parameter names must match to ensure they are properly mapped internally.

Guidelines

Match concepts to parameters by following these guidelines:

  1. Replace spaces with underscores.

  2. Drop possessive constructions ('s).

  3. Consider each connectednoun phrase as a separate parameter. Non-essential noun phrases (e.g., "field," "value") included to clarify context do not require a corresponding parameter.

  4. Don't map articles ('an', 'a', 'the') to parameters; only the nouns they connect should be considered.

  5. Define optional parameters in cases where the input concept is not explicitly defined in the procedure name.

Example 1

In this example, the concept red car maps to the parameter red_car. The space is replaced with an underscore.

Example 2

In the example below:

  • servicenow's ticket maps to ticket

  • field maps to field

  • outlook's standard user maps to standard_user

Example 3

In this example, the concept ticket maps to the parameter ticket. The possessive construct ('s) is dropped and the word "field" is ignored.

Example 4

In the example below, the concept of priority is not explicitly stated in the procedure name. It maps to the optional function parameter, priority.

Example 5

In this example:

  • the city maps to the parameter city

  • the unit maps to the optional parameter the unit

The output concept, current temperature, is wrapped in parentheses in the procedure name.

Last updated

Was this helpful?