Offline Data Sources

Before using RES, you need to prepare five basic data packages and upload them to OBS. Currently, only the csv and json data formats are supported. Table 1 describes more details.

Table 1 Basic data table

Data Type

Table Name

User data

User Attribute Table

Item data

Item Attribute List

Behavior data

User Operation Behavior Table

  1. You need to manually create these tables and store them on OBS.
  2. The table structure must meet the requirements of RES. The column names and field types must be the same as those specified in Data Format Standards. For more details, see the following tables.
  3. The data filled in each table must meet the requirements of RES.
  4. For fields that cannot be provided, set those parameters to NULL.

User Attribute Table

This table stores user attribute information, such as regions and hobbies. The attribute name and attribute value must be configured in pairs.

Table 2 Parameters

Parameter

Type

Description

Mandatory

userId

String

Unique identifier of an end-user. For example, the user login account and International Mobile Equipment Identity (IMEI) number.

Yes

userProperties

String

User attribute key-value string. Different attributes are separated by \002(ASCII value). The key and value of an attribute are separated by \003(ASCII value).

Different values of multiple enumeration attributes are separated by \004(ASCII value).

Different key-value pairs of map attributes are separated by \004(ASCII value), each key value pair is separated by a colon (:).

The basic format is k1\003v1\002k2\003v2\k3\003v1\004v2\004v3\002k4\003\k1:v1\004k2:v2\004k3:v3.

For example, if a user has four tags, namely, age=18, gender=1, hobby=[read,gym,music], and profile={morality:0.8,iq:0.7,art:0.9}, the record can be encoded as age\00318\002gender\0031\002hobbies\003read\004gym\004music\002profile\003morality:0.8\004iq:0.7\004art:0.9.

Value type in a key-value pair of field userProperties is provided in User Attribute Configuration Table.

No

User Attribute Example (JSON)

{
    "userId":"user1",
    "userProperties":"provinceId\u00035147\u0002cityId\u00035148\u0002districtId\u00035154\u0002streetId\u0003130533\u0002payment_type\u00031\u0002payment_method\u0003CMBLIFE_CMBLIFE\u0002payment_channel\u000312"
}

Item Attribute List

This list stores the item attribute information, such as the type and length. The attribute name and attribute value must be configured in pairs.

Table 3 Parameters

Parameter

Type

Description

Mandatory

itemId

String

ID of an item

Yes

itemProperties

String

Key-value information of an item. The key indicates the item name and the value indicates the value. The basic format is the same as that of field userProperties in User Attribute Table.

No

Item Attribute Example

{
    "itemId":"item1",
    "itemProperties":"product_name\u0003wyf-name\u0002order_price\u0003500.00\u0002weight\u0003130.00\0002volume\u0003v1"
}

User Operation Behavior Table

This table stores details of an instance of user behavior, including the user ID, item ID, behavior type, and time when this behavior is performed.
Table 4 Parameters

Parameter

Type

Description

Mandatory

userId

String

User ID

Yes

objectType

String

Name of an item.

Items are objects that users have performed operations on.

Yes

actionObject

String

Object of behavior. If a user acts on an item, the value is the item ID.

Yes

actionType

String

Behavior types:

  • view: Indicates that an item/content is exposed to users.
  • click: Indicates a user clicks an item or content.
  • collect: Indicates a user adds an item or content to favorites.
  • uncollect: Indicates a user removes an item or content from favorites.
  • search_click: Indicates a user clicks an item in the search results.
  • comment: Indicates that a user makes comments on an item or content.
  • share: Indicates that a user shares an item/content with others.
  • like: Indicates a user gives an item or content a thumb-up.
  • dislike: Indicates a user gives an item or content a thumb-down.
  • grade: Indicates that a user rates an item/content.
  • consume: Indicates that a user buys an item (primarily refers to commodities).
  • use: Indicates that a user watches videos/listens to a kind of music/reads something (primarily refers to content)...

Yes

actionMeasure

String

Measurement of a behavior, such as the amount paid, score rated, and how many times it happened (integer).

Default value:

  • For the behaviors Rate or Use, the value is determined by users as needed. For example, the value 0.5 indicates two minutes spent watching videos, and the value 0.8 indicates 5 minutes spent.
  • The default value of other behaviors is 1.0.

Yes

actionContent

String

For the behavior Make comments, the content of comments needs to be recorded.

For the behavior Click an item in search results, the search keywords need to be recorded.

No

actionDateTime

String

Time when a behavior occurs, in seconds and complied with Coordinated Universal Time (UTC).

No

actionLocation

String

Location, or latitude and longitude of an occurred behavior.

The format is [latitude, longitude]

No

context

String

Contextual information about an action. The content is a JSON string and can function as an extended field in User Operation Behavior Table.

For example, current device ID and IP address of a user are types of contextual information.

No

subSite

String

Location ID of an occurred behavior, for example, a homepage where you can click recommendation items to enter the item details page.

No

traceId

String

Unique ID used to trace each recommendation item. The ID is used in effect evaluation.

No

flowId

String

ID of a flow, which is used to evaluate effect of an online flow. The flow ID is returned by the RES API to users. You need to write the flow ID to the user behavior logs.

No

User Operation Behavior Example

{
    "userId":"user1",
    "objectType":"item",
    "actionObject":"item1",
    "actionType":"collect",
    "actionMeasure":"1.0",
    "actionDateTime":"1512689700"
}