{
  "$id": "/insights/shot",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "advantage_scale": {
      "description": "Positional advantage score in [0, 1] per player. The source depends on the game type:  - Doubles: derived from a state-value model that estimates rally win probability given four-player positions. Both teammates share the same score, opponent scores are the complement (1 - teammate score). At 0, p(win) is around 0.3, at 1 - around 0.7, well-calibrated but a function of positions only. Omitted when positions are outside the model's supported domain. - Singles: legacy y-axis depth heuristic preserved for ratings compatibility. The two unused player slots are null. The server's value is hardcoded to 0 on the serve.",
      "items": {
        "anyOf": [
          {
            "type": "null"
          },
          {
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          }
        ]
      },
      "maxItems": 4,
      "minItems": 4,
      "type": "array"
    },
    "end_ms": {
      "description": "The time in milliseconds since the start of the video when the shot ended.",
      "type": "integer"
    },
    "errors": {
      "additionalProperties": false,
      "description": "Grouping for detected errors resulting from this shot. Omitted if there are no discernible errors.",
      "properties": {
        "faults": {
          "additionalProperties": false,
          "description": "A fault is a type of error that violates the rules of the game, thus ending the rally. This includes both actual and potential faults (that were saved by the opponent, or somehow overlooked and didn't end the rally). Omitted if none were detected. If this field is present but `is_final` is false, it means play continued despite the fault (i.e., either players overlooked a fault or the AI detected a potential fault that was not called).",
          "properties": {
            "net": {
              "description": "Present and `true` if the ball was stopped by the net. Omitted if the ball cleared the net (even if it touched).",
              "type": "boolean"
            },
            "out": {
              "additionalProperties": false,
              "description": "Information about the ball potentially or actually going out.",
              "properties": {
                "direction": {
                  "description": "The direction the ball was (potentially or actually) going out.",
                  "enum": [
                    "left",
                    "right",
                    "long"
                  ]
                },
                "outcome": {
                  "description": "Whether the shot actually landed out, or was intercepted (erroneously) by an opponent.",
                  "enum": [
                    "landed",
                    "intercepted"
                  ]
                },
                "side": {
                  "description": "The side of the court the ball was (potentially or actually) going out if the direction is lateral (left or right). Omitted if not going out laterally.",
                  "enum": [
                    "near",
                    "far"
                  ]
                }
              },
              "required": [
                "outcome",
                "direction"
              ],
              "type": "object"
            },
            "short": {
              "description": "Present and `true` if the ball is hit by the player to land on the same court side, before the net, but not out. Omitted otherwise.",
              "type": "boolean"
            }
          },
          "type": "object"
        },
        "popup": {
          "description": "Set if we detect a definite or potential popup, which is currently\ndefined as: either the shot popping up more than 3.5 feet from the strike point,\nor crossing the net at 2.2 feet above while popping up at least 2.6 feet from\nthe strike point.\n\n`exploited` if it was exploited by the opponent team. `potential` if it was a popup that was not exploited. (Determined by whether it was volleyed)",
          "enum": [
            "exploited",
            "potential"
          ]
        },
        "unforced": {
          "description": "A fault is counted as unforced if:  - The player misses a serve.  - The player misses a return or a third shot, unless the opponent’s previous shot was clearly very high-quality.  - Later in the rally, the player faults against a dink or drop that produced an easy ball:  - If the player volleys that dink/drop, it is unforced.  - If the player lets it bounce, it is unforced only if the ball was inside the player’s easy reach zone (“bubble”).  A fault is not unforced if:  - The opponent hit a strong putaway.  - On a volley, the previous shot was not a dink or drop.  - For non-volleys, the ball was outside the player’s easy reach zone.",
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "is_final": {
      "description": "Whether this is the final shot in the rally.",
      "type": "boolean"
    },
    "is_passing": {
      "description": "Whether this shot passed the *nearest* opponent without them touching it. Omitted if unknown.",
      "type": "boolean"
    },
    "is_poach": {
      "description": "Whether this ball was hit closer to the non-hitter's position than the hitter's position along the width of the court, and in front of the non-hitter.\n\nThe players' positions are measured at the time the previous shot was hit,\nand the ball's position is determined at the time the ball was hit by the receiving team.\n\nA poach is only possible if the ball is hit in front of the player the ball was poached from (their teammate).\n\nIf the ball goes past the non-hitter and their partner hits it, it is not considered a poach,\nregardless of the x-axis differential between the players and the ball.\n\nOmitted if unknown.",
      "type": "boolean"
    },
    "is_putaway": {
      "description": "Whether this shot functioned as a putaway or rally finisher: a clean winner, or a strong/decisive attacking shot that directly creates the end of the rally. This can include a well-placed dink or drop winner, not only a hard-hit shot.",
      "type": "boolean"
    },
    "is_reset": {
      "description": "Whether this shot takes significant pace off the ball. Omitted if unknown or not applicable.",
      "type": "boolean"
    },
    "is_speedup": {
      "description": "To be considered a speedup, the following conditions must be met:\n\n- the shot adds significant pace on the ball\n- the hitting player is near the kitchen\n- at least one of the opposing players is near the kitchen\n\nOmitted if unknown or not applicable.",
      "type": "boolean"
    },
    "is_volley": {
      "description": "Whether this shot was a volley hit out of the air or not. Omitted if unknown.",
      "type": "boolean"
    },
    "md5_full": {
      "const": "f6a4f317e66ea9cd7e25b22ad8508b71",
      "description": "MD5 of the all aspects of this schema (including non-functional elements like documentation)"
    },
    "md5_functional": {
      "const": "55cebe8ad8dc2b82931ba746fda778e0",
      "description": "MD5 of the functional aspects of this schema"
    },
    "partner_positioning_score": {
      "$ref": "/types/quality_score",
      "description": "Positioning quality score for the partner at this shot [0, 1], higher is better. Derived from the Stage 2 causal-frontier positioning model that estimates how well the partner is positioned relative to a strong-team baseline given the game context. Omitted for singles games, serves, returns, or when positions are outside the model's supported domain.",
      "title": "Quality Score"
    },
    "player_id": {
      "$ref": "/types/player_id",
      "description": "The ID of the player who hit the ball.",
      "title": "Player ID"
    },
    "player_positions": {
      "description": "Player positions for all players at the time of the shot. Array of 4 elements, one for each player . Second player of each team is null for a singles game",
      "items": {
        "anyOf": [
          {
            "type": "null"
          },
          {
            "additionalProperties": false,
            "properties": {
              "x": {
                "description": "The x coordinate of the player position.",
                "type": "number"
              },
              "y": {
                "description": "The y coordinate of the player position.",
                "type": "number"
              }
            },
            "required": [
              "x",
              "y"
            ],
            "type": "object"
          }
        ]
      },
      "maxItems": 4,
      "minItems": 4,
      "type": "array"
    },
    "quality": {
      "additionalProperties": false,
      "description": "an evaluation of the quality of the shot",
      "properties": {
        "execution": {
          "$ref": "/types/quality_score",
          "description": "how well the shot was executed",
          "title": "Quality Score"
        },
        "overall": {
          "$ref": "/types/quality_score",
          "description": "the overall quality of the shot (currently derived from the execution quality)",
          "title": "Quality Score"
        },
        "pressure": {
          "$ref": "/types/quality_score",
          "description": "positional pressure faced and imposed by this shot [0, 1], higher means more pressure demand. Omitted for singles, serves, returns, or when positioning data is unavailable.",
          "title": "Quality Score"
        }
      },
      "type": "object"
    },
    "resulting_ball_movement": {
      "additionalProperties": false,
      "description": "Stats related to how the ball moves as a result of being hit. Omitted if we couldn't track the ball after the shot was made.",
      "properties": {
        "angles": {
          "additionalProperties": false,
          "properties": {
            "direction": {
              "description": "Direction that the ball was hit from and to.",
              "enum": [
                "MidCrossLeft",
                "MidCrossRight",
                "DownTheMiddle",
                "LeftToMiddle",
                "LeftCrossRight",
                "DownTheLineLeft",
                "RightToMiddle",
                "RightCrossLeft",
                "DownTheLineRight"
              ],
              "type": "string"
            },
            "pitch": {
              "description": "The pitch angle, in degrees within a range of [-90, 90].\n\n- 0 degrees: straight shot (parallel to the ground)\n- 90 degrees: shot directly upwards (perpendicular to the ground)\n- -90 degrees: shot directly downwards (perpendicular to the ground)",
              "maximum": 90,
              "minimum": -90,
              "title": "Pitch Angle",
              "type": "number"
            },
            "yaw": {
              "description": "The yaw angle, in degrees within a range of (-180, 180].\n\n- 0 degrees: shot towards the left sideline (parallel to player's own baseline)\n- 90 degrees: shot towards the net directly (perpendicular to player's own baseline)\n- 180 degrees: shot towards the right sideline (parallel to player's own baseline)\n- Negative values are the same, but in the opposite direction (backwards).",
              "maximum": 180,
              "minimum": -180,
              "title": "Yaw Angle",
              "type": "number"
            }
          },
          "required": [
            "yaw",
            "pitch",
            "direction"
          ],
          "type": "object"
        },
        "crossed_net": {
          "description": "`true` if the ball crosses the net plane, else `false`. Note that this value will be `true` for ATPs (they cross the net plane without the ball necessarily ever going higher than the net).",
          "type": "boolean"
        },
        "distance": {
          "description": "The distance the ball traveled (feet) before coming in contact with the net, court, paddle, etc.",
          "type": "number"
        },
        "distance_from_baseline": {
          "description": "The distance the ball landed from the opponent's baseline.",
          "type": "number"
        },
        "height_over_net": {
          "description": "The height the ball in feet when it _reaches_ the plane of the net. This is\nomitted if the ball never reaches the net plane. A ball that reaches the net but\ndoes not go over will have this value set to the height of the ball when it\nreaches the net (usually this will be greater than 0 but lower than the net\nheight). Similarly, a ball that grazes the net cord and topples over will have\nits height over the net as roughly the height of the net at that location.\n\nNote that the plane of the net exists at `y = 22`.",
          "type": "number"
        },
        "is_volleyed": {
          "description": "Whether the ball was hit out of the air or not.",
          "type": "boolean"
        },
        "speed": {
          "description": "Speed of the ball in MPH.",
          "type": "number"
        },
        "trajectory": {
          "additionalProperties": false,
          "description": "Describes the estimated flight path of a ball after it was hit by the player.\n\nThe ball essentially flies in a 2D projectile motion along a 2D plane. One dimension\nof this plane is aligned with the Z-axis. An estimation of its path through 3D space\ncan be reconstructed from its initial flight characteristics and start and end\npoints.",
          "properties": {
            "confidence": {
              "$ref": "/types/confidence",
              "description": "Our confidence in this trajectory (based on our confidence in the start and end positions of the ball).",
              "title": "Prediction Confidence"
            },
            "end": {
              "additionalProperties": false,
              "description": "the end of the ball's flight which happens when it bounces, hits the net, is hit by a paddle, or flies out of the video frame",
              "properties": {
                "location": {
                  "$ref": "/types/world_position/3d",
                  "description": "Location of the ball when it ended its flight.",
                  "title": "World XYZ"
                },
                "ms": {
                  "$ref": "/types/video_time",
                  "description": "Number of milliseconds into the video when the ball ended its flight.",
                  "title": "Video Milliseconds"
                },
                "zone": {
                  "$ref": "/events/zone",
                  "description": "Zone where the ball ended its flight.",
                  "title": "Zone"
                }
              },
              "required": [
                "zone",
                "location",
                "ms"
              ],
              "type": "object"
            },
            "peak": {
              "$ref": "/types/world_position/3d",
              "description": "Location where the ball reached its highest (z) point.",
              "title": "World XYZ"
            },
            "start": {
              "additionalProperties": false,
              "description": "the moment the ball starts flying after being hit",
              "properties": {
                "location": {
                  "$ref": "/types/world_position/3d",
                  "description": "Location where the ball was hit.",
                  "title": "World XYZ"
                },
                "ms": {
                  "$ref": "/types/video_time",
                  "description": "Number of milliseconds into the video when the ball was hit.",
                  "title": "Video Milliseconds"
                },
                "zone": {
                  "description": "Court zone that the ball was hit from",
                  "enum": [
                    "deep",
                    "mid",
                    "short",
                    "kitchen"
                  ],
                  "title": "Court Zone",
                  "type": "string"
                }
              },
              "required": [
                "zone",
                "location",
                "ms"
              ],
              "type": "object"
            }
          },
          "required": [
            "confidence",
            "start",
            "peak",
            "end"
          ],
          "title": "Ball Flight Trajectory",
          "type": "object"
        }
      },
      "required": [
        "angles",
        "crossed_net",
        "is_volleyed",
        "distance",
        "speed",
        "trajectory"
      ],
      "title": "Resulting Ball Movement",
      "type": "object"
    },
    "shooter_movement_from_last_shot": {
      "$ref": "/types/vector",
      "description": "Movement vector in feet that the shooter moved from their position during the previous shot, tracking x and y directions separately. Omitted for the first shot of the rally.",
      "title": "Vector"
    },
    "shooter_positioning_score": {
      "$ref": "/types/quality_score",
      "description": "Positioning quality score for the shooter at this shot [0, 1], higher is better. Derived from the Stage 2 causal-frontier positioning model that estimates how well the shooter is positioned relative to a strong-team baseline given the game context. Omitted for singles games, serves, returns, or when positions are outside the model's supported domain.",
      "title": "Quality Score"
    },
    "shot_type": {
      "description": "- smash: an overhead or similar shot where the ball goes from high to low (no upward motion)\n- lob: a shot with a relatively high peak\n- dink: a shot that would land in or near the kitchen and which was hit from near the kitchen\n- drop: a shot that would land in or near the kitchen and was hit from the transition zone or deeper\n- drive: a shot that would land deep if not stopped by an opponent's paddle, opponent's body, or the net (and doesn't fall into an earlier categorization)\n- atp: an around-the-post shot, where the ball is hit outside the sideline and around the net post instead of over the net\n- erne: a shot hit from outside the sideline by the kitchen (based on when the player's feet first touch after a volley)\n\nOmitted if we can't confidently determine a shot type based on the ball's trajectory and other characteristics.",
      "enum": [
        "smash",
        "lob",
        "dink",
        "drop",
        "drive",
        "atp",
        "erne"
      ],
      "type": "string"
    },
    "start_ms": {
      "description": "The time in milliseconds since the start of the video when the shot started.",
      "type": "integer"
    },
    "stroke_side": {
      "description": "The side of the body the stroke was made on. Omitted if unknown.",
      "enum": [
        "left",
        "right"
      ],
      "type": "string"
    },
    "stroke_type": {
      "description": "The type of stroke used to hit the ball. Omitted if unknown.",
      "enum": [
        "forehand",
        "backhand"
      ],
      "type": "string"
    },
    "tags": {
      "additionalProperties": false,
      "description": "Tags for shot features with nested paths using colon separators (e.g., \"type:dink\", \"type:dink:push\"). Each tag has optional confidence and quality scores.",
      "patternProperties": {
        "^.*$": {
          "additionalProperties": false,
          "properties": {
            "conf": {
              "description": "Our confidence score for the tag",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            },
            "quality": {
              "description": "Quality evaluation (how good this aspect of the shot is)",
              "maximum": 1,
              "minimum": 0,
              "type": "number"
            }
          },
          "type": "object"
        }
      },
      "type": "object"
    },
    "vertical_type": {
      "description": "Whether the shot was hit as a dig, overhead, or neutral. Omitted if unknown.",
      "enum": [
        "dig",
        "overhead",
        "neutral"
      ],
      "type": "string"
    },
    "winner_type": {
      "description": "Whether the shot is a clean winner or forced an opponent fault. Omitted if this shot is not a winning shot.",
      "enum": [
        "clean",
        "forced_fault"
      ],
      "type": "string"
    }
  },
  "required": [
    "player_id",
    "quality",
    "start_ms",
    "end_ms",
    "is_final",
    "tags"
  ],
  "title": "Shot",
  "type": "object"
}