{
  "$id": "/insights/player_data",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Contains player-specific data over the whole game for the web app.",
  "properties": {
    "avatar_id": {
      "description": "The avatar ID for this player.",
      "type": "integer"
    },
    "court_coverage": {
      "$ref": "/insights/court_coverage",
      "description": "Categorizes stats about a players court coverage across all rallies.",
      "title": "Court Coverage"
    },
    "kitchen_arrival_percentage": {
      "additionalProperties": false,
      "description": "Counts of fair kitchen-arrival opportunities (denominator) and successful arrivals (numerator), broken down by serving/returning roles for the player and their partner.",
      "properties": {
        "returning": {
          "additionalProperties": false,
          "properties": {
            "oneself": {
              "additionalProperties": false,
              "properties": {
                "denominator": {
                  "$ref": "/types/count",
                  "description": "Number of rallies where the player had a fair opportunity to arrive within a few feet of the kitchen when on the returning team, as the returner (requires at least 3 non-fault shots).",
                  "title": "Count"
                },
                "numerator": {
                  "$ref": "/types/count",
                  "description": "Number of rallies where the player successfully arrived within a few feet of the kitchen when on the returning team, as the returner (requires at least 3 non-fault shots).",
                  "title": "Count"
                }
              },
              "required": [
                "numerator",
                "denominator"
              ],
              "type": "object"
            },
            "partner": {
              "additionalProperties": false,
              "properties": {
                "denominator": {
                  "$ref": "/types/count",
                  "description": "Number of rallies where the player had a fair opportunity to arrive within a few feet of the kitchen when on the returning team, as the partner of the returner (requires at least 3 non-fault shots).",
                  "title": "Count"
                },
                "numerator": {
                  "$ref": "/types/count",
                  "description": "Number of rallies where the player successfully arrived within a few feet of the kitchen when on the returning team, as the partner of the returner (requires at least 3 non-fault shots).",
                  "title": "Count"
                }
              },
              "required": [
                "numerator",
                "denominator"
              ],
              "type": "object"
            }
          },
          "required": [
            "oneself",
            "partner"
          ],
          "type": "object"
        },
        "serving": {
          "additionalProperties": false,
          "properties": {
            "oneself": {
              "additionalProperties": false,
              "properties": {
                "denominator": {
                  "$ref": "/types/count",
                  "description": "Number of rallies where the player had a fair opportunity to arrive within a few feet of the kitchen when on the serving team, as the server (requires at least 4 non-fault shots).",
                  "title": "Count"
                },
                "numerator": {
                  "$ref": "/types/count",
                  "description": "Number of rallies where the player successfully arrived within a few feet of the kitchen when on the serving team, as the server (requires at least 4 non-fault shots).",
                  "title": "Count"
                }
              },
              "required": [
                "numerator",
                "denominator"
              ],
              "type": "object"
            },
            "partner": {
              "additionalProperties": false,
              "properties": {
                "denominator": {
                  "$ref": "/types/count",
                  "description": "Number of rallies where the player had a fair opportunity to arrive within a few feet of the kitchen when on the serving team, as the partner of the server (requires at least 4 non-fault shots).",
                  "title": "Count"
                },
                "numerator": {
                  "$ref": "/types/count",
                  "description": "Number of rallies where the player successfully arrived within a few feet of the kitchen when on the serving team, as the partner of the server (requires at least 4 non-fault shots).",
                  "title": "Count"
                }
              },
              "required": [
                "numerator",
                "denominator"
              ],
              "type": "object"
            }
          },
          "required": [
            "oneself",
            "partner"
          ],
          "type": "object"
        }
      },
      "required": [
        "serving",
        "returning"
      ],
      "title": "Kitchen Arrival Opportunity Stats",
      "type": "object"
    },
    "left_side_percentage": {
      "$ref": "/types/percentage",
      "description": "The percentage of time when this player was to the left of their partner.",
      "title": "Percentage"
    },
    "md5_full": {
      "const": "cccfb78d5bbd9d28b269da043ac9e571",
      "description": "MD5 of the all aspects of this schema (including non-functional elements like documentation)"
    },
    "md5_functional": {
      "const": "fe13c6202aa7f45f43adf239197898fd",
      "description": "MD5 of the functional aspects of this schema"
    },
    "positional_performance": {
      "additionalProperties": false,
      "description": "Team-level positional performance metrics derived from the advantage-scale model. Omitted for singles or when too few supported rallies are available.",
      "properties": {
        "finishing_ability": {
          "description": "Team-level Close in [0, 1]: how efficiently the player's team converted positional advantage into ending the rally, independent of rally outcomes. Both teammates share the same value; team 1's value is the complement of team 0's.",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        "forward_pressure": {
          "description": "Team-level Push in [0, 1]: how actively the player's team drove each shot toward their positional advantage, independent of rally outcomes. Both teammates share the same value; team 1's value is the complement of team 0's.",
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        }
      },
      "type": "object"
    },
    "role_data": {
      "$ref": "/insights/role_data",
      "description": "data about this player in each serving and receiving role",
      "title": "Role Data"
    },
    "shot_count": {
      "$ref": "/types/count",
      "description": "The total number of shots by the player.",
      "title": "Count"
    },
    "team": {
      "description": "The team to which the player belongs.",
      "maximum": 1,
      "minimum": 0,
      "type": "integer"
    },
    "team_kitchen_arrival": {
      "additionalProperties": false,
      "description": "Counts of rallies where both teammates had a fair opportunity to arrive at the kitchen (denominator) and both successfully arrived (numerator), broken down by serving/returning roles. Both players on the same team share identical values.",
      "properties": {
        "returning": {
          "additionalProperties": false,
          "properties": {
            "denominator": {
              "$ref": "/types/count",
              "description": "Number of rallies where both teammates had a fair opportunity to arrive at the kitchen when on the returning team (requires at least 3 non-fault shots).",
              "title": "Count"
            },
            "numerator": {
              "$ref": "/types/count",
              "description": "Number of rallies where both teammates arrived at the kitchen when on the returning team (requires at least 3 non-fault shots and both players having a fair opportunity).",
              "title": "Count"
            }
          },
          "required": [
            "numerator",
            "denominator"
          ],
          "type": "object"
        },
        "serving": {
          "additionalProperties": false,
          "properties": {
            "denominator": {
              "$ref": "/types/count",
              "description": "Number of rallies where both teammates had a fair opportunity to arrive at the kitchen when on the serving team (requires at least 4 non-fault shots).",
              "title": "Count"
            },
            "numerator": {
              "$ref": "/types/count",
              "description": "Number of rallies where both teammates arrived at the kitchen when on the serving team (requires at least 4 non-fault shots and both players having a fair opportunity).",
              "title": "Count"
            }
          },
          "required": [
            "numerator",
            "denominator"
          ],
          "type": "object"
        }
      },
      "required": [
        "serving",
        "returning"
      ],
      "title": "Team Kitchen Arrival Stats",
      "type": "object"
    },
    "total_team_shot_percentage": {
      "$ref": "/types/percentage",
      "description": "The percentage of total team shots taken by the player.",
      "title": "Percentage"
    },
    "trends": {
      "additionalProperties": false,
      "description": "Summary of a player's stats from one game",
      "properties": {
        "flags": {
          "additionalProperties": false,
          "description": "Boolean information about the game",
          "properties": {
            "won_game": {
              "description": "Whether the player won the game",
              "type": "boolean"
            }
          },
          "required": [
            "won_game"
          ],
          "type": "object"
        },
        "kitchen_arrivals": {
          "additionalProperties": false,
          "properties": {
            "receiving_side": {
              "description": "Percent of rallies the player makes it to the kitchen when on the serving side",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "serving_side": {
              "description": "Percent of rallies the player makes it to the kitchen when on the receiving side",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            }
          },
          "required": [
            "receiving_side",
            "serving_side"
          ],
          "type": "object"
        },
        "num_rallies": {
          "description": "How many rallies were in the game",
          "maximum": 255,
          "minimum": 0,
          "type": "integer"
        },
        "num_rallies_won": {
          "description": "How many rallies were won",
          "maximum": 255,
          "minimum": 0,
          "type": "integer"
        },
        "ratings": {
          "additionalProperties": false,
          "description": "A rating of the player's skill in various categories based on this one game. Which categories are rated depends on the trend version (see RATING_CATEGORIES_BY_VERSION). These ratings can be converted to a DUPR-like scale using the formula `2 + 6 * percentage` (i.e., the percentage [0,1] maps to the range [2,8]). Data extraction writes only the version 2 categories.",
          "properties": {
            "ball_control": {
              "description": "How well the player controls the ball",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "court_iq": {
              "description": "Court awareness and decision-making",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "defense": {
              "description": "Ability to neutralize attacks",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "kitchen_game": {
              "description": "Ability in the non-volley zone (kitchen) game",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "offense": {
              "description": "Ability to apply pressure",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "overall": {
              "description": "overall ability",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "targeting": {
              "description": "How well the player places their shots",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            }
          },
          "required": [
            "overall",
            "kitchen_game",
            "ball_control",
            "defense",
            "offense",
            "court_iq",
            "targeting"
          ],
          "type": "object"
        },
        "return_depth": {
          "additionalProperties": false,
          "description": "Proportions of various depths",
          "properties": {
            "deep": {
              "description": "Percent of deep serves",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "medium": {
              "description": "Percent of medium serves",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "net": {
              "description": "Percent of too net serves (fault)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "out": {
              "description": "Percent of too long, short or wide serves (fault)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "shallow": {
              "description": "Percent of shallow (but in) serves",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            }
          },
          "required": [
            "out",
            "net",
            "shallow",
            "medium",
            "deep"
          ],
          "type": "object"
        },
        "serve_depth": {
          "additionalProperties": false,
          "description": "Proportions of various depths",
          "properties": {
            "deep": {
              "description": "Percent of deep serves",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "medium": {
              "description": "Percent of medium serves",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "net": {
              "description": "Percent of too net serves (fault)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "out": {
              "description": "Percent of too long, short or wide serves (fault)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "shallow": {
              "description": "Percent of shallow (but in) serves",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            }
          },
          "required": [
            "out",
            "net",
            "shallow",
            "medium",
            "deep"
          ],
          "type": "object"
        },
        "serve_speed": {
          "description": "17 buckets for % of serves at speeds of <17.5mph (bucket index 0), [17.5-20.0), .., [52.5-55), >=55mph (bucket index 16)",
          "items": {
            "description": "a percentage expressed as a number between 0 and 1",
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          },
          "maxItems": 17,
          "minItems": 17,
          "type": "array"
        },
        "shot_accuracy": {
          "additionalProperties": false,
          "properties": {
            "in": {
              "description": "Percent of shots that went in",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "net": {
              "description": "Percent of shots that were stopped by the net (fault)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "out": {
              "description": "Percent of shots that were out (fault)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            }
          },
          "required": [
            "in",
            "net",
            "out"
          ],
          "type": "object"
        },
        "shot_quality": {
          "additionalProperties": false,
          "properties": {
            "average": {
              "description": "Percent of shots that were quality 0.4 (inclusive) to 0.6 (exclusive)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "excellent": {
              "description": "Percent of shots that were quality 0.8 or higher",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "fair": {
              "description": "Percent of shots that were quality 0.2 (inclusive) to 0.4 (exclusive)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "good": {
              "description": "Percent of shots that were quality 0.6 (inclusive) to 0.8 (exclusive)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "poor": {
              "description": "Percent of shots that were quality less than 0.2",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            }
          },
          "required": [
            "excellent",
            "good",
            "average",
            "fair",
            "poor"
          ],
          "type": "object"
        },
        "shot_selection": {
          "additionalProperties": false,
          "description": "serves and returns are excluded, as are any shots which don't fall in any of the categories here",
          "properties": {
            "dink": {
              "description": "Percent of shots that were dinks",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "drive": {
              "description": "Percent of shots that were drives",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "drop": {
              "description": "Percent of shots that were drops",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "reset": {
              "description": "Percent of shots that were resets",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            }
          },
          "required": [
            "drive",
            "dink",
            "reset",
            "drop"
          ],
          "type": "object"
        }
      },
      "required": [
        "serve_depth",
        "return_depth",
        "serve_speed",
        "kitchen_arrivals",
        "shot_quality",
        "shot_selection",
        "shot_accuracy",
        "flags",
        "num_rallies",
        "num_rallies_won",
        "ratings"
      ],
      "type": "object"
    },
    "trends_missing_reasons": {
      "description": "Reasons explaining why trends data is missing for this player. Present only when `trends` is omitted.",
      "items": {
        "type": "string"
      },
      "type": "array"
    }
  },
  "required": [
    "avatar_id",
    "team",
    "shot_count",
    "total_team_shot_percentage",
    "left_side_percentage",
    "role_data",
    "kitchen_arrival_percentage",
    "team_kitchen_arrival",
    "court_coverage"
  ],
  "title": "Player Data",
  "type": "object"
}