Preparing an Offline Data Source
When using RES to create a data source, you need to prepare basic data packages and upload them to OBS. If the nearline process is used, the tracing point logs of the service system must be converted to the format specified by RES and written to the corresponding DIS streams in real time. This section describes the data formats of the offline and nearline data sources of RES. You can prepare data by referring to this section. The basic data packages include:
User Data
| Parameter | Type | Description | Mandatory |
|---|---|---|---|
| userId | String | Unique user ID | Yes |
| age | Long | Age | No |
| gender | String | Sex. Possible values are as follows:
| No |
| location | Json | Geographical location information concerning a user, which is set according to site requirements and in the format of {"lat": latitude, "lon": longitude}. Example: "location": {"lat": 41.12, "lon": -71.34}. | No |
| tags | List[String] | User tag. Each tag is an independent element, such as "basketball" and "family". | No |
| interest_tags | List[String] | Interest tag, which is automatically updated by the system. This field is reserved by default. | No |
| extend | Json | Extended field. The key and value of the extended field are specified by users.
| No |
Example of User Data
{
"userId": "user0",
"age": 22,
"gender": "female",
"location": {
"lat": 28.268705,
"lon": -144.70218
},
"tags": [
"walk",
"eat"
],
"extend": {
"extend_string": "walk",
"extend_long": 1575968675501,
"extend_float": 7.889256,
"extend_strArray": [
"football",
"walk",
"read",
"eat"
]
}
} Item Data
| Parameter | Type | Description | Mandatory |
|---|---|---|---|
| itemId | String | Unique item ID | Yes |
| itemType | String | Item type, which can be used to control the diversity of recommendation result sets. The possible values are:
| Yes |
| category | String | The category of an item, such as "course" or "snacks", which is the basis for the scatter function. | No |
| status | Long | Whether an item can be recommended or pinned to the top. The default value is 0.
| No |
| title | String | Title, which can be used for semantic analysis. If this parameter is not set, some algorithm effects will be lost. | No |
| score | Long | Weight of an item. A higher weight indicates a higher probability that the item is recommended. The value ranges from 1 to 100. If this parameter is not set, 1 is used by default. | No |
| publishTime | Long | The publishing time, in seconds and in Coordinated Universal Time (UTC). This parameter is highly recommended if timeless is crucial. | No |
| expireTime | Long | The expiry time, in seconds and in Coordinated Universal Time (UTC). If the current server time is later than the time specified by this parameter, the item will not be recommended. If this parameter is not set, the item or content never expires. | No |
| author | List[String] | Author information. One author corresponds to one element. You are advised to set this parameter in the information flow recommendation area. | No |
| content | String | Content description of an item, for example, introduction, abstract, or key part of the body. The value can contain up to 5,000 characters. If the value contains more than 5,000 characters, the excess characters will be truncated. If this parameter is not set, some algorithm effects will be lost. | No |
| tags | List[String] | Item tag. Each tag is an independent element, | No |
| location | Json | Geographical location of an item. The value is in the {"lat": latitude, "lon": longitude} format. Example: "location": {"lat": 41.12, "lon": -71.34}. | No |
| extend | Json | Extended field. The key and value of the extended field are specified by users.
| No |
Example of Item Data
{
"itemId": "item0",
"itemType": "item",
"category": "ceshi category",
"status": 1,
"score": 100,
"publishTime": 1575110848,
"expireTime": 1576441885,
"author": [
"author1"
],
"tags": [
"walk",
"read",
"ball"
],
"location": {
"lat": -15.56869,
"lon": 107.15255
},
"extend": {
"extend_string": "walk",
"extend_long": 1575968675536,
"extend_float": 6.182992,
"extend_strArray": [
"walk"
]
}
} Behavior Data
Example of Behavior Data
{
"userId": "user0",
"itemType": "item",
"itemId": "item0",
"actionType": "view",
"actionMeasure": 5,
"actionTime": 1575857721
} Last Article: Data Source Management Overview
Next Article: Uploading an Offline Data Source to OBS
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.