# Data model

[Conversation Insights](/docs/conversations/intelligence/conversation-insights) uses a semantic data model based on OLAP (Online Analytical Processing) concepts. This page explains the key concepts and lists the available data you can query.

## Core concepts

### Cubes

A cube is a collection of related data organized for analysis. Each cube contains measures and dimensions that you can query together. Conversation Insights provides the following cubes:

* **Conversation**: conversation metadata from [Conversation Orchestrator](/docs/conversations/orchestrator).
* **OperatorResult**: results from intelligence operators run on conversations.

### Measures

Measures are numeric values that can be aggregated. Use measures to count, sum, or calculate statistics across your data.

**Example**: `Conversation.Count` returns the count of unique conversations.

### Dimensions

Dimensions are attributes that describe your data. Use dimensions to filter results or group measures into categories.

**Example**: `Conversation.ConversationStatus` contains the current status of the conversation.

## Conversation cube

The Conversation cube contains metadata about conversations captured by [Conversation Orchestrator](/docs/conversations/orchestrator).

### Conversation measures

The Conversation cube includes the following measures:

| Name                 | Type   | Description                        |
| -------------------- | ------ | ---------------------------------- |
| `Conversation.Count` | number | The count of unique conversations. |

### Conversation dimensions

The Conversation cube includes the following dimensions:

| Name                                        | Type   | Description                                                                                                                     |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------- |
| `Conversation.ConversationId`               | string | The unique identifier for the conversation.                                                                                     |
| `Conversation.ConversationName`             | string | The name of the conversation.                                                                                                   |
| `Conversation.ConversationStatus`           | string | The current status of the conversation.                                                                                         |
| `Conversation.IntelligenceConfigurationIds` | string | The intelligence configurations associated with the conversation.                                                               |
| `Conversation.ParticipantId`                | string | The unique identifier for the participant.                                                                                      |
| `Conversation.ParticipantType`              | string | The type of participant (for example, agent or customer).                                                                       |
| `Conversation.ParticipantProfileId`         | string | The profile identifier for the participant.                                                                                     |
| `Conversation.CreatedDate.hour`             | time   | The date and time when the conversation was created, grouped by hour. Use `.day`, `.week`, or `.month` for other granularities. |

## OperatorResult cube

The OperatorResult cube contains results from intelligence operators run on conversations. Use this cube to count and group operator results by operator name, label, channel, or configuration.

The following operators produce results in the OperatorResult cube:

