# 5.1 Customer AI - Data Preparation (Ingest)

In order for Intelligent Services to discover insights from your marketing events data, the data must be semantically enriched and maintained in a standard structure. Intelligent Services leverages Adobe's Experience Data Model (XDM) schemas in order to achieve this. Specifically, all datasets that are used in Intelligent Services must conform to the **Consumer Experience Event** XDM schema.

## 5.1.1 Create Schema

In this exercise, you'll create a schema that contains the **Consumer Experience Event mixin**, which is required by the **Customer AI** Intelligent Service.

Log in to Adobe Experience Platform by going to this URL: <https://experience.adobe.com/platform>.

After logging in, you'll land on the homepage of Adobe Experience Platform.

![Data Ingestion](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-d3766e8abcdcae565589d172ff39148a026b3712%2Fhome.png?alt=media)

Before you continue, you need to select a **sandbox**. The sandbox to select is named `--module10sandbox--`. You can do this by clicking the text **\[!UICONTROL Production Prod]** in the blue line on top of your screen. After selecting the appropriate sandbox, you'll see the screen change and now you're in your dedicated sandbox.

![Data Ingestion](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-f8fe0607dc3e272ebd2416a98220bb1d82c1a166%2Fsb1.png?alt=media)

From the left menu, click **Schemas** and go to **Browse**. Click **Create Schema**.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-92b4ce186d21510cd0778c9d24508f180924c812%2Fcreate-schema-button.png?alt=media)

In the popup, select **XDM ExperienceEvent**.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-b9f5675881bde9e2726a30cd6c56af257816502e%2Fxdmee.png?alt=media)

You'll then see this.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-17f00ae4487ba658ea340d258931a1a36cedc67f%2Fxdmee1.png?alt=media)

Search and select the following **Mixins** to add to this Schema:

* Consumer Experience Event

  ![New CEE schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-2c712335b86ba2567e1d302f1a6b715b66d24131%2Fcee.png?alt=media)
* End User ID Details

  ![New CEE schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-e981585dd24af5cd2ec90da0a97bd56f986ab0b8%2Fidentitymap.png?alt=media)

Click **Add Field Groups**.

![Identity key defn](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-5ab1f4b117d0a397e1c65a2be3661e2865be7430%2Faddmixin.png?alt=media)

You'll then see this. Select the Mixin **End User ID Details**.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-a85a8f3837a1505ee2fc2b27b292eaaf16f41894%2Feui1.png?alt=media)

Navigate to the field **endUserIDs.\_experience.emailid.id**.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-fff387271361b371f89b73eba505d526c130d74c%2Feui2.png?alt=media)

In the right menu for the field **endUserIDs.\_experience.emailid.id**, scroll down and check the checkbox for **Identity**, check the checkbox for **Primary Identity** and select the **Identity namespace** of **Email**.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-b919053abc070136aa3c837dddaf1423f7662357%2Feui3.png?alt=media)

Navigate to the field **endUserIDs.\_experience.mcid.id**. Check the checkbox for **Identity** and select the **Identity namespace** of **ECID**. Click **Apply**.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-3fb5fa212c9cd09a6ad3bf606c04dacbd853c12f%2Feui4.png?alt=media)

Give your schema a name now.

As the name for our schema, you'll use this:

* `--demoProfileLdap-- - Demo System - Customer Experience Event`

As an example, for ldap **vangeluw**, this should be the name of the schema:

* **vangeluw - Demo System - Customer Experience Event**

That should give you something like this. Click the **+ Add** button to add new **Mixins**.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-e426b7874d53a1fd39d07d5343c8c5a0d4cb8bb6%2Fxdmee2.png?alt=media)

Select the name of your schema. You should now enable your schema for **Profile**, by clicking the **Profile** toggle.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-12df818b014ece011551b82cbed39cf255646bbe%2Fxdmee3.png?alt=media)

You'll then see this. Click **Enable**.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-a829162a7d21f3d36eaf651f79ee4643ad107b39%2Fxdmee4.png?alt=media)

You should now have this. Click **Save** to save your schema.

![Create new schema](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-18f41376a9ca3b08413cca75616072ec044ca71a%2Fxdmee5.png?alt=media)

