Skip to main content
Version: 2.18.X

Building Models in Cogynt Authoring

With the capitals_training.json file uploaded, the next step is to start building a model to process the data. This process consists of the following steps:

  1. Creating event types
  2. Creating event patterns
  3. Setting partitions
  4. Defining outcomes
  5. Setting computations

Creating Event Types

Cogynt uses Event Types to process data from schemas/data sources. A schema defines each field and its expected value so that Cogynt can use these data types in its processing logic. Creating a new event type involves naming it and assigning or generating a schema for it.

To create a new event type in the Create Event Type dialog:

  1. On the left of the screen, click Step 1: Event Info. On this page:
    1. In the Name field, name the event type. For example hello_world and your initials.
    2. In the Description field, enter an optional description for the event type.
    3. From the Data Source dropdown menu, select the source of the event type's data. In this case, your source should be default.
    4. In the Topic field, specify the name of the source topic as it appears in Kafka (or select the desired source topic from the prepopulated list).
    5. In the Event Fields section:
      1. At the right side, use the dropdown menu and select Add fields from existing Kafka topic.
      2. In the Select Kafka Topic Fields dialog, from the left side, search for and select the Kafka topic that contains your fields. This topic should be named something like capitals with your initials. Verify the fields appear as expected.
      3. Click Add X Fields (X refers to the number of fields to be added) to add each data field from the original kafka topic. Again, verify the fields appear as expected.
  2. At the top of the screen, click Create to create the event type, or Cancel to discard it.

If the event type creation is successful, Cogynt displays a confirmation message.

Once you receive the confirmation message, you can move on to creating event patterns.

Creating Event Patterns

The primary unit of logic in a Cogynt model is the event pattern. An event pattern contains pattern detection logic, and a schema that differentiates each field and value. Users then 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 create an event pattern:

  1. In Cogynt Authoring, navigate to the diagramming area.
  2. In the tool palette in the upper-left of the screen, click the Event Pattern icon.
  3. Click any open space in the diagramming area to place an event pattern node there.
  4. On the right of the screen, under the Contents tab:
    1. Type a name for the event pattern in the Name field. (For this exercise, "Hello World" followed by your initials is recommended.)
    2. In the Description field, type a description. (For this exercise, typing "Training" is recommended.)
  5. In the diagramming area, double-click the event pattern node you placed in Step 3. The event pattern modeling screen opens.
  6. In the tool palette, click Add Element (⬭). In the Select Event Type dialog, select the Event Type you created in the previous step from the dropdown. This event type will appear with its name and schema in tact. Then click Use to create the element.

Once you finish this process, the created event type is added to your model.

The next step is to set partitions on the event pattern for greater data processing precision.

Defining Outcomes

An outcome represents output data in a model. Once Cogynt finds a pattern you've defined, 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:

  1. In Cogynt Authoring, navigate to the diagramming area.
  2. In the diagramming area, click the event pattern node you created.
  3. In the tool palette, click Add Outcome (▭).
  4. In the Select Event Type dialog, click New.
  5. In the Create Event Type dialog:
    1. In the Name field, type a name for the outcome. (For this exercise, "Hello World Results" is recommended.)
    2. In the Topic field, enter a Kafka topic name. It is recommended that the Kafka topic name matches what you've entered in the Name field as closely as possible, using underscores (_) instead of spaces. (For this exercise, "hello_world_results" is recommended.)
    3. From the Event Fields heading, select Existing Schema. Then select the schema you previously used.
    4. Click Create.

Once you have defined an outcome, the next step is to set some computations to process the data points your outcome will generate.

Setting 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.

For this exercise, you'll practice mapping input values to lay the groundwork for computations. After you've finished the entire walkthrough, feel free to return to this section to experiment with computations further.

To add a computation element to your model:

  1. In Cogynt Authoring, navigate to the diagramming area.
  2. In the diagramming area, double-click the outcome you created.
  3. Right-click to open the tool palette.
  4. In the tool palette, click Map Input Element.
  5. Click the event pattern you created. (Following our example, it would be "Capitals Data" + your initials.)
  6. Click any open space in the diagramming area to place the computation element.
  7. Connect the data fields from the "Capitals Data + initials" input node to the "Hello World Results" output node by clicking and dragging. Establish the following connections:
    • capital_name to capital_name
    • continent_name to continent_name
    • country_code to country_code
    • country_name to country_name
    • geo_coordinates to geo_coordinates
  8. When finished, click Hello World in the top navigation bar to return to the event pattern home screen.

With your computations set, you have now configured a complete model. Before deploying your model, set a partition that groups results according to your chosen field.

Setting Partitions

A partition instructs the system to analyze events based on a particular field within a specified event pattern. Partitions filter event types similar to the GROUP BY function in SQL, or the Excel filter function. For more information, see Creating Partitions in the Cogynt Authoring User Guide.

To create a partition for your event pattern:

  1. In Cogynt Authoring, navigate to the diagramming area.
  2. Click the event pattern node you created.
  3. In the details panel, click the Contents tab if it is not already selected.
  4. Under Attributes, click the Partitions section to expand it.
  5. Confirm that the Enable Partitions toggle is set to "on." (If it is set to "off," click the toggle to set it to the "on" position.)
  6. Beside the Enable Partitions toggle, click +.
  7. In the Create Partition dialog:
    1. From the Elements dropdown menu, select the event pattern you created. (Following our example, it would be "Capitals Data" + your initials.)
    2. From the Fields dropdown menu, select the field to partition over. For this exercise, select the country_name field. (Note: The Fields dropdown menu cannot be opened until a selection has been made from Elements.)
  8. Click Create to create.

With the partition set, your pattern will now publish a unique solution for each country in the data set. Workstation will then process each unique solution as a separate record.

Next, you will deploy your model and put it to use. Once your model is deployed, you can use a Workstation Workspace to view them.