Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/dve/reporting/excel_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions tests/test_error_reporting/test_excel_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
20 changes: 10 additions & 10 deletions tests/test_pipeline/test_spark_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -497,23 +497,23 @@ 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",
}
),
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",
Expand Down