# Appendices

## Api Key

The apikey table stores API keys used to validate eva’s service calls.

| **Column Name** | **Data Type** | **Not Null** | **Description**             |
| --------------- | ------------- | ------------ | --------------------------- |
| apiKey          | varchar(50)   | No           | Stores the safety key value |
| createDate      | datetime      | No           | Record creation date        |

## &#x20;Automatization test

The automatization\_test stores general information about automated tests. To execute an automated test, the user must fill a spreadsheet and insert it in the cockpit.

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                     |
| --------------- | ------------------- | ------------ | ------------------------------------------------------------------- |
| **id**          | bigint(20) unsigned | No           | ID representing the automated test                                  |
| **name**        | varchar(200)        | Yes          | Automated test name                                                 |
| **confidence**  | decimal(12,10)      | No           | Shows the average confidence level.                                 |
| **flagBatch**   | tinyint(1)          | No           | Flags if the test has to be scheduled to be executed via DevOps     |
| **nlpVersion**  | varchar(10)         | Yes          | Shows the cognitive engine version                                  |
| **utterances**  | int(11)             | Yes          | Number of examples in the test                                      |
| **userId**      | bigint(20)          | No           | ID identifying the user, related to the user table                  |
| **botId**       | bigint(20)          | No           | ID representing a virtual agent, related to the virtual agent table |
| **channelId**   | bigint(20)          | No           | ID representing a channel related to the channel table              |
| **sessionCode** | varchar(50)         | Yes          | Code representing a session                                         |
| **createdAt**   | datetime            | Yes          | Creation date                                                       |
| **updatedAt**   | datetime            | Yes          | Date of last update                                                 |

## Automatization Test Description

The automatization\_test\_description Stores data that was inserted in the automated test spreadsheet and are stored as an execution result.

| **Column Name**  | **Data Type**  | **Not Null** | **Description**                                                                 |
| ---------------- | -------------- | ------------ | ------------------------------------------------------------------------------- |
| **id**           | bigint(20)     | No           | ID representing the automated test description                                  |
| **intent**       | varchar(100)   | Yes          | Expected intent name                                                            |
| **utterance**    | text           | Yes          | Text that has to be sent                                                        |
| **text**         | text           | Yes          | Expected answer                                                                 |
| **intentResult** | varchar(100)   | Yes          | Intent returned by the NLP                                                      |
| **textResult**   | Text           | Yes          | Returned answer                                                                 |
| **confidence**   | decimal(12,10) | No           | Confidence level returned by the NLP                                            |
| **timeResult**   | int(11)        | Yes          | Processing time                                                                 |
| **testId**       | int(11)        | No           | Executed test ID (automatization test)                                          |
| **data**         | text           | Yes          | Business key. It is an optional column and it is not used in the automated test |
| **createdAt**    | datetime       | Yes          | Record creation date                                                            |
| **updatedAt**    | datetime       | Yes          | Record update date                                                              |

## Virtual agent NLP Engine

The bot\_nlp\_engine table is a N-N relationship table between virtual agent and nlp\_engine.

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                      |
| --------------- | ------------------- | ------------ | -------------------------------------------------------------------- |
| **botId**       | bigint(20) unsigned | No           | ID representing a virtual agent, related to the virtual agent table  |
| **nlpEngineId** | bigint(20) unsigned | No           | ID representing a cognitive engine, related to the nlp\_engine table |
| **createdBy**   | varchar(50)         | Yes          | ID representing the user who created                                 |
| **updatedBy**   | varchar(50)         | Yes          | ID representing the user who updated                                 |
| **createdAt**   | Datetime            | Yes          | Record creation date                                                 |
| **updatedAt**   | datetime            | Yes          | Record update date                                                   |

## &#x20;Configuration

The configuration tables stores eva’s configuration keys.

| **Column Name** | **Data Type** | **Not Null** | **Description**                            |
| --------------- | ------------- | ------------ | ------------------------------------------ |
| **id**          | bigint(20)    | No           | ID representing a custom configuration key |
| **key**         | varchar(50)   | No           | Configuration key value                    |
| **value**       | varchar(225)  | Yes          | Shows the configuration key value          |
| **description** | varchar(200)  | Yes          | Parameter description                      |
| **createdBy**   | varchar(50)   | Yes          | ID representing the user who created       |
| **updatedBy**   | varchar(50)   | Yes          | ID representing the user who updated       |
| **createdAt**   | datetime      | Yes          | Record creation date                       |
| **updatedAt**   | datetime      | Yes          | Record last update date                    |
| **erasable**    | tinyint(4)    | Yes          | Says if the field can be erased            |

