Creating the Processing Logic
Once you have finished preparing your data, you can define the logic that Cogynt should use to process it. You can use this functionality to create sophisticated models and data outputs.
For the purposes of this guide, you will configure a simple model whose sole function is to show you your data. The first part of building this model is to add an event pattern node.
Add an Event Pattern Node
The primary unit of logic in a Cogynt model is the event pattern. An event pattern contains pattern detection logic. Users decide what kind of data it should receive, process, and produce for output. For more information about working with event patterns, see System Authoring in the Cogynt Authoring User Guide.
In modeling diagrams, event patterns are represented by event pattern nodes. Models can contain a great many nodes, but this guide's simple model requires only one.
To add an event pattern node to your diagram:
- In the tool palette, click the Event Pattern icon.
- Click any open space in the diagramming area to place an event pattern node there.
Your model now has a place to store some pattern detection logic. Next, you'll start to configure that logic by creating some event types.
Create Event Types
An event type represents the data processed by an event pattern. It uses a user data schema for its field list. An event type also contains other specifications for the data stream (for example, stream type, stream source, stream filter, and so on).
For this model, you'll create two event types: One to serve as an input (or "source"), and one to serve as an output (or "target"). This guide provides the basic steps. For detailed information about working with event types, see Establishing Event Pattern Data Flow and Creating New Event Types in the Cogynt Authoring User Guide.
Add an Element
An element is a logical entity within an event pattern that represents the input event type. Elements define what parts of the incoming data constitute a match. In other words, elements tell the system what kinds of things to look for in the data. For more information about elements, see Working with Elements in the Cogynt Authoring User Guide.
To add an element:
- In the tool palette, click the Element (⬭) icon.
- Click the event type to associate with the new element. If a new event type should be created, click New Event Type, then follow the instructions in Creating New Event Types in the Cogynt Authoring User Guide.
- Click any open space in the diagramming area to place the element.
- In the details panel, edit the element’s properties as needed. For more information, see Editing Elements in the Cogynt Authoring User Guide.
Elements may also be created directly on the canvas as follows:
- Right-click any empty space in the canvas.
- In the selection menu, click Add Element.
- In the dialog, select an event type. If a new event type should be created, click New, then follow the instructions in Creating New Event Types in the Cogynt Authoring User Guide.
Depending on the source of the input data, elements in the event pattern view may have differently shaded colors:
- If an element is associated with a raw event type, its color is deep blue.
- If an element is associated with a derived event type (i.e., one that comes from an output of a lower-level event pattern), its color is brighter blue.
Once you have an element in place, you'll need to add an outcome next.
Add an Outcome
An outcome is a logical entity within an event pattern that represents output data. In other words, once the system finds a pattern established in an element, an outcome tells the system what to do after that discovery. For more information about outcomes, see Working with Outcomes in the Cogynt Authoring User Guide.
To create an outcome:
- In the tool palette, click the Outcome (▭) icon.
- Select the event type to associate with the new outcome. If a new event type should be created for the outcome, follow the process in Creating New Event Types in the Cogynt Authoring User Guide.
- Click any open space in the diagramming area to place the outcome.
- In the details panel, edit the outcome’s properties as needed. For more information, see Editing Outcomes in the Cogynt Authoring User Guide.
Outcomes may also be created directly on the canvas as follows:
- Right-click any empty space in the canvas.
- In the selection menu, click Add Outcome.
- In the dialog, select an event type. If a new event type should be created, click New, then follow the instructions in Creating New Event Types in the Cogynt Authoring User Guide.
With both an input and output in place, the next step is to set the partitions for the pattern node.
Set Partitions on the Pattern Node
A partition instructs the system to analyze events based on a particular field within a specified event pattern. For more information, see Creating Partitions in the Cogynt Authoring User Guide.
To create a partition for your event pattern:
- In the diagramming area, click the event pattern node.
- In the details panel, click the Contents tab if it is not already selected.
- Under Attributes, click the Partitions section to expand it.
- Click +.
- In the Create Partition dialog:
- From the Elements dropdown menu, select the element containing the field to partition over.
- From the Fields dropdown menu, select the field to partition over. (The Fields dropdown menu cannot be opened until a selection has been made from Elements.)
- Click Create to create the partition, or click Cancel to discard it.
Once the partitions have been configured, the next task is to set the windowing.
Set Windowing
Output windowing defines an interval of time during which the system listens to incoming data streams, and only publishes the data's updated (i.e., latest) state during that interval. For more information, see Configuring Output Windowing in the Cogynt Authoring User Guide.
The output windowing interval refers to server time (time that has elapsed during the operation of the server), not data time (time specified in the data's timestamps or metadata).
To configure the output windowing for your event pattern:
- In the diagramming area, click the event pattern's outcome.
- In the details panel, click the Contents tab if it is not already selected.
- Click the Output Windowing section to expand it.
- From the Type dropdown menu, select the output windowing to use.
- In the Time Value field, enter the interval of time that the output window should span.
- From the unit dropdown menu to the right of the Time Value field, select the appropriate unit for the time value.
- Click outside of the details menu to save the changes.
Once you're satisfied with how your output windowing looks, you can move on to mapping computations.
Map Computations
Cogynt has many built-in computations and functions that make it possible to perform complex calculations or analyses based on inputs from multiple sources. The following computation elements can be added and configured as needed:
For more information about working with computation elements, see Outcome Computations Authoring in the Cogynt Authoring User Guide.
To add a computation element to your model:
- In the tool palette, select the category of computation element to add.
- From the context menu, select the specific function or type of computation.
- Click any open space in the diagramming area to place the computation element.
- In the details panel, set any values or enter other details as needed.
Now that all your internal logic has been defined, it's time to prepare it for launch by creating a deployment.
Create a Deployment
A deployment translates a model you've built into code for the Cogynt system to process. This allows other Cogynt applications, such as Workstation, to interpret data in accordance with your model and provide you its findings. For more information about working with deployments, see Creating Deployments in the Cogynt Authoring User Guide.
To add a deployment to your project:
- In the Deployment Management window, click the Deployments tab.
- Click the Project dropdown menu, then select the appropriate project.
- Click the Add New Deployment (+) button.
- In the Create Deployment window:
- In the Name field, enter a name for the deployment. The name cannot exceed 255 characters in length.
- In the Description field, enter a description for the deployment if necessary.
- Toggle the Auto create missing Kafka topics switch to "On" to automatically create Kafka topics based upon the fields found in the incoming data stream.
- Under Flink Configurations:
- Click the Add a configuration (+) button to add a new configuration:
- If the desired configuration has already been defined elsewhere, select it from the dropdown list.
- If the desired configuration has not been defined:
- Select Add Custom Config from the dropdown list.
- In the Name field, enter a name for the configuration.
- In the Value field, enter the value that the configuration should track.
- Click the checkmark (✓) icon to save the configuration, or click X to discard it.
- Edit any existing configurations as needed:
- In the Name column, verify that the configuration has the appropriate name. Click the information (i) icon to the left of the name to read a description.
- In the Value column, verify that the configuration has the appropriate value. Enter a new value in the corresponding field or dropdown menu as needed.
- In the Unit column, verify that the configuration has the appropriate unit of measurement. Select a new value from the corresponding dropdown menu as needed.
- Delete any unnecessary configurations by clicking the corresponding Delete (trash can) icon.
- Click the Add a configuration (+) button to add a new configuration:
- Click the Log Configurations tab to specify the deployment target's logging configurations, repeating steps 4.iv.a.1-3 as needed.
- Under Deployment Target, select the appropriate deployment target from the drop-down menu. The panel displays key details about the selected deployment target for review. For more information, see Viewing Deployment Targets in the Cogynt Authoring User Guide.
- Under Deploy Entities, select the event patterns to include in the deployment:
- Click the System Nodes tab to see the list of available event patterns, or click the Tags tab to the list of available event patterns grouped by their tags.
- Check the corresponding checkbox for each system node or tag to include in the deployment. Checking or unchecking the checkbox in the header does the same for the checkbox of every system node or tag.
- Click Create to create the deployment, or click Cancel to discard it.
With your deployment details in place, it's time to pull in your data.