## 5.1.2 Create Dataset

From the left menu, click **Datasets** and go to **Browse**. Click **Create dataset**.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-08ddffab4264c8c2faff30a5e5d2b43a60b8fdde%2Fcreateds.png?alt=media)

Click **Create dataset from schema**.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-bb9e7d88947a40f3fe68be4da9b63e154ecc6eb2%2Fcreatedatasetfromschema.png?alt=media)

In the next screen, select the dataset you created in the previous exercise, which is named **\[!UICONTROL ldap - Demo System - Customer Experience Event]**. Click **Next**.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-c00c3212ac76216ac21243a20d916760413fd443%2Fcreateds1.png?alt=media)

As a name for your dataset, use `--demoProfileLdap-- - Demo System - Customer Experience Event Dataset`. Click **Finish**.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-d3670832941fdd2d0b6802f041800740edfac8e9%2Fcreateds2.png?alt=media)

Your dataset is now created. Enable the **Profile** toggle.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-b9c7adfdf78a8e3ec4e713f1844f4b988100327f%2Fcreateds3.png?alt=media)

Click **Enable**.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-98fed88dc5ff332f3cb339d5580a140a2a692a0f%2Fcreateds4.png?alt=media)

You should now have this:

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-4e06d207153102c1cada2386385843c1a67016eb%2Fcreateds5.png?alt=media)

You're now ready to start ingesting Consumer Experience Event data and start using the Customer AI service.

## 5.1.3 Download Experience Event test data

Once the **Schema** and **Dataset** are configured, you're now ready to ingest Experience Event data. Since Customer AI requires data across **2 quarters at least**, you'll need to ingest externally prepared data.

The data prepared for the experience events must comply to the requirements and schema of the [Consumer Experience Event XDM Mixin](https://github.com/adobe/xdm/blob/797cf4930d5a80799a095256302675b1362c9a15/docs/reference/context/experienceevent-consumer.schema.md).

Please download the file containing sample data from this location: <https://dashboard.adobedemo.com/data>. Click the **Download** button.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-dc75fd990ed82478c8693ca90af684e4524a9400%2Fdsn1.png?alt=media)

Alternatively, if you can't access the above link, you can download the file also from this location: <https://aepmodule10.s3-us-west-2.amazonaws.com/retail-v1-dec2020-xl.json.zip>.

You've now downloaded a file named **retail-v1-dec2020-xl.json.zip**. Place the file on your computer's desktop and unzip it, after which you'll see a file named **retail-v1.json**. You'll need this file in the next exercise.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-b1984c258c6002349a8c8635c372dfecb68d6c24%2Fingest.png?alt=media)

## 5.1.4 Ingest Experience Event test data

In Adobe Experience Platform, go to **Datasets** and open your dataset, which is named **ldap - Demo System - Customer Experience Event Dataset**.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-8dea5d9d4e71fc568640bcd9e6f273589a25a077%2Fingest1.png?alt=media)

In your dataset, click **Choose files** to add data.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-db1315bc36c2016277428ad32bf00ca65f43091f%2Fingest2.png?alt=media)

In the popup, select the file **retail-v1.json** and click **Open**.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-52c5b7b1da2785e5ff6bf0a360f9cfe8470015c2%2Fingest3.png?alt=media)

You'll then see the data being imported, and a new batch is created in the **Loading** state. Don't navigate away from this page until the file is uploaded.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-f826c7be6b584445f0d1d7099cb73b0ce7257d91%2Fingest4.png?alt=media)

Once the file has been uploaded, you'll see the batch status change from **Loading** to **Processing**.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-b3ea5299d8f518ed60bcaa3e97718f23e3f2db73%2Fingest5.png?alt=media)

Ingesting and processing the data might take 10-20min.

Once data ingestion is successful, the batch status will change to **Success**.

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-1b671162b1fbfbe7fead5a74f169e48a8fd76fd9%2Fingest7.png?alt=media)

![Dataset](https://858372621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpBC8bA57il8Sj47B7QPJ%2Fuploads%2Fgit-blob-b5cd9bd50cf8e66b772930da11e1c4f3ad4ad685%2Fingest8.png?alt=media)
