Skip to content

Commit 03b65ea

Browse files
refactor: rename the column headers for elements of the error report
1 parent e745050 commit 03b65ea

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

src/dve/reporting/excel_report.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,13 @@ def _text_length(value):
443443

444444
@staticmethod
445445
def _format_headings(headings: list[str]) -> list[str]:
446+
# TODO - ideally this would be config driven to allow customisation.
447+
_renames = {
448+
"Table": "Grouping",
449+
"Data Item": "Data Item Submission Name",
450+
"Error": "Errors and Warnings",
451+
}
446452
headings = [heading.title() if heading[0].islower() else heading for heading in headings]
447453
headings = [heading.replace("_", " ") for heading in headings]
454+
headings = [_renames.get(heading, heading) for heading in headings]
448455
return headings

tests/test_error_reporting/test_excel_report.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ def test_excel_report(report_dfs):
116116
column_headings = [cell.value for cell in aggs["1"]]
117117
assert column_headings == [
118118
"Type",
119-
"Table",
120-
"Data Item",
119+
"Grouping",
120+
"Data Item Submission Name",
121121
"Category",
122122
"Error Code",
123123
"Count",
@@ -126,11 +126,11 @@ def test_excel_report(report_dfs):
126126
details = workbook["Error Data"]
127127
column_headings = [cell.value for cell in details["1"]]
128128
assert column_headings == [
129-
"Table",
129+
"Grouping",
130130
"Type",
131131
"Error Code",
132-
"Data Item",
133-
"Error",
132+
"Data Item Submission Name",
133+
"Errors and Warnings",
134134
"Value",
135135
"ID",
136136
"Category",

tests/test_pipeline/test_spark_pipeline.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ def test_error_report_where_report_is_expected( # pylint: disable=redefined-out
469469
OrderedDict(
470470
**{
471471
"Type": "Submission Failure",
472-
"Table": "planets",
473-
"Data Item": "orbitalPeriod",
472+
"Grouping": "planets",
473+
"Data Item Submission Name": "orbitalPeriod",
474474
"Category": "Bad value",
475475
"Error Code": "LONG_ORBIT",
476476
"Count": 1,
@@ -479,8 +479,8 @@ def test_error_report_where_report_is_expected( # pylint: disable=redefined-out
479479
OrderedDict(
480480
**{
481481
"Type": "Submission Failure",
482-
"Table": "planets",
483-
"Data Item": "gravity",
482+
"Grouping": "planets",
483+
"Data Item Submission Name": "gravity",
484484
"Category": "Bad value",
485485
"Error Code": "STRONG_GRAVITY",
486486
"Count": 1,
@@ -497,23 +497,23 @@ def test_error_report_where_report_is_expected( # pylint: disable=redefined-out
497497
assert error_data_records == [
498498
OrderedDict(
499499
**{
500-
"Table": "planets",
500+
"Grouping": "planets",
501501
"Type": "Submission Failure",
502502
"Error Code": "LONG_ORBIT",
503-
"Data Item": "orbitalPeriod",
504-
"Error": "Planet has long orbital period",
503+
"Data Item Submission Name": "orbitalPeriod",
504+
"Errors and Warnings": "Planet has long orbital period",
505505
"Value": 365.20001220703125,
506506
"ID": None,
507507
"Category": "Bad value",
508508
}
509509
),
510510
OrderedDict(
511511
**{
512-
"Table": "planets",
512+
"Grouping": "planets",
513513
"Type": "Submission Failure",
514514
"Error Code": "STRONG_GRAVITY",
515-
"Data Item": "gravity",
516-
"Error": "Planet has too strong gravity",
515+
"Data Item Submission Name": "gravity",
516+
"Errors and Warnings": "Planet has too strong gravity",
517517
"Value": 9.800000190734863,
518518
"ID": None,
519519
"Category": "Bad value",

0 commit comments

Comments
 (0)