from typing import Sequence
from typing import Tuple
from typing import List
from typing import Dict
import csv


def parse(raw: Sequence[str]) -> Tuple[List[str], List[List[str]], List[List[float]], Dict[str, int]]:
    """Returns a tuple of (hdrs, data, timeseries, column idx map)"""
    data = list(csv.reader(raw))

    print(len(data))
    print(len(data[0]))
    # check that it's actually a matrix
    print(set(len(r) for r in data))

    hdrs, data = data[0], data[1:]

    ts = [[float(x) for x in r[12:]] for r in data]
    col = {l: i for i, l in enumerate(hdrs)}
    return hdrs, data, ts, col