import csv
from typing import OrderedDict


def load_tab_delimited_csv(filepath):
    """
        loads a tab delimted csv as a list of ordered dictionaries
    """
    data = []
    with open(filepath) as file:
        reader = csv.reader(file, delimiter="\t")

        header = []
        for csv_row in reader:
            if len(header) == 0:
                header = [val.strip() for val in csv_row]
            else:
                data_row = OrderedDict()

                for i, value in enumerate(csv_row):
                    data_row[header[i]] = value.strip()

                data.append(data_row)

    return data