def process_file()

in scripts/plot_results.py [0:0]


def process_file(filepath: str, data_dict: dict) -> None:
    """Read a CSV file and iterate through all rows.

    Stores all records in an in-memory dict.
    """
    # We're expecting the node_name in the file path
    # e.g., test-result-10.0.3.128.csv
    filename = filepath.split("/")[-1]
    no_ext = remove_suffix(filename, ".csv")
    node_name = remove_prefix(no_ext, "test-result-")

    with open(filepath, newline="") as open_file:
        dict_reader = read_file(file_desc=open_file)
        for row in dict_reader:
            _rps = row.get("Requests Per Second")
            dict_title = f"{_rps} - {node_name}"
            rps = data_dict.get(dict_title)

            if rps:
                # it exists, append
                rps["percentile"].append(float(row.get("Percentile")))
                rps["latency"].append(float(row.get("Value (ms)")))
            else:
                data_dict[dict_title] = {}
                data_dict[dict_title]["percentile"] = [float(row.get("Percentile"))]
                data_dict[dict_title]["latency"] = [float(row.get("Value (ms)"))]