# Schemas

# Overview

With the Custom Schema Creation feature, you can build customized collections without any coding involved. The intuitive drag and drop editor allows you to design hierarchical data structures. Intempt Platform uses JSON to define the schema and data types, allowing for convenient schema evolution.

# How to Create Schemas

img


# Add collection

Select "Add collection" object and drag it to the left. A new collection will be created.


img

# Edit collection

To edit the name of the collection, click on the pencil icon on the table header. To delete the collection, select the trash icon (note: if you delete the collection, all the fields inside the collection will be deleted as well).


img

# Add a field

To add a field in the collection, select "Add a field" object and drag it to the required collection.


img


# Add a nested field

If you want to create a nested field, drag the object to a specific field. A new object will be created inside the field (you can change the object type later).


img


# Configure a field

To configure the created field, select it in the collection table.

img


# Edit field name

You can add/edit the field name (unique field name) and title (displayed in the UI, used in the event editor). If you want to delete the field, click on the trash icon.


img


# Choose object type

You can select the object type of the data field.

Different types of value inputs:

  • Record - a collection of multiple attributes
  • Array data - defines an array field having a single attribute items. This items attribute specifies the type of items in the array
  • “Boolean” is true or false values
  • “int” (Integer) for numeric values
  • “string” - text input
  • “float” for numeric values with decimals
  • “long” holds signed integers ranging in value from -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807 (9.2...E+18)
  • “double” for a variable that holds very large (or small) numbers. It can contain up to 15 digits in total, including those before and after the decimal point
  • “bytes” stand for typed characters represented by numbers. Each number is stored in one byte (so the number is in 0-255)

img


# Key identifiers

To build valid dependencies between the collections, primary and foreign keys need to be assigned to the required fields. To add a key, tick the checkbox in the field configuration.


img


Affter ticking the required checkboxes, fk (foreign key) pk (primary key) initials will appear in the field row icon to the field.


img


Differences between primary and foreign keys:

Primary Key – must be assigned to any field that is always unique within a created collection. This is necessary for giving each entry a unique identifier. Note: assigned identifier must be unique across all collections.

Foreign Key - is a field in a collection that refers to the primary key in another collection. Foreign key prevents removing links between tables and blocks invalid data from being inserted into the foreign key column.

# Foreign collections and fields

If you select a foreign key, you will also need to choose the respective foreign collection and foreign fields that refer to the primary key.


img

# Relations

Relations object helps to define how the foreign identifier works. It also allows us to use related collections in the event editor. When you create a relation, it will enable you to filter by multiple fields in different collections simultaneously (e.g. you can filter "exit" event by device name or "booking" event by room and visitor properties).

To add a relation, you will need to select the field as a foreign key and then check the relations checkbox. After that, enter the relation name (wil be displayed in the event editor) and relation type:

One-to-many – Each row in one table is linked (or related) to one, or more, rows in another table using a “key” column.

Many-to-one – One, or more, rows in one table is linked (or related) to one, or more, rows in another table using a “key” column.


img

# User identifier

To identify anonymous cross-channel users, you need to select which collection objects will allow you to identify and merge anonymous users into unified master profiles. To do that, you need to choose a collection field that is a common identifier across different sources. Usually, this field is email, but it can also be a phone, loyalty ID number, etc.

# Profile identifier

It is a primary key that shows that the field belongs to a profile collection. It is used to identify profile collections that create or merge user profiles.


img

# User attributes

Select fields that will be used as user attributes - these data objects should have information about the user (e.g., age, location, gender and etc.). If selected, these collection fields will be available to be used in the segment editor - to filter users by their attributes. You can also create different attribute merging rules in the Attributes page (opens new window)


img

# What’s next?

After you finish creating the collections, you are ready to go to Events (opens new window) and start building new events and segments based on the collections created.