import csv
import re


def parse_csv_data(file_path, sep=","):
    """Parses the NDA number and patent associations in the given file.

    Args:
        file_path (str): Path to the Orange Book patent data
        sep (str, optional): The separator used in the Orange Book patent data.
                             Defaults to ",".

    Returns:
        list(dict): Each object contains fields 'nda' and 'patent_num'
    """
    nda_patent_list = []
    with open(file_path) as csvfile:
        data_reader = csv.DictReader(csvfile, delimiter=sep)
        for row in data_reader:
            if row["Appl_Type"] == "N":
                # Keep only the numbers in the patents
                nda_patent_list.append(
                    {
                        "nda": row["Appl_No"],
                        "patent_num": re.sub("[^0-9]+", "", row["Patent_No"]),
                    }
                )
    return nda_patent_list