assets_guardian.core.reporting.excel.sheets_builderο
Classes
|
Generic Excel sheet builder driven by configuration metadata. |
- class assets_guardian.core.reporting.excel.sheets_builder.GenericSheetBuilder(source_name: str, instance_id: str, rules_file_path: str | Path)[source]ο
Bases:
ISheetBuilderGeneric Excel sheet builder driven by configuration metadata.
- Variables:
source_name (str) β Unique name of the source (e.g., βgitlabβ).
Initializes the generic sheet builder.
- Parameters:
source_name β Technical name of the source plugin.
rules_file_path β Absolute or relative path to the JSON rules file.
- build(worksheet: Any, data: Any, preserved: Any, rules: Any) None[source]ο
Builds the Excel sheet by applying filters and mappings from the rules file.
- Parameters:
worksheet β The Excel worksheet (ExcelWorksheet).
data β Collection data (source, instance) -> CollectorResult.
preserved β Manual data indexed by its primary key.
rules β Column definition (list of dictionaries).
- get_rules() dict[str, list[dict[str, Any]]][source]ο
Returns the formatting rules in the format expected by the ExcelWriter.
This method extracts only the list of columns for each sheet.
- Returns:
Dictionary of rules per sheet.
- Return type:
dict[str, list[dict[str, Any]]]
- property preserved_columns: dict[str, dict[str, list[str]]]ο
Dynamically defines the columns to preserve from the configuration.
- Returns:
Preservation configuration.
- Return type:
dict[str, dict[str, list[str]]]
- property sheet_names: list[str]ο
Returns the list of Excel sheet names defined in the rules.
- Returns:
List of sheet names.
- Return type:
list[str]