import csv


def read_gold_qdmrs(file_path):
    """Reads csv file of QDMR strings 
        and converts it into a csv containing processed QDMRs
    
    Parameters
    ----------
    file_path : str
        Path to csv file containing,
        question_id, question text, question decomposition
    
    Returns
    -------
    list
        Dictionary from question_id to question_text and decomposition
    """
    # append data into one dictionary
    data_dict = {}
    with open(file_path, encoding="utf8") as csv_file:
        csv_reader = csv.DictReader(csv_file)
        line_count = 0
        for row in csv_reader:
            if line_count == 0:
                print(f'Column names are {", ".join(row)}')
                line_count += 1
            question_id = row["question_id"]
            question_text = row["question_text"]
            decomposition = row["decomposition"]
            data_dict[question_id] = {}
            data_dict[question_id]['question_text'] = question_text
            data_dict[question_id]['decomposition'] = decomposition
            line_count += 1
            if line_count % 500 == 0:
                print(f'Processed {line_count} lines.')
    return data_dict