## Entity

The entity table stores configurations for entities created in the virtual agent. An example would be the entity “sport”.

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                                                                           |
| --------------- | ------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------- |
| **id**          | bigint(20)          | No           | ID representing an entity                                                                                                 |
| **name**        | varchar(255)        | No           | Entity name                                                                                                               |
| **createdAt**   | datetime            | Yes          | Record creation date                                                                                                      |
| **updatedAt**   | datetime            | Yes          | Record last update date                                                                                                   |
| **updatedBy**   | bigint(20)          | Yes          | ID representing the user who updated                                                                                      |
| **createdBy**   | bigint(20)          | Yes          | ID representing the user who created                                                                                      |
| **removed**     | tinyint(1)          | No           | <p>Shows if it was removed. It is possible to revert by changing the Boolean,</p><p>0 = not removed</p><p>1 = removed</p> |
| **botId**       | bigint(20) unsigned | No           | ID representing a virtual agent, related to the virtual agent table                                                       |
| **enable**      | tinyint(1)          | No           | Shows if the entity is enabled                                                                                            |
| **metadata**    | varchar(100)        | Yes          | Shows the entity metadata values, related to the chosen NLP                                                               |

{% hint style="info" %}
**To learn how to use** [**Entity**](https://docs.eva.bot/user-guide/using-eva/develop-your-bot/dialog-cells/entity-cells) **in eva**
{% endhint %}

## Entity Value

The entity\_value table stores the entity content. So, in the entity “sport”, the values would be “football”, “basketball” or “tennis”.

| **Column Name** | **Data Type** | **Not Null** | **Description**                                        |
| --------------- | ------------- | ------------ | ------------------------------------------------------ |
| **id**          | bigint(20)    | No           | ID representing the entity value                       |
| **entityId**    | bigint(20)    | No           | ID representing an entity, related to the entity table |
| **value**       | varchar(100)  | No           | Entity value                                           |
| **createdAt**   | datetime      | Yes          | Record creation date                                   |
| **updatedAt**   | datetime      | Yes          | Record last update date                                |
| **updatedBy**   | bigint(20)    | No           | ID representing the user who updated                   |
| **createdBy**   | bigint(20)    | No           | ID representing the user who created                   |
| **type**        | varchar(20)   | No           | Shows the entity value: Synonym or Pattern             |

## Entity Sample&#x20;

The entity\_sample table stores words that has a similar meaning to the entity value. For example, if the entity value is “football”, it could store “soccer” or “association football”.&#x20;

| **Column Name**   | **Data Type** | **Not Null** | **Description**                                                     |
| ----------------- | ------------- | ------------ | ------------------------------------------------------------------- |
| **id**            | bigint(20)    | No           | ID representing the entity synonym                                  |
| **entityValueId** | bigint(20)    | No           | ID identifying the entity value, related to the entity\_value table |
| **value**         | varchar(100)  | No           | Entity value synonym                                                |
| **createdAt**     | varchar(100)  | Yes          | Record creation date                                                |
| **updatedAt**     | datetime      | Yes          | Record last updated date                                            |
| **createdBy**     | bigint(20)    | No           | ID representing the user who created                                |
| **updatedBy**     | bigint(20)    | No           | ID representing the user who updated                                |

## Facebook Configuration

The facebook\_configuration stores the chat configuration in a Facebook page.

| **Column Name**     | **Data Type** | **Not Null** | **Description**                                  |
| ------------------- | ------------- | ------------ | ------------------------------------------------ |
| **pageId**          | varchar(45)   | Yes          | Facebook page ID, identified by an URL           |
| **pageName**        | varchar(45)   | Yes          | Facebook page name                               |
| **hubToken**        | varchar(100)  | No           | Verification code to be used with a webhook      |
| **pageAccessToken** | varchar(225)  | Yes          | Verification code to validate page access        |
| **channelId**       | bigint(20)    | Yes          | ID representing the channel in the channel table |

## Facebook User

The facebook\_user table stores the data of the facebook user who interacted with the virtual agent.

| **Column Name**     | **Data Type** | **Not Null** | **Description**                                        |
| ------------------- | ------------- | ------------ | ------------------------------------------------------ |
| **userId**          | varchar(20)   | No           | ID that identifies the user, related to the user table |
| **createDate**      | datetime      | Yes          | Record creation date                                   |
| **userBlocked**     | tinyint(2)    | Yes          | Shows if the user is blocked                           |
| **lastInteraction** | datetime      | Yes          | Shows the user\`s last interaction date and time       |

## Intents

The intents table stores the configuration of intents created in the virtual agent.

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                                                                                   |
| --------------- | ------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------- |
| **id**          | bigint(20)          | No           | ID representing an intent                                                                                                         |
| **name**        | varchar(255)        | No           | Intent name                                                                                                                       |
| **description** | text                | Yes          | Intent description                                                                                                                |
| **enabled**     | tinyint(1)          | No           | Shows if the intent is enabled                                                                                                    |
| **removed**     | tinyint(1)          | No           | <p>Shows if the intent was removed. It is possible to revert by changing the Boolean.</p><p>0 = not removed</p><p>1 = removed</p> |
| **createdAt**   | datetime            | Yes          | Record creation date                                                                                                              |
| **updatedAt**   | datetime            | Yes          | Record last update date                                                                                                           |
| **updatedBy**   | bigint(20)          | Yes          | ID representing the user who updated                                                                                              |
| **botId**       | bigint(20) unsigned | Yes          | ID representing a virtual agent, related to the virtual agent table                                                               |
| **metadata**    | varchar(100)        | Yes          | Intent metada, depends of the chosen NLP                                                                                          |

{% hint style="info" %}
**To learn more how to use** [**Intents**](https://docs.eva.bot/user-guide/using-eva/develop-your-bot/dialog-cells/intent-cells) **in eva**
{% endhint %}

## NLP Engine

The nlp\_engine stores NLP integration data.

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                               |
| --------------- | ------------------- | ------------ | ----------------------------------------------------------------------------- |
| **id**          | bigint(20) unsigned | No           | ID representing a cognitive engine                                            |
| **engine**      | varchar(20)         | No           | Shows the cognitive engine used: DialogFlow,Watson, eva NLP, Luis e QnA Maker |
| **metadata**    | text                | No           | Shows the cognitive engine metada values                                      |
| **createdBy**   | varchar(50)         | Yes          | ID representing the user who created                                          |
| **updatedBy**   | varchar(50)         | Yes          | ID representing the user who updated                                          |
| **createdAt**   | datetime            | Yes          | Record creation date                                                          |
| **updatedAt**   | datetime            | Yes          | Record last update date                                                       |

## &#x20;NLP Token&#x20;

The nlp\_token table stores the tokens generated by Dialogflow.&#x20;

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                     |
| --------------- | ------------------- | ------------ | ------------------------------------------------------------------- |
| **id**          | bigint(20) unsigned | No           | ID that stores the NLP authentication token                         |
| **token**       | varchar(255)        | Yes          | Shows the token value                                               |
| **tokenDate**   | datetime            | Yes          | Token creation date                                                 |
| **botId**       | bigint(20) unsigned | No           | ID representing a virtual agent, related to the virtual agent table |

## Permission

The permission table stores permissions that can be given to a user.

| **Column Name** | **Data Type** | **Not Null** | **Description**                                                    |
| --------------- | ------------- | ------------ | ------------------------------------------------------------------ |
| **id**          | bigint(20)    | No           | ID that identifies the permission type that can be given to a user |
| **name**        | varchar(20)   | No           | Permission type name                                               |
| **description** | varchar(200)  | Yes          | Permission description                                             |

## &#x20;Role

The role table stores the functions that can be given to a user.

| **Column Name** | **Data Type** | **Not Null** | **Description**                                                                            |
| --------------- | ------------- | ------------ | ------------------------------------------------------------------------------------------ |
| **id**          | bigint(20)    | No           | ID that identifies the role of a user                                                      |
| **name**        | varchar(20)   | No           | <p>User role name:</p><p>Admin<br> Superadminuser<br> Editor<br> Analyts<br> Technical</p> |
| **description** | varchar(200)  | Yes          | Role description                                                                           |

## Role Permission

The role\_permission stores role and permission data, allowing to identify each user role and permission.

| **Column Name**  | **Data Type** | **Not Null** | **Description**                                                                   |
| ---------------- | ------------- | ------------ | --------------------------------------------------------------------------------- |
| **roleId**       | bigint(20)    | No           | ID that identifies the role of a user, related to the role table                  |
| **permissionId** | bigint(20)    | No           | ID that identifies the permission that was given, related to the permission table |
| **createdAt**    | datetime      | Yes          | Record creation date                                                              |
| **updatedAt**    | datetime      | Yes          | Record last update date                                                           |

## Sequelizemeta

The sequelizemeta table stores the configuration history.

| **Column Name** | **Data Type** | **Not Null** | **Description**                          |
| --------------- | ------------- | ------------ | ---------------------------------------- |
| **name**        | varchar(255)  | No           | Shows the cockpit team migration history |

## Tag Type

The tag\_type table stores the repository types: intent, entity, answer, flow, prototype and service.

| **Column Name** | **Data Type** | **Not Null** | **Description**                 |
| --------------- | ------------- | ------------ | ------------------------------- |
| **id**          | tinyint(1)    | No           | ID that identifies the tag type |
| **type**        | varchar(45)   | No           | Identifies the tag type         |

## Tag Uses

The tag\_uses table stores tag data and which repository it is related to, allowing to identify the tag, repository type and which repository ID the tag is related to.

| **Column Name** | **Data Type** | **Not Null** | **Description**                                                                  |
| --------------- | ------------- | ------------ | -------------------------------------------------------------------------------- |
| **tagId**       | bigint(20)    | No           | Tag ID, related to the tag table                                                 |
| **intentId**    | bigint(20)    | Yes          | ID that identifies the intent name                                               |
| **tag\_typeId** | tinyint(1)    | No           | Tag type ID, related to the tag\_type table                                      |
| **createdAt**   | datetime      | Yes          | Record creation date                                                             |
| **updatedAt**   | datetime      | Yes          | Record last update date                                                          |
| **entityId**    | bigint(20)    | Yes          | ID that identify the entity, related to the entity table                         |
| **answerId**    | bigint(20)    | Yes          | ID that identifies the delivered answer                                          |
| **serviced**    | bigint(20)    | Yes          | ID that identifies the service cell, related to the transactional\_service table |

## Tags

The tags table stores the tags created in the virtual agent. The tags helps to identify objects.&#x20;

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                     |
| --------------- | ------------------- | ------------ | ------------------------------------------------------------------- |
| **id**          | bigint(20)          | No           | ID that identifies a tag                                            |
| **name**        | varchar(255)        | Yes          | Tag name                                                            |
| **createdAt**   | datetime            | Yes          | Record creation date                                                |
| **updatedAt**   | datetime            | Yes          | Record last update date                                             |
| **botId**       | bigint(20) unsigned | Yes          | ID representing a virtual agent, related to the virtual agent table |

## Training

The training table stores virtual agent training data. When a user trains a virtual agent in the cockpit, the data is stored in this tablea.

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                                  |
| --------------- | ------------------- | ------------ | -------------------------------------------------------------------------------- |
| **id**          | bigint(20)          | No           | ID that identifies a training                                                    |
| **version**     | varchar(5)          | No           | Shows how many times a virtual agent was trained using a version number          |
| **status**      | varchar(40)         | No           | <p>Shows the training status:</p><p>1 – training<br> 2 – ready<br> 3 – error</p> |
| **trainer**     | bigint(20)          | No           | Shows the user who trained, related to the user table                            |
| **accuracy**    | tinyin(4)           | No           | Training accuracy value                                                          |
| **botId**       | bigint(20) unsigned | No           | ID representing a virtual agent, related to the virtual agent table              |
| **updatedAt**   | datetime            | Yes          | Record last update date                                                          |

## Transactional Service

The transactional\_service table stores the transactional calls performed during a session. Is possible to identify which service was called and the answer content by the webhook.

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                                                                           |
| --------------- | ------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------- |
| **id**          | bigint(20)          | No           | ID that identifies a transactional call                                                                                   |
| **webhook**     | text                | No           | API URL                                                                                                                   |
| **content**     | text                | No           | Content that will be used in the transactional call                                                                       |
| **name**        | varchar(80)         | No           | Service call name                                                                                                         |
| **description** | text                | Yes          | Service call description                                                                                                  |
| **createdAt**   | datetime            | Yes          | Record creation date                                                                                                      |
| **updatedAt**   | datetime            | Yes          | Record last update date                                                                                                   |
| **createdBy**   | bigint(20)          | Yes          | ID representing the user who created                                                                                      |
| **updatedBy**   | bigint(20)          | Yes          | ID representing the user who updated                                                                                      |
| **removed**     | tinyint(1)          | Yes          | <p>Shows if it was removed. It is possible to revert by changing the Boolean.</p><p>0 = not removed</p><p>1 = removed</p> |
| **botId**       | bigint(20) unsigned | No           | ID representing a virtual agent, related to the virtual agent table                                                       |

## &#x20;User

The user table stores the cockpit users created in the keycloak, which is an access control tool responsible for eva’s user authentication.

| **Column Name**     | **Data Type** | **Not Null** | **Description**                                                                                                           |
| ------------------- | ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------- |
| **id**              | bigint(20)    | No           | ID that identifies the user                                                                                               |
| **keycloakUserId**  | varchar(50)   | Yes          | Shows the user ID that is stored in keycloak                                                                              |
| **username**        | varchar(20)   | No           | Shows the user name                                                                                                       |
| **image**           | mediumblob    | Yes          | Stores the user profile image                                                                                             |
| **company**         | varchar(50)   | Yes          | Identifies the company where the user works                                                                               |
| **role**            | varchar(50)   | Yes          | Identifies user role                                                                                                      |
| **root**            | varchar(20)   | No           | Informs if the user is root                                                                                               |
| **createdBy**       | varchar(50)   | Yes          | ID representing the user who created                                                                                      |
| **updatedBy**       | varchar(50)   | Yes          | ID representing the user who updated                                                                                      |
| **createdAt**       | datetime      | Yes          | Record creation date                                                                                                      |
| **updatedAt**       | datetime      | Yes          | Record last update date                                                                                                   |
| **resetToken**      | varchar(100)  | Yes          | Shows the token value                                                                                                     |
| **createTokenDate** | datetime      | Yes          | Token creation date                                                                                                       |
| **removed**         | tinyint(1)    | No           | <p>Shows if it was removed. It is possible to revert by changing the Boolean.</p><p>0 = not removed</p><p>1 = removed</p> |

## User Virtual Agent Role

The user\_bot\_role table stores user identification, virtual agent and role data.

| **Column Name** | **Data Type**       | **Not Null** | **Description**                                                     |
| --------------- | ------------------- | ------------ | ------------------------------------------------------------------- |
| **userId**      | bigint(20)          | No           | ID that identifies the user, related to the user table              |
| **botId**       | bigint(20) unsigned | No           | ID representing a virtual agent, related to the virtual agent table |
| **roleId**      | bigint(20)          | No           | ID that identifies a role, related to the role table                |
| **createdBy**   | varchar(50)         | Yes          | ID representing the user who created                                |
| **updatedBy**   | varchar(50)         | Yes          | ID representing the user who updated                                |
| **createdAt**   | datetime            | Yes          | Record creation date                                                |
| **updatedAt**   | datetime            | Yes          | Record last update date                                             |

## &#x20;Utterances

The utterances table stores intent examples. When a user creates an intent in the virtual agent, he must add sentences that can appear in a conversation with the virtual agent.&#x20;

| **Column Name** | **Data Type**       | **Not Null** | **Description**                      |
| --------------- | ------------------- | ------------ | ------------------------------------ |
| **id**          | bigint(20)          | No           | ID that identifies an utterance      |
| **example**     | varchar(1000)       | No           | Utterance examples (intents)         |
| **intentId**    | bigint(20)          | Yes          | ID that identifies an intent name    |
| **createdAt**   | datetime            | Yes          | Record creation date                 |
| **updateAt**    | datetime            | Yes          | ID representing the user who updated |
| **botId**       | bigint(20) unsigned | Yes          | Utterances metada                    |

![Database relationship schematics](https://2823722678-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNuMuHVlHgsqK4L1Tp4%2F-M_SYCOY6xXApONtD01C%2F-M_S_TTj72RAYEPs3bJ7%2Fdatabase%20relationship.png?alt=media\&token=84b1e69c-df87-43f4-a9bc-acbd2f8bbf50)
