diff --git a/src/dve/reporting/excel_report.py b/src/dve/reporting/excel_report.py index 727b244..4dc3fee 100644 --- a/src/dve/reporting/excel_report.py +++ b/src/dve/reporting/excel_report.py @@ -443,6 +443,13 @@ def _text_length(value): @staticmethod def _format_headings(headings: list[str]) -> list[str]: + # TODO - ideally this would be config driven to allow customisation. + _renames = { + "Table": "Group", + "Data Item": "Data Item Submission Name", + "Error": "Errors and Warnings", + } headings = [heading.title() if heading[0].islower() else heading for heading in headings] headings = [heading.replace("_", " ") for heading in headings] + headings = [_renames.get(heading, heading) for heading in headings] return headings diff --git a/tests/test_error_reporting/test_excel_report.py b/tests/test_error_reporting/test_excel_report.py index 834a5e4..17c0dfd 100644 --- a/tests/test_error_reporting/test_excel_report.py +++ b/tests/test_error_reporting/test_excel_report.py @@ -116,8 +116,8 @@ def test_excel_report(report_dfs): column_headings = [cell.value for cell in aggs["1"]] assert column_headings == [ "Type", - "Table", - "Data Item", + "Group", + "Data Item Submission Name", "Category", "Error Code", "Count", @@ -126,11 +126,11 @@ def test_excel_report(report_dfs): details = workbook["Error Data"] column_headings = [cell.value for cell in details["1"]] assert column_headings == [ - "Table", + "Group", "Type", "Error Code", - "Data Item", - "Error", + "Data Item Submission Name", + "Errors and Warnings", "Value", "ID", "Category", diff --git a/tests/test_pipeline/test_spark_pipeline.py b/tests/test_pipeline/test_spark_pipeline.py index 4e33a28..7f4738f 100644 --- a/tests/test_pipeline/test_spark_pipeline.py +++ b/tests/test_pipeline/test_spark_pipeline.py @@ -469,8 +469,8 @@ def test_error_report_where_report_is_expected( # pylint: disable=redefined-out OrderedDict( **{ "Type": "Submission Failure", - "Table": "planets", - "Data Item": "orbitalPeriod", + "Group": "planets", + "Data Item Submission Name": "orbitalPeriod", "Category": "Bad value", "Error Code": "LONG_ORBIT", "Count": 1, @@ -479,8 +479,8 @@ def test_error_report_where_report_is_expected( # pylint: disable=redefined-out OrderedDict( **{ "Type": "Submission Failure", - "Table": "planets", - "Data Item": "gravity", + "Group": "planets", + "Data Item Submission Name": "gravity", "Category": "Bad value", "Error Code": "STRONG_GRAVITY", "Count": 1, @@ -497,11 +497,11 @@ def test_error_report_where_report_is_expected( # pylint: disable=redefined-out assert error_data_records == [ OrderedDict( **{ - "Table": "planets", + "Group": "planets", "Type": "Submission Failure", "Error Code": "LONG_ORBIT", - "Data Item": "orbitalPeriod", - "Error": "Planet has long orbital period", + "Data Item Submission Name": "orbitalPeriod", + "Errors and Warnings": "Planet has long orbital period", "Value": 365.20001220703125, "ID": None, "Category": "Bad value", @@ -509,11 +509,11 @@ def test_error_report_where_report_is_expected( # pylint: disable=redefined-out ), OrderedDict( **{ - "Table": "planets", + "Group": "planets", "Type": "Submission Failure", "Error Code": "STRONG_GRAVITY", - "Data Item": "gravity", - "Error": "Planet has too strong gravity", + "Data Item Submission Name": "gravity", + "Errors and Warnings": "Planet has too strong gravity", "Value": 9.800000190734863, "ID": None, "Category": "Bad value",