from typing import List
from typing import Dict
from pathlib import Path
import json


def get_geoguessr_split_metadata(split: str) -> List[Dict]:
    """
    Grace's geoguessr dataset has train/val/test splits. This meethod returns the metadata for the
    specified split.
    """
    json_path = Path(f"/shared/g-luo/geoguessr/data/data/{split}.json").resolve()
    assert json_path.exists(), str(json_path)
    data = json.load(open(json_path, "r"))
    print(f"Length of metadata for split='{split}': ", len(data))
    for video in data:
        video["split"] = split
    return data