# statistics

For: READ

The `statistics` message type contains information about the current statistics. These messages can relate to team or player stats for different periods (or the whole match - periodId=0).

This message is sent whenever an action occurs that causes the statistics to change. The statistics for individual periods will only be sent if the statistics for that period have changed. This means that an event in period 4 will not result in the period 1 statistics being sent.

```
{
    "type": "statistics",
    "fixtureId": "b25692de-ac17-11e8-98d0-529269fb1459",
    "timestamp": "2021-02-03T00:19:40.354050",
    "periodId": 4,
    "compressedData": "eJzt3UtzG8cRB/CvktKZTM17ZvcYn3JA2VXRzeUDCCxMxhSWxYdcrpS/ewai5TDYFXoW3cAO6H9VDpEMURS4P8xMTz9+/M+H1f3y6elD+7cPTw/94/OHq7996D532+d/rne/Z2JjmuZmfR03S3+tdbe8TtY310oZ49ZhaWzn//wjH+8+dV/+kNL5FeHa2I/Ktqppdfrfa357+PKap5ebp+e755fnu367+4/511//U//y+l1s83//7fXbUMsmqpvV8nqz2ujdt5GuU3djrjcmKb3RN81mrXd/5qF7fOq3f3zr3SYm15B/5jl/10/Py08Pr9+6UdfKXevwUfnW2Varv+f3QCn7x5e/69dfvrzLv1zd96tfdn/qh49aLdS ... "
}
```

**Bold** fields are required

| Field              | Type    | Description                                                                                                                            |
| ------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **periodId**       | integer | The unique identifier of the period. Overtime periods start at 11. 1 = 1 OT1 = 11 A periodId = 0 represents the total for the fixture. |
| **compressedData** | string  | The `compressedData` key is a base64 encoded zlib compressed JSON string.                                                              |

When uncompressed the data is of the following format.

```
        {
            "0a970bca-fcf1-11e8-8eb2-f2801f1b9fd1": {
                "entity": {
                    "minutes": 50.333333,
                    ... statistics ...
                },
                "persons": {
                    "2ef78c06-fcf1-11e8-8eb2-f2801f1b9fd1": {
                        "points": 2,
                        ... statistics ...
                    },
                    "2ef78d32-fcf1-11e8-8eb2-f2801f1b9fd1": {
                        "points": 2
                        ... statistics ...
                    },
                    ... more persons ...
                }
            },
            "0a970e5e-fcf1-11e8-8eb2-f2801f1b9fd1": {
                "entity": {
                    "points": 32,
                        ... statistics ...
                },
                "persons": {
                    "83f476c4-fcf1-11e8-8eb2-f2801f1b9fd1": {
                        "minutes": 5.116667,
                        ... statistics ...
                    },
                    "83f45ffe-fcf1-11e8-8eb2-f2801f1b9fd1": {
                        "minutes": 9.433333,
                        ... statistics ...
                    },
                    ... more persons ...
                }
            }
        }
    
```

**Bold** fields are required

| Field           | Type   | Description                                                                                             |
| --------------- | ------ | ------------------------------------------------------------------------------------------------------- |
| **X.entity**    | object | An object containing the statistics for the entity.                                                     |
| **X.entity.Z**  | object | Where Z is a statistic name, given in the sport configuration                                           |
| **X.persons**   | object | An object containing the unique identifiers of all the persons involved with the entity in the fixture. |
| **X.persons.Y** | object | An object containing the statistics for the person Y in the entity X.                                   |

If a field has no value then the key/value will not be sent as part of the message.
