import pathlib


def create_reporting_fnames(qc_db_path, num_res, inst_name, raw_fname):
    """ Creates the filenames for the graphical report and Excel output
        Based on the relative path which depends on the QC database path qc_db_path
        num_res: the number of the latest results fetched from the database
        inst_name: instrument name
        raw_fname: raw file name
        returns the dictionary:
        {'excel_out':full path, 'graph_out':full_path}
    """
    qc_db_pobj = pathlib.Path(qc_db_path)
    excel_name = inst_name + '_latest_' + str(num_res) + '_results.xlsx'
    excel_path = qc_db_pobj.parents[1].joinpath(excel_name)
    png_name = 'qc_plot_' + raw_fname[:-4] + '.png'
    png_path = qc_db_pobj.parents[1].joinpath(png_name)

    return {'excel_out':excel_path, 'graph_out':png_path}