From c6dad9ff9f4a3583d4bc46f12df4f071a4094374 Mon Sep 17 00:00:00 2001 From: Maurice <zimmnau@ilr.rwth-aachen.de> Date: Tue, 25 Feb 2025 17:55:00 +0100 Subject: [PATCH] Added helper script to evaluate the design evaluator results --- .../utils/evaluate_designEvaluator_results.py | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .ci-scripts/utils/evaluate_designEvaluator_results.py diff --git a/.ci-scripts/utils/evaluate_designEvaluator_results.py b/.ci-scripts/utils/evaluate_designEvaluator_results.py new file mode 100644 index 00000000..ce3b6643 --- /dev/null +++ b/.ci-scripts/utils/evaluate_designEvaluator_results.py @@ -0,0 +1,46 @@ +import argparse +import pandas as pd +from bs4 import BeautifulSoup +import numpy as np +from io import StringIO +import sys + + +def check_html_file(html_file): + # Load and parse the HTML file with BeautifulSoup + with open(html_file, 'r') as file: + soup = BeautifulSoup(file, 'lxml') + + # Find all tables in the HTML file (in case there are multiple) + tables = soup.find_all('table') + + # Select the first table (assuming there's only one) + table = tables[0] + + table = str(table) + # Convert the HTML table to a Pandas DataFrame + df = pd.read_html(StringIO(table))[0] + + # Check the values in the fourth column (index 3) + has_deviation = False + for index, value in enumerate(df.iloc[:, 3]): + if not pd.isna(value) and value not in ['-nan', 'nan', 0]: + first_column_value = df.iloc[index, 0] # Get the first column value of this row + print(f"Warning: Deviation in '{first_column_value}'.") + print(f"Deviation between server version and calculation with feature: '{value}'") + has_deviation = True + + if has_deviation: + sys.exit(2) + + +def main(): + parser = argparse.ArgumentParser( + description='Check an HTML file for invalid values in the fourth column.' + ) + parser.add_argument('--file', type=str, help='Path to the HTML file') + args = parser.parse_args() + check_html_file(args.file) + +if __name__ == "__main__": + main() -- GitLab