diff --git a/.ci-scripts/utils/evaluate_designEvaluator_results.py b/.ci-scripts/utils/evaluate_designEvaluator_results.py new file mode 100644 index 0000000000000000000000000000000000000000..ce3b6643ce1a6d904669e1e4a62a897136637c4f --- /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()