# Path: socceraction/data/base.py
# class MissingDataError(Exception):
#     """Exception raised when a field is missing in the input data."""
# 
# Path: socceraction/data/opta/parsers/base.py
# class OptaParser(ABC):
#     """Extract data from an Opta data stream.
# 
#     Parameters
#     ----------
#     path : str
#         Path of the data file.
#     """
# 
#     def __init__(self, path: str, **kwargs: Any) -> None:
#         raise NotImplementedError
# 
#     def extract_competitions(self) -> Dict[Tuple[Any, Any], Dict[str, Any]]:
#         """Return a dictionary with all available competitions.
# 
#         Returns
#         -------
#         dict
#             A mapping between (competion ID, season ID) tuples and the
#             information available about each competition in the data stream.
#         """
#         return {}
# 
#     def extract_games(self) -> Dict[Any, Dict[str, Any]]:
#         """Return a dictionary with all available games.
# 
#         Returns
#         -------
#         dict
#             A mapping between game IDs and the information available about
#             each game in the data stream.
#         """
#         return {}
# 
#     def extract_teams(self) -> Dict[Any, Dict[str, Any]]:
#         """Return a dictionary with all available teams.
# 
#         Returns
#         -------
#         dict
#             A mapping between team IDs and the information available about
#             each team in the data stream.
#         """
#         return {}
# 
#     def extract_players(self) -> Dict[Tuple[Any, Any], Dict[str, Any]]:
#         """Return a dictionary with all available players.
# 
#         Returns
#         -------
#         dict
#             A mapping between (game ID, player ID) tuples and the information
#             available about each player in the data stream.
#         """
#         return {}
# 
#     def extract_lineups(self) -> Dict[Any, Dict[str, Any]]:
#         """Return a dictionary with the lineup of each team.
# 
#         Returns
#         -------
#         dict
#             A mapping between team IDs and the information available about
#             each team's lineup in the data stream.
#         """
#         return {}
# 
#     def extract_events(self) -> Dict[Tuple[Any, Any], Dict[str, Any]]:
#         """Return a dictionary with all available events.
# 
#         Returns
#         -------
#         dict
#             A mapping between (game ID, event ID) tuples and the information
#             available about each event in the data stream.
#         """
#         return {}
# 
# def _get_end_x(qualifiers: Dict[int, Any]) -> Optional[float]:
#     try:
#         # pass
#         if 140 in qualifiers:
#             return float(qualifiers[140])
#         # blocked shot
#         if 146 in qualifiers:
#             return float(qualifiers[146])
#         # passed the goal line
#         if 102 in qualifiers:
#             return float(100)
#         return None
#     except ValueError:
#         return None
# 
# def _get_end_y(qualifiers: Dict[int, Any]) -> Optional[float]:
#     try:
#         # pass
#         if 141 in qualifiers:
#             return float(qualifiers[141])
#         # blocked shot
#         if 147 in qualifiers:
#             return float(qualifiers[147])
#         # passed the goal line
#         if 102 in qualifiers:
#             return float(qualifiers[102])
#         return None
#     except ValueError:
#         return None
# 
# def assertget(dictionary: Dict[str, Any], key: str) -> Any:
#     """Return the value of the item with the specified key.
# 
#     In contrast to the default `get` method, this version will raise an
#     assertion error if the given key is not present in the dict.
# 
#     Parameters
#     ----------
#     dictionary : dict
#         A Python dictionary.
#     key : str
#         A key in the dictionary.
# 
#     Returns
#     -------
#     Any
#         Returns the value for the specified key if the key is in the dictionary.
# 
#     Raises
#     ------
#     AssertionError
#         If the given key could not be found in the dictionary.
#     """
#     value = dictionary.get(key)
#     assert value is not None, 'KeyError: ' + key + ' not found in ' + str(dictionary)
#     return value


import json  # type: ignore
import re
from datetime import datetime, timedelta
from typing import Any, Dict, Optional, Tuple
from ...base import MissingDataError
from .base import OptaParser, _get_end_x, _get_end_y, assertget
        game_id: Optional[int] = None,
    ) -> None:
        with open(path, "rt", encoding="utf-8") as fh:
            self.root = json.load(fh)

        if competition_id is None:
            try:
                competition_id = int(assertget(self.root, "competition_id"))
            except AssertionError as e:
                raise MissingDataError(
                    """Could not determine the competition id. Add it to the
                    file path or include a field 'competition_id' in the
                    JSON."""
                ) from e
        self.competition_id = competition_id

        if season_id is None:
            try:
                season_id = int(assertget(self.root, "season_id"))
            except AssertionError as e:
                raise MissingDataError(
                    """Could not determine the season id. Add it to the file
                    path or include a field 'season_id' in the JSON."""
                ) from e
        self.season_id = season_id

        if game_id is None:
            try:
                game_id = int(assertget(self.root, "game_id"))
            except AssertionError as e:

