{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a4a4a60f",
   "metadata": {},
   "source": [
    "# Hawkeye\n",
    "\n",
    "- [Load local files](#load-local-files)\n",
    "- [Load remote files](#load-remote-files)\n",
    "\n",
    "The Hawkeye implementation currently only supports 2-dimensional data. \n",
    "\n",
    "Hawkeye uses a slightly different file structure than most other tracking data providers. Hawkeye provides a single file of ball coordinates (`ball_feeds`) and player coordinates `player_centroid_feeds` per minute of match time. \n",
    "\n",
    "Hawkeye files are delivered in the following structure:\n",
    "\n",
    "- `scrubbed.samples.ball/*_*_*_1_14.football.samples.ball`\n",
    "- `scrubbed.samples.centroids/*_*_*_1_14.football.samples.centroids`\n",
    "\n",
    "The `\"*_*_*\"` indicates a date, time and game unique identifier, \"1\" here refers to the first period and \"14\" refers to the 14th minute of play. \n",
    "\n",
    "⚠️ **To correctly load and order these files it is recommended to _not_ alter the file names and extensions.**\n",
    "\n",
    "----\n",
    "\n",
    "## Load local files\n",
    "\n",
    "Hawkeye supports local files in the form of:\n",
    "- Individual file paths: (e.g `ball_feeds=scrubbed.samples.ball/*_*_*_1_14.football.samples.ball`)\n",
    "- A list of file paths: (e.g. `ball_feeds=[scrubbed.samples.ball/*_*_*_1_14.football.samples.ball, scrubbed.samples.ball/*_*_*_1_15.football.samples.ball]`)\n",
    "- A folder (e.g `ball_feeds=scrubbed.samples.ball/`)\n",
    "\n",
    "Note: Kloppy will throw an error when it cannot find player and ball feeds for the same period and minute in the provided file paths / folders"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "efbb67de",
   "metadata": {},
   "outputs": [],
   "source": [
    "from kloppy import hawkeye\n",
    "\n",
    "dataset = hawkeye.load(\n",
    "    ball_feeds=\"data/scrubbed.samples.ball/\",\n",
    "    player_centroid_feeds=\"data/scrubbed.samples.centroids/\",\n",
    "    meta_data = None,\n",
    "    pitch_width = 68.0,\n",
    "    pitch_length = 105.0,\n",
    "    sample_rate = None,\n",
    "    limit = 10,\n",
    "    coordinates = None,\n",
    "    show_progress = False,\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0d992f75",
   "metadata": {},
   "source": [
    "## Load remote files\n",
    "\n",
    "Kloppy supports remote files through `fsspec` FileSystem under the hood. This allows you to work with files in AWS S3, Google Cloud, Azure Blob, HDFS, FTP, and SFTP without extra tools.\n",
    "For example you can pass:\n",
    "- Individual s3 file paths: (e.g `ball_feeds=s3://.../hawkeye/scrubbed.samples.ball/*_*_*_1_14.football.samples.ball`)\n",
    "- A list of s3 file paths: (e.g. `ball_feeds=[s3://.../hawkeye/scrubbed.samples.ball/*_*_*_1_14.football.samples.ball, s3://.../hawkeye/scrubbed.samples.ball/*_*_*_1_15.football.samples.ball]`)\n",
    "- A bucket / folder (e.g `ball_feeds=s3://.../hawkeye/scrubbed.samples.ball/`)\n",
    "\n",
    "Note: Kloppy might throw an the first time to help you identify missing cloud specific dependencies like `s3fs`. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fc39a7e7",
   "metadata": {},
   "outputs": [],
   "source": [
    "from kloppy import hawkeye\n",
    "\n",
    "dataset = hawkeye.load(\n",
    "    ball_feeds=\"s3://.../hawkeye/scrubbed.samples.ball/\",\n",
    "    player_centroid_feeds=\"s3://.../hawkeye/scrubbed.samples.centroids/\",\n",
    "    meta_data = None,\n",
    "    pitch_width = 68.0,\n",
    "    pitch_length = 105.0,\n",
    "    sample_rate = None,\n",
    "    limit = 10,\n",
    "    coordinates = None,\n",
    "    show_progress = False,\n",
    ")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}