Skip to content

Commit c261be8

Browse files
committed
Add granular footer controls to validation reports
1 parent 6012b67 commit c261be8

File tree

1 file changed

+48
-9
lines changed

1 file changed

+48
-9
lines changed

pointblank/validate.py

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,16 @@ class PointblankConfig:
363363

364364
report_incl_header: bool = True
365365
report_incl_footer: bool = True
366+
report_incl_footer_timings: bool = True
367+
report_incl_footer_notes: bool = True
366368
preview_incl_header: bool = True
367369

368370
def __repr__(self):
369371
return (
370372
f"PointblankConfig(report_incl_header={self.report_incl_header}, "
371373
f"report_incl_footer={self.report_incl_footer}, "
374+
f"report_incl_footer_timings={self.report_incl_footer_timings}, "
375+
f"report_incl_footer_notes={self.report_incl_footer_notes}, "
372376
f"preview_incl_header={self.preview_incl_header})"
373377
)
374378

@@ -380,6 +384,8 @@ def __repr__(self):
380384
def config(
381385
report_incl_header: bool = True,
382386
report_incl_footer: bool = True,
387+
report_incl_footer_timings: bool = True,
388+
report_incl_footer_notes: bool = True,
383389
preview_incl_header: bool = True,
384390
) -> PointblankConfig:
385391
"""
@@ -393,7 +399,13 @@ def config(
393399
threshold levels (if set).
394400
report_incl_footer
395401
Should the footer of the validation table report be displayed? The footer contains the
396-
starting and ending times of the interrogation.
402+
starting and ending times of the interrogation and any notes added to validation steps.
403+
report_incl_footer_timings
404+
Controls whether the validation timing information (start time, duration, and end time)
405+
should be displayed in the footer. Only applies when `report_incl_footer=True`.
406+
report_incl_footer_notes
407+
Controls whether the notes from validation steps should be displayed in the footer. Only
408+
applies when `report_incl_footer=True`.
397409
preview_incl_header
398410
Whether the header should be present in any preview table (generated via the
399411
[`preview()`](`pointblank.preview`) function).
@@ -407,6 +419,8 @@ def config(
407419
global global_config
408420
global_config.report_incl_header = report_incl_header # pragma: no cover
409421
global_config.report_incl_footer = report_incl_footer # pragma: no cover
422+
global_config.report_incl_footer_timings = report_incl_footer_timings # pragma: no cover
423+
global_config.report_incl_footer_notes = report_incl_footer_notes # pragma: no cover
410424
global_config.preview_incl_header = preview_incl_header # pragma: no cover
411425

412426

@@ -14986,7 +15000,12 @@ def get_note(self, i: int, key: str, format: str = "dict") -> dict[str, str] | s
1498615000
return None
1498715001

1498815002
def get_tabular_report(
14989-
self, title: str | None = ":default:", incl_header: bool = None, incl_footer: bool = None
15003+
self,
15004+
title: str | None = ":default:",
15005+
incl_header: bool = None,
15006+
incl_footer: bool = None,
15007+
incl_footer_timings: bool = None,
15008+
incl_footer_notes: bool = None,
1499015009
) -> GT:
1499115010
"""
1499215011
Validation report as a GT table.
@@ -15009,6 +15028,20 @@ def get_tabular_report(
1500915028
name of the table as the title for the report. If no title is wanted, then `":none:"`
1501015029
can be used. Aside from keyword options, text can be provided for the title. This will
1501115030
be interpreted as Markdown text and transformed internally to HTML.
15031+
incl_header
15032+
Controls whether the header section should be displayed. If `None`, uses the global
15033+
configuration setting. The header contains the table name, label, and threshold
15034+
information.
15035+
incl_footer
15036+
Controls whether the footer section should be displayed. If `None`, uses the global
15037+
configuration setting. The footer can contain validation timing information and notes.
15038+
incl_footer_timings
15039+
Controls whether validation timing information (start time, duration, end time) should
15040+
be displayed in the footer. If `None`, uses the global configuration setting. Only
15041+
applies when `incl_footer=True`.
15042+
incl_footer_notes
15043+
Controls whether notes from validation steps should be displayed in the footer. If
15044+
`None`, uses the global configuration setting. Only applies when `incl_footer=True`.
1501215045

1501315046
Returns
1501415047
-------
@@ -15068,6 +15101,10 @@ def get_tabular_report(
1506815101
incl_header = global_config.report_incl_header
1506915102
if incl_footer is None:
1507015103
incl_footer = global_config.report_incl_footer
15104+
if incl_footer_timings is None:
15105+
incl_footer_timings = global_config.report_incl_footer_timings
15106+
if incl_footer_notes is None:
15107+
incl_footer_notes = global_config.report_incl_footer_notes
1507115108

1507215109
# Do we have a DataFrame library to work with?
1507315110
_check_any_df_lib(method_used="get_tabular_report")
@@ -15860,13 +15897,15 @@ def get_tabular_report(
1586015897
gt_tbl = gt_tbl.tab_header(title=html(title_text), subtitle=html(combined_subtitle))
1586115898

1586215899
if incl_footer:
15863-
# Add table time as HTML source note
15864-
gt_tbl = gt_tbl.tab_source_note(source_note=html(table_time))
15865-
15866-
# Create notes markdown from validation steps and add as separate source note
15867-
notes_markdown = _create_notes_html(self.validation_info)
15868-
if notes_markdown:
15869-
gt_tbl = gt_tbl.tab_source_note(source_note=md(notes_markdown))
15900+
# Add table time as HTML source note if enabled
15901+
if incl_footer_timings:
15902+
gt_tbl = gt_tbl.tab_source_note(source_note=html(table_time))
15903+
15904+
# Create notes markdown from validation steps and add as separate source note if enabled
15905+
if incl_footer_notes:
15906+
notes_markdown = _create_notes_html(self.validation_info)
15907+
if notes_markdown:
15908+
gt_tbl = gt_tbl.tab_source_note(source_note=md(notes_markdown))
1587015909

1587115910
# If the interrogation has not been performed, then style the table columns dealing with
1587215911
# interrogation data as grayed out

0 commit comments

Comments
 (0)