Bayes Data Format
Bayes customers receive game data in JSON format of a specific structure. We call this format Live Data Message. The Model Reference subsection contains detailed reference of all possible Live Data Messages for supported game titles. But here we will talk about the data format itself.
When you are receiving game data, whether it's a historic, scrim data or live data transferred by BEDEX, you are getting The Live Data Messages. Each Live Data Message is wrapped in another JSON structure called BayesMessageEnvelope, which itself is wrapped in yet another one, DataProviderMessage. Such nested structure allows you to identify key information early on in your processing.
Data message nested structure
DataProviderMessage
DataProviderMessage is the topmost message envelope. It contains several metadata fields and a payload
.
DataProviderMessage is not confined to live or historic game data. Any message sent through BEDEX will be wrapped in a DataProviderMessage. To unwrap it—read the payload
field.
Field | Description |
---|---|
path | This is the BEDEX identifier for the stream |
seqIdx | A unique number that identifies the ordering of messages in each stream. seqIdx starts at 1 and is increased for each message |
timeSent | UTC time when the message was originally sent by data provider |
providerSlug | null if game data collected from historic/scrim data, bayes or bayes-unlimited if game data distributed through BEDEX, bayesodds if odds distributed through Bayes Live Odds, bayesprob if probabilities distributed through Bayes Live Match Predictions |
payload | Contains the inner message (for live data it's a BayesMessageEnvelope) |
references | Currently not used |
version | DataProviderMessage sctructure version |
Example:
{
"path": "replay/esports/lol/riot/superleague_lol/10476977477967401/10476977477967401/3e67fcc7-fd42-52b5-c84e-a093ffceee26",
"seqIdx": 100,
"timeSent": "2022-01-14T05:38:08.479411Z",
"providerSlug": null,
"payload": {...},
"references": null,
"version": "2.0"
}
BayesMessageEnvelope
Field | Description |
---|---|
urn | Game reference ID |
payload | Contains a LiveDataMessage |
type | Contains information about the data provider for the corresponding title |
version | BayesMessageEnvelope sctructure version |
properties | Currently not used |
Example:
{
"urn": "live:lol:riot:map:fabafaeaa3a12-3702505",
"payload": {...},
"type": "LOL_RIOT_WEB_LIVESTATS",
"version": "0.3",
"properties": {}
}
LiveDataMessage
Field | Description |
---|---|
createdAt | The time when the message was created |
liveDataMatchUrn | A unique ID for the live data which identifies a specific map |
sourceUpdatedAt | The time when the original data was created, before converting into Live Data Message |
title | The game title (e.g. LOL) |
type | The type of message (more below) |
subject | The subject of message (more below) |
action | The action of message (more below) |
payload | Contains the game data specific for this kind of Live Data Message |
additionalProperties | Extra information about the match |
Type, Subject, Action
Type, Subject and Action are the main properties of the LiveDataMessage which determine its kind. The combination of these properties determines the meaning of the Live Data Message, the structure of its payload and the game data that it contains.
- Type – the category of the Live Data Message, e.g. INFO, GAME_EVENT, SNAPSHOT.
- Subject – the entity that the message talks about. It could be a PLAYER, a TEAM, or an entire MATCH.
- Action – the subject's activity described in the message. For example, the action UPDATE may appear for the TEAM subject (one of the team players picked a champion during draft) or for the MATCH subject (game stats updated).
Some examples of type-subject-action combinations are:
"type": "INFO", // Type of message
"subject": "MATCH", // Who
"action": "ANNOUNCE" // Did what
// The combination used to indicate a message which announces the beginning of each game.
"type": "GAME_EVENT", // Type of message
"subject": "PLAYER", // Who
"action": "KILL" // Did what
// The combination used to indicate that a player has killed another player
Live Data Message example:
{
"createdAt": "2022-01-14T05:38:08.452992Z",
"liveDataMatchUrn": "live:lol:riot:map:fabafaeaa3a12-3702505",
"sourceUpdatedAt": "2022-01-14T05:08:07.580Z",
"title": "LOL",
"type": "SNAPSHOT",
"subject": "MATCH",
"action": "UPDATE",
"payload": {...},
"additionalProperties": {
"perId": "esports:match:00be5e02-3313-55e2-9990-e8420f348a1b",
"esportsLeagueId": "98464993939946489",
"esportsGameID": "10476977477967401",
"gameNumber": "1",
"live:lol:riot:team:606850019910058606": "esports:team:01ae7b39-95e2-5963-b481-f1512a9cb9dd",
"esportsLeagueSlug": "superleague_lol",
"esportsLeagueName": "Superleague LoL",
"taskId": "3e67fcc7-fd42-52b5-c84e-a093ffceee26",
"esportsMatchId": "10476977477967401",
"live:lol:riot:team:503170068860071305": "esports:team:9ac9ccdd-7a41-55d2-0a63-443ead2682ef"
}
}
Working with Live Data Messages
To integrate Live Data Messages into your system, you will need to process each message according to its kind. Implementation tips are available at Working with the Data.
Let's consider a Kill event message:
{ // DataProviderMessage
"path": "replay/esports/lol/riot/worlds/80390366466309308/80390366466309308/010f96b6-870d-5fde-cf39-9e6cd06b813c",
"seqIdx": 7079,
"timeSent": "2021-11-18T15:52:37.470708Z",
"providerSlug": null,
"payload": { // BayesMessageEnvelope
"urn": "live:lol:riot:map:faaaaaaaaaa15-2072526",
"payload": { // LiveDataMessage
"createdAt": "2021-11-18T15:17:42.803216Z",
"liveDataMatchUrn": "live:lol:riot:map:faaaaaaaaaa15-2072526",
"sourceUpdatedAt": "2021-11-06T12:52:47.867Z",
"title": "LOL",
"type": "GAME_EVENT",
"subject": "PLAYER",
"action": "KILL",
"payload": {
"gameTime": 1801651,
"position": [
4470,
9485
],
"killerUrn": "live:lol:riot:player:95bf9fb4-acdf-4cad-b5d5-6d553bd7274f",
"killerTeamUrn": "live:lol:riot:team:93204998189940239",
"victimUrn": "live:lol:riot:player:4c34f7d6-37f3-4149-9583-3ad960e31fe7",
"victimTeamUrn": "live:lol:riot:team:300334140041433003",
"assistants": [
"live:lol:riot:player:6fd2e020-5bc9-4aba-0ae9-790b8619e745",
"live:lol:riot:player:a7d694ea-6f04-4507-96de-613a31523f97",
"live:lol:riot:player:183fa60f-a3ed-462f-b60d-745288310159"
]
},
"additionalProperties": {
"perId": "esports:match:83c7a58f-f055-5cbf-ce0d-15d872d4b81c",
"esportsLeagueId": "98163910901936189",
"live:lol:riot:team:93204998189940239": "esports:team:0a0d3943-fc89-586b-07bd-533feca4eb48",
"esportsGameID": "80390366466309308",
"gameNumber": "1",
"esportsLeagueSlug": "worlds",
"esportsLeagueName": "Worlds",
"taskId": "010f96b6-870d-5fde-cf39-9e6cd06b813c",
"live:lol:riot:team:300334140041433003": "esports:team:0f4ccd7d-5f82-5d45-cb4d-01f3800cdc6b",
"esportsMatchId": "80390366466309308"
}
},
"type": "LOL_RIOT_WEB_LIVESTATS",
"version": "0.3",
"properties": {}
},
"references": null,
"version": "2.0"
}
In the example above, the highlighted lines denote the Live Data Message payload. All other lines will have the same structure throughout all kinds of messages, but the Live Data Message payload structure will vary depending on the Type-Subject-Action triad.
The Live Data Message payload contains the precious data you want to process, but it is wrapped around with other structures, which we talked about above. These structures help you determine how you should process the Live Data Message payload, or should you do it at all.