base_generator
tit.reporting.generators.base_generator ¶
Base report generator for TI-Toolbox.
This module provides the abstract base class for all report generators, with common functionality for BIDS output management, software version collection, and error tracking.
BaseReportGenerator ¶
BaseReportGenerator(project_dir: str | Path, subject_id: str | None = None, session_id: str | None = None, report_type: str = 'general')
Bases: ABC
Abstract base class for all TI-Toolbox report generators.
Provides common functionality including: - BIDS-compliant output path management - Software version collection - Error and warning tracking - Dataset description generation
Initialize the base report generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_dir
|
str | Path
|
Path to the project directory |
required |
subject_id
|
str | None
|
BIDS subject ID (without 'sub-' prefix) |
None
|
session_id
|
str | None
|
Optional session/run identifier |
None
|
report_type
|
str
|
Type of report being generated |
'general'
|
Source code in tit/reporting/generators/base_generator.py
add_error ¶
Add an error to the report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Error message |
required |
context
|
str | None
|
Context (e.g., subject ID, montage name) |
None
|
step
|
str | None
|
Processing step where error occurred |
None
|
Source code in tit/reporting/generators/base_generator.py
add_warning ¶
Add a warning to the report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Warning message |
required |
context
|
str | None
|
Context (e.g., subject ID, montage name) |
None
|
step
|
str | None
|
Processing step where warning occurred |
None
|
Source code in tit/reporting/generators/base_generator.py
get_output_dir ¶
get_output_dir() -> Path
Get the BIDS-compliant output directory for reports.
Returns:
| Type | Description |
|---|---|
Path
|
Path to the reports directory |
Source code in tit/reporting/generators/base_generator.py
get_output_path ¶
Get the full output path for the report file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timestamp
|
str | None
|
Optional timestamp string (uses current time if not provided) |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Full path to the report file |
Source code in tit/reporting/generators/base_generator.py
generate ¶
Generate the HTML report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
str | Path | None
|
Optional custom output path |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the generated report file |