from typing import Dict
from pathlib import Path


def find_csv_file(directory: str) -> Dict[str, Dict[str, str]]:
    """
    Finds the priorirization.csv file in the input directory and uses the
    directory names to determine which method was used. This information is
    saced in a dictionary as:
    {phenotype : {method : path/to/file}}
    """
    file_dict = {}
    for path in Path(directory).rglob('prioritization.csv'):
        full_path = str(path)
        (name, method, __, __) = path.parts[-4:]
        name = name[8:]  # 'CELLECT-' is 8 long
        method = method[8:]
        if name not in file_dict:
            file_dict[name] = {}
        file_dict[name].update({method: full_path})
    return file_dict