Using custom script enrichments

Introduction

What are custom script enrichments and what can they do?

A custom script enrichment is made up of one or more versatile instructions that tell Adverity how to transform your data. You can use custom script enrichments to add or remove fields from your data, perform calculations, convert data, and much more.

How do I use custom script enrichments?

Create a custom script enrichment as described in this guide. Next, assign your enrichment to a datastream. After the enrichment is assigned to a datastream, every time you fetch data using the datastream, the collected data is transformed according to the instructions in the enrichment.

Who can use an enrichment that I create?

An enrichment is available to all users with access to the workspace where the enrichment was created. However, the enrichment will only affect datastreams to which it is assigned.

What instructions can I add to a custom script enrichment?

You can add as many instructions as you want to a custom script enrichment and configure the settings for each instruction individually. You can find a list of all available custom script instructions here.

What other enrichment types are there in Adverity?

Adverity also offers standard enrichments, which provide a user-friendly interface that lets you tell Adverity how to transform your data within a certain framework. For more information, see Using standard enrichments.

Creating a custom script enrichment

The process of creating a custom script enrichment is made up of the following steps:

  1. Type: Choose to create a custom script enrichment.

  2. Assignments: Choose the datastreams to which you want to apply the enrichment.

  3. Instructions: Create the custom script enrichment by adding and configuring instructions so that it transforms your data according to your needs.

  4. Name: Give your custom script enrichment a name so it is easily identifiable.

Prerequisites

Before you complete the procedure in this guide, perform all of the following actions:

Creating a custom script enrichment

To get started creating an enrichment, follow these steps:

  1. Select the workspace you work with in Adverity and then, in the platform navigation menu, click Enrichments.

  2. In the top right corner, click + Create enrichment.

  3. In the Type step, click Custom script.

    This guide only explains how to create a custom script enrichments. To create a standard enrichment, see Using standard enrichments.

  4. In the Assignments step, select the datastreams to which you want to assign this enrichment:

    • To assign the enrichment to one or more specific datastreams, select Individual datastreams and then select your chosen datastreams from the drop-down menu.

    • To assign the enrichment to all datastreams that fetch data from one or more specific data sources, select Datastream types and then select your chosen data sources from the drop down menu.

      (Optional) To exclude any datastreams that fetch data from your chosen data source, select the individual datastreams to exclude from the Do not assign to these individual datastreams drop-down menu.

  5. In the Instructions step, in the Select instruction... drop-down menu, enter and select an instruction for this enrichment.

    Use the Enrichment Copilot to get the enrichment instruction and its configuration for your specific use case. For more information, see Using the Enrichment Copilot.

  6. Configure the settings for the instruction you have selected according to the Copilot's response or the corresponding instruction guide.

    To preview your enrichment at this step, click the Table preview tab. Here, you can see how your current enrichment instructions will transform the data you have previously collected using this datastream.

    If the preview shows that the enrichment is not working in the way you want it to, click the Instructions tab to adjust the enrichment settings.

    Repeat these steps until the preview shows that the enrichment will have the effect you want.

    For more information about the preview, see Previewing enrichments.

  7. (Optional) To add more instructions to this enrichment, click + Add instruction and configure the corresponding settings.

    Repeat this step until you have finished adding and configuring instructions.

  8. Click Next.

  9. In the Name step, enter a name for your enrichment.

  10. Click Create.

As a result, you have created a custom script enrichment and assigned it to your chosen datastreams. From now on, every time you fetch data using these datastreams, the data extract will be transformed according to the instructions in your enrichment.

You can also assign your enrichments to a datastream from the datastream overview as well as manage the order in which the enrichments are applied.

Editing a custom script enrichment

You can edit an enrichment after it has been created. To do so, follow these steps:

  1. Select the workspace you work with in Adverity and then, in the platform navigation menu, click Enrichments.

  2. Click the enrichment you want to edit. You will automatically be taken to the Instructions page of the enrichment overview.

  3. Make any required changes to your enrichment in the Instructions tab. To see how your changes will affect how the enrichment transforms your data, click the Table preview tab.

  4. (Optional) To add more instructions to this enrichment, click + Add instruction and configure the corresponding settings.

  5. Click Save.

As a result, you have edited your custom script enrichment. From now on, when you fetch data using a datastream to which this enrichment is assigned, your data will be transformed according to the new instructions.