* [Sentiment operator (Twilio-authored)](/docs/conversations/intelligence/use-twilio-authored-language-operators#sentiment-operator)
* [Custom operators](/docs/conversations/intelligence/create-custom-language-operators) with `outputFormat: CLASSIFICATION`.

### OperatorResult measures

The OperatorResult cube includes the following measures:

| Name                   | Type   | Description                           |
| ---------------------- | ------ | ------------------------------------- |
| `OperatorResult.Count` | number | The count of unique operator results. |

### OperatorResult dimensions

The OperatorResult cube includes the following dimensions:

| Name                                           | Type   | Description                                                                                                                        |
| ---------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| `OperatorResult.ConversationId`                | string | The unique identifier for the conversation.                                                                                        |
| `OperatorResult.IntelligenceConfigurationId`   | string | The unique identifier for the intelligence configuration.                                                                          |
| `OperatorResult.IntelligenceConfigurationName` | string | The display name of the intelligence configuration.                                                                                |
| `OperatorResult.KnowledgeBaseId`               | string | The Knowledge Base ID used during operator rule execution.                                                                         |
| `OperatorResult.MemoryStoreId`                 | string | The unique identifier for the Knowledge Base linked to the operator result.                                                        |
| `OperatorResult.OperatorId`                    | string | The unique identifier for the operator.                                                                                            |
| `OperatorResult.OperatorName`                  | string | The name of the operator (for example, Sentiment Analysis).                                                                        |
| `OperatorResult.OperatorLabel`                 | string | The label associated with the operator result (for example, positive, negative).                                                   |
| `OperatorResult.ExecutedChannels`              | string | The communication channel for the conversation (for example, voice, chat, sms, whatsapp).                                          |
| `OperatorResult.CreatedDate.hour`              | time   | The date and time when the operator result was created, grouped by hour. Use `.day`, `.week`, or `.month` for other granularities. |

## Time dimensions

Time dimensions group data by time periods. Use dimension names with granularity suffixes.

**Conversation cube:**

* `Conversation.CreatedDate.hour`: group by hour
* `Conversation.CreatedDate.day`: group by day
* `Conversation.CreatedDate.week`: group by week
* `Conversation.CreatedDate.month`: group by month

**OperatorResult cube:**

* `OperatorResult.CreatedDate.hour`: group by hour
* `OperatorResult.CreatedDate.day`: group by day
* `OperatorResult.CreatedDate.week`: group by week
* `OperatorResult.CreatedDate.month`: group by month

See [Query syntax](/docs/conversations/intelligence/conversation-insights/query-syntax) for examples.

## Discover available data

Use the Metadata API to retrieve the current list of cubes, measures, and dimensions:

Retrieve available cubes, measures, and dimensions

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID at twilio.com/console
// Provision API Keys at twilio.com/console/runtime/api-keys
// and set the environment variables. See http://twil.io/secure
// For local testing, you can use your Account SID and Auth token
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const apiKey = process.env.TWILIO_API_KEY;
const apiSecret = process.env.TWILIO_API_SECRET;
const client = twilio(apiKey, apiSecret, { accountSid: accountSid });

async function fetchMetadata() {
  const metadata = await client.insights.v3.metadata.fetch();

  console.log(metadata.domain);
}

fetchMetadata();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID at twilio.com/console
# Provision API Keys at twilio.com/console/runtime/api-keys
# and set the environment variables. See http://twil.io/secure
# For local testing, you can use your Account SID and Auth token
api_key = os.environ["TWILIO_API_KEY"]
api_secret = os.environ["TWILIO_API_SECRET"]
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
client = Client(api_key, api_secret, account_sid)

metadata = client.insights.v3.metadata.fetch()

print(metadata.domain)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Insights.V3;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID at twilio.com/console
        // Provision API Keys at twilio.com/console/runtime/api-keys
        // and set the environment variables. See http://twil.io/secure
        // For local testing, you can use your Account SID and Auth token
        string apiKey = Environment.GetEnvironmentVariable("TWILIO_API_KEY");
        string apiSecret = Environment.GetEnvironmentVariable("TWILIO_API_SECRET");
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");

        TwilioClient.Init(apiKey, apiSecret, accountSid);

        var metadata = await MetadataResource.FetchAsync();

        Console.WriteLine(metadata.Domain);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.insights.v3.Metadata;

public class Example {
    // Find your Account SID at twilio.com/console
    // Provision API Keys at twilio.com/console/runtime/api-keys
    // and set the environment variables. See http://twil.io/secure
    // For local testing, you can use your Account SID and Auth token
    public static final String API_KEY = System.getenv("TWILIO_API_KEY");
    public static final String API_SECRET = System.getenv("TWILIO_API_SECRET");
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");

    public static void main(String[] args) {
        Twilio.init(API_KEY, API_SECRET, ACCOUNT_SID);
        Metadata.FetchMetadataResponse response = Metadata.fetcher().fetch();

        System.out.println(response.getDomain());
    }
}
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID at twilio.com/console
# Provision API Keys at twilio.com/console/runtime/api-keys
# and set the environment variables. See http://twil.io/secure
# For local testing, you can use your Account SID and Auth token
api_key = ENV['TWILIO_API_KEY']
api_secret = ENV['TWILIO_API_SECRET']
account_sid = ENV['TWILIO_ACCOUNT_SID']
@client = Twilio::REST::Client.new(api_key, api_secret, account_sid)

metadata = @client
           .insights
           .v3
           .metadata
           .fetch

puts metadata.domain
```

```bash
curl -X GET "https://insights.twilio.com/v3/InsightsDomains/Conversations/Metadata" \
-u $TWILIO_API_KEY:$TWILIO_API_SECRET
```

The metadata response provides the authoritative list of available data, including descriptions and types.

## Next steps

Explore the following resources to learn more:

* [Aggregate conversation data](/docs/conversations/intelligence/conversation-insights/aggregate-data)
* [Query syntax](/docs/conversations/intelligence/conversation-insights/query-syntax): learn how to construct queries with filters and aggregations.
