Transformation Rules - ETL Pipelines
Explanation of Columns
This document outlines the transformation rules and source-to-target data mappings for ETL pipelines.Target Field
Represents the field name in the target system where the transformed data will be stored.
Source Field (MongoDB)
Specifies the corresponding field in MongoDB from which the data is extracted.
Source Data Type
Defines the data type of the source field in MongoDB (e.g.,
String
,Integer
,DateTime
).
Field Type
Indicates whether the field is an Existing Field (predefined in the system) or a Custom Field (added for specific business needs).
Transformation Rules
Describes the logic applied to convert the source data into the target format.
Conversations
conversation
A conversation entity records the customer's conversation details. A conversation consists of all channel sessions where a customer is conversing, the conversation participants (bots, agents, customers) and optionally also some conversation data.
See more about Conversations on Conversation Objects Unique id to identify this conversation
This table only records the essential conversation fields. There are separate tables for conversation data and conversation participants.
Extraction Details
Purpose: Uses an API of the historical reports manager component to fetch the required data.
API URL:
<FQDN>/historical-reports/stats/conversation?endTime=1900-01-01T00:00:00.000Z&limit=100
Component Description: Makes a REST API call to fetch conversation data from the historical reports manager component.
Target Field | Source Field ( API / MongoDB ) | Source Data Type | Field Type | Transformation Rules |
---|---|---|---|---|
conversation_id | _id | ObjectId | Existing |
|
room_id (reserved for future) | none | Existing | Identifies the room this conversation is a part of. Currently, null since a conversation is not a part of any room. | |
customer_id | customer._id | ObjectId | Existing | Unique identifier of the customer associated with the conversation. |
customer_name | customer.firstName | String | Existing | Records the customer name with whom this conversation is associated. |
start_time | creationTime | Date | Existing | Records the date and time when this conversation was started. |
end_time | endTime | Date | Existing | Records the date and time when this conversation was ended. |
conversation_duration | conversationDuration | [INT] | Custom | Stores the total duration of the conversation, calculated as the difference between |
bot_id | botId | String | Existing | Identifier of the bot who was a participant of this conversation. |
task_state | taskState | String | Custom |
|
reason_code | reasonCode | String | Custom |
|
disposition | disposition | String | Custom |
This is the reason why the conversation was closed. The details can be referenced from the document Task Reason Codes
|
direction | conversationDirection | String | Existing | Records the direction of conversation i.e. INBOUND/OUTBOUND. There can be multiple channel sessions (INBOUND/OUTBOUND) in a conversation. We'll consider the conversation's direction based on the first channel session's direction in a conversation. |
conversation_data
A conversation can have key-value pairs to record any arbitrary additional data required. This is known as the conversation data. A single key-value pair for a conversation is inserted as one record in this table.
See Conversation Data for more details.
Extraction Details
Purpose: Extracts data from MongoDB based on a specific query.
MongoDB Query:
CODE{ "$and": [ { "conversationData": { "$exists": true, "$type": "object", "$ne": {} } } ] }
Field | Source Field ( API / MongoDB ) | Source Data Type | Field Type | Transformation Rules |
---|---|---|---|---|
conversation_id | _id | ObjectId | Existing | Identifies the conversation for which this conversation data record is inserted. |
key | key | String | Custom | Any alphanumeric value from conversationData Object. |
value | value | String | Custom | Any alphanumeric value from conversationData Object. |
record_creation_time | endTime | Date | Existing | Records the date and time when this conversation was ended. |
conversation_participant
Conversation participants are the participants that take part in a conversation. For example , customers, bots and agents. Each record in the table represents a Conversation Participant.
Extraction Details
Purpose: Uses an API of the historical reports manager component to fetch the required data.
API URL:
<FQDN>/historical-reports/stats/conversation/participant?endTime=<last_sync_time>&limit=100
Component Description: Makes a REST API call to fetch conversation participant data from the historical reports manager component.
Field | Source Field ( API / MongoDB ) | Source Data Type | Field Type | Transformation Rules |
---|---|---|---|---|
id | Auto-Generated | [nvarchar](50) | Custom | A unique identification of a participation by agent/customer/bot etc. |
participant_id | participantId | String | Existing |
|
conversation_id | conversationId | String | Existing |
|
participant_role (AGENT | CUSTOMER | EXTERNAL) | participantRole | String | Custom | Indicates the role of a participant in the conversation
Derived from Role is determined as follows: |
record_creation_time | recordCreationTime | Timestamp | Existing | Assigned based on |