from typing import List


def read_umls_file_headers(meta_path: str, filename: str) -> List[str]:
    """
    Read the file descriptor MRFILES.RRF from a UMLS release and get column headers (names)
    for the given file

    MRFILES.RRF file format: a pipe-separated values
    Useful columns:
        column 0: name of one of the files in the META directory
        column 2: column names of that file

    Args:
        meta_path: path to the META directory of an UMLS release
        filename: name of the file to get its column headers
    Returns:
        a list of column names
    """
    file_descriptors = f"{meta_path}/MRFILES.RRF"  # to get column names
    with open(file_descriptors) as fin:
        for line in fin:
            splits = line.split("|")
            found_filename = splits[0]
            column_names = (splits[2] + ",").split(
                ","
            )  # ugly hack because all files end with an empty column
            if found_filename in filename:
                return column_names
    assert False, f"Couldn't find column names for file {filename}"
    return None