def load_data(type):
    global runs_df
    global qrels_df

    runs_df = pd.DataFrame(
        columns=['TOPIC', 'QUERY', 'DOCUMENT', 'RANK', 'SCORE', 'RUN'])
    qrels_df = pd.DataFrame(
        columns=['TOPIC', 'ITERATION', 'DOCUMENT', 'RELEVANCY'])

    if type == 'default':
        # load the txt files into a dataframe runs
        print("➡️ Loading default runs from file.")
        runs_df = convert_data.read_csv_into_df(DEFAULT_DATA_FOLDER + "runs",
                                                "RUNS", DEBUG_MAX_FILES_LOADED,
                                                1)

        # load the txt files into a dataframe qrels
        print("➡️ Loading default qrels from file.")
        qrels_df = convert_data.read_csv_into_df(DEFAULT_DATA_FOLDER + "qrels",
                                                 "QRELS",
                                                 DEBUG_MAX_FILES_LOADED, 1)

        file_handling.delete_all_files_in_dir(app.config['UPLOAD_FOLDER'] +
                                              "runs" + '/')
        file_handling.delete_all_files_in_dir(app.config['UPLOAD_FOLDER'] +
                                              "qrels" + '/')

    if type == 'custom':
        # load the txt files into a dataframe runs
        print("➡️ Loading custom runs from file.")
        runs_df = convert_data.read_csv_into_df(UPLOAD_FOLDER + "runs", "RUNS",
                                                1000, 1)

        # load the txt files into a dataframe qrels
        print("➡️ Loading custom qrels from file.")
        qrels_df = convert_data.read_csv_into_df(UPLOAD_FOLDER + "qrels",
                                                 "QRELS", 1000, 1)

    response = make_response(
        jsonify(get_runs.params(runs_df)),
        200,
    )
    response.headers["Content-Type"] = "application/json"
    return response
# parameters
topic = 402
pool_size = 300

logging.basicConfig(filename=LOGS_PATH + 'round_robin.log',
                    filemode='w',
                    format='%(message)s',
                    level=logging.DEBUG)

pd.set_option("display.max_rows", None, "display.max_columns", 1000,
              "display.max_colwidth", None, "display.width", 100000)

# load the txt files into a dataframe runs
# print("➡️ Loading runs from file.")
runs_df = convert_data.read_csv_into_df(RUNS_PATH, "RUNS", 30, 0)

# load the txt files into a dataframe qrels
# print("➡️ Loading qrels from file.")
qrels_df = convert_data.read_csv_into_df(QRELS_PATH, "QRELS", 1, 0)

# filter both runs & qrels by topic
runs_filtered = get_runs.by_topic(runs_df, topic)
qrels_filtered = get_qrels.by_topic(qrels_df, topic)

# print("Start adjudication by pressing enter")
# start_adjudication = str(input())

# round_robin.round_robin_alg(runs_filtered, qrels_filtered, pool_size, LOGS_PATH)
max_mean_results = max_mean.max_mean_alg(runs_filtered, qrels_filtered,
                                         pool_size, LOGS_PATH)
import pandas as pd
import json

from lib import convert_data
'''
Loading data & initializations
'''
paths = {
    'output': "./outputs/",
    'runs': "../data/default/runs",
    'qrels': "../data/default/qrels"
}

# load the txt files into a dataframe runs
print("➡️ Loading runs from file.")
runs_df = convert_data.read_csv_into_df(paths['runs'], "RUNS", 10)

# load the txt files into a dataframe qrels
print("➡️ Loading qrels from file.")
qrels_df = convert_data.read_csv_into_df(paths['qrels'], "QRELS", 1)