from typing import List
from typing import Union


def processFile(file: str) -> List[Union[str, int, List[float], int]]:
    """Open, read and process data from file.

    Parameters
    ----------
    file : str
        File to read.

    Returns
    -------
    List[Union[str, int, List[float], int]]
        List of videoname, framenumber, bounding box, and label
    """

    info = []

    f = open(file, "r")
    lines = f.readlines()[1:]
    for line in lines:
        name, framenum, *box, label, vel, kmeans, hdbscan = line.split(",")
        framenum = int(framenum)
        label = int(label)
        box = [int(x) for x in box]

        item = [name, framenum, box, label]
        info.append(item)

    return info