# Path: socceraction/data/base.py
# class MissingDataError(Exception):
#     """Exception raised when a field is missing in the input data."""
# 
# Path: socceraction/data/opta/parsers/base.py
# class OptaParser(ABC):
#     """Extract data from an Opta data stream.
# 
#     Parameters
#     ----------
#     path : str
#         Path of the data file.
#     """
# 
#     def __init__(self, path: str, **kwargs: Any) -> None:
#         raise NotImplementedError
# 
#     def extract_competitions(self) -> Dict[Tuple[Any, Any], Dict[str, Any]]:
#         """Return a dictionary with all available competitions.
# 
#         Returns
#         -------
#         dict
#             A mapping between (competion ID, season ID) tuples and the
#             information available about each competition in the data stream.
#         """
#         return {}
# 
#     def extract_games(self) -> Dict[Any, Dict[str, Any]]:
#         """Return a dictionary with all available games.
# 
#         Returns
#         -------
#         dict
#             A mapping between game IDs and the information available about
#             each game in the data stream.
#         """
#         return {}
# 
#     def extract_teams(self) -> Dict[Any, Dict[str, Any]]:
#         """Return a dictionary with all available teams.
# 
#         Returns
#         -------
#         dict
#             A mapping between team IDs and the information available about
#             each team in the data stream.
#         """
#         return {}
# 
#     def extract_players(self) -> Dict[Tuple[Any, Any], Dict[str, Any]]:
#         """Return a dictionary with all available players.
# 
#         Returns
#         -------
#         dict
#             A mapping between (game ID, player ID) tuples and the information
#             available about each player in the data stream.
#         """
#         return {}
# 
#     def extract_lineups(self) -> Dict[Any, Dict[str, Any]]:
#         """Return a dictionary with the lineup of each team.
# 
#         Returns
#         -------
#         dict
#             A mapping between team IDs and the information available about
#             each team's lineup in the data stream.
#         """
#         return {}
# 
#     def extract_events(self) -> Dict[Tuple[Any, Any], Dict[str, Any]]:
#         """Return a dictionary with all available events.
# 
#         Returns
#         -------
#         dict
#             A mapping between (game ID, event ID) tuples and the information
#             available about each event in the data stream.
#         """
#         return {}
# 
# def _get_end_x(qualifiers: Dict[int, Any]) -> Optional[float]:
#     try:
#         # pass
#         if 140 in qualifiers:
#             return float(qualifiers[140])
#         # blocked shot
#         if 146 in qualifiers:
#             return float(qualifiers[146])
#         # passed the goal line
#         if 102 in qualifiers:
#             return float(100)
#         return None
#     except ValueError:
#         return None
# 
# def _get_end_y(qualifiers: Dict[int, Any]) -> Optional[float]:
#     try:
#         # pass
#         if 141 in qualifiers:
#             return float(qualifiers[141])
#         # blocked shot
#         if 147 in qualifiers:
#             return float(qualifiers[147])
#         # passed the goal line
#         if 102 in qualifiers:
#             return float(qualifiers[102])
#         return None
#     except ValueError:
#         return None
# 
# def assertget(dictionary: Dict[str, Any], key: str) -> Any:
#     """Return the value of the item with the specified key.
# 
#     In contrast to the default `get` method, this version will raise an
#     assertion error if the given key is not present in the dict.
# 
#     Parameters
#     ----------
#     dictionary : dict
#         A Python dictionary.
#     key : str
#         A key in the dictionary.
# 
#     Returns
#     -------
#     Any
#         Returns the value for the specified key if the key is in the dictionary.
# 
#     Raises
#     ------
#     AssertionError
#         If the given key could not be found in the dictionary.
#     """
#     value = dictionary.get(key)
#     assert value is not None, 'KeyError: ' + key + ' not found in ' + str(dictionary)
#     return value


# Path: socceraction/data/opta/parsers/whoscored.py
import json  # type: ignore
import re
from datetime import datetime, timedelta
from typing import Any, Dict, Optional, Tuple
from ...base import MissingDataError
from .base import OptaParser, _get_end_x, _get_end_y, assertget

        game_id: Optional[int] = None,
    ) -> None:
        with open(path, "rt", encoding="utf-8") as fh:
            self.root = json.load(fh)

        if competition_id is None:
            try:
                competition_id = int(assertget(self.root, "competition_id"))
            except AssertionError as e:
                raise MissingDataError(
                    """Could not determine the competition id. Add it to the
                    file path or include a field 'competition_id' in the
                    JSON."""
                ) from e
        self.competition_id = competition_id

        if season_id is None:
            try:
                season_id = int(assertget(self.root, "season_id"))
            except AssertionError as e:
                raise MissingDataError(
                    """Could not determine the season id. Add it to the file
                    path or include a field 'season_id' in the JSON."""
                ) from e
        self.season_id = season_id

        if game_id is None:
            try:
                game_id = int(assertget(self.root, "game_id"))
            except AssertionError as e:

                raise MissingDataError(