Analyzer#
- class Analyzer(data_manager: DataManager, excel_path: str | Path | None = None)[source]#
Performs analysis on patch data retrieved via
DataManager
.Analyzer
class objects are initialized with aDataManager
instance and optional Excel file path.- Parameters:
data_manager (
DataManager
) – TheDataManager
instance for retrieving and managing patch data.
- initialize_dataframe(excel_path: Path | str) DataFrame [source]#
Initializes a DataFrame by reading the Excel file from the provided path.
- Parameters:
excel_path (
Union
[Path
|str
]) – The path to the Excel file, either as a string or aPath
object.- Returns:
A pandas DataFrame loaded from the Excel file.
- Return type:
- Raises:
PatcherError – If the passed
excel_file
could not be validated (does not exist, or is not a file).FetchError – If the excel file could not be read, if the file is empty, or if the file could not be parsed properly.
- static format_table(data: List[List[str]], headers: List[str] | None = None) str [source]#
Formats the data passed into a table for CLI output.
- filter_titles(criteria: FilterCriteria, threshold: float | None = 70.0, top_n: int | None = None) List[PatchTitle] [source]#
Filters and sorts PatchTitle objects based on specified criteria.
- Parameters:
criteria (
FilterCriteria
) –The criteria to filter and sort by.
Options include:
’most_installed’: Returns the most installed software by total_hosts.
’least_installed’: Returns the least installed software by total_hosts.
’oldest_least_complete’: Returns the oldest patches with the least completion percent.
’below_threshold’: Returns patches below a certain completion percentage.
’high_missing’: Titles where missing patches are greater than 50% of total hosts.
’zero_completion’: Titles with zero completion percentage.
’top_performers’: Titles with completion percentage greater than 90%.
’installomator’: Titles that have Installomator labels. See Installomator
threshold (
Optional
[float
]) – The threshold for filtering completion percentages, default is 70.0.top_n (
Optional
[int
]) – Number of results to return. If None (default), return all matching results.
- Returns:
Filtered and sorted list of
PatchTitle
objects.- Return type:
- timelapse(criteria: TrendCriteria, datasets: List[DataFrame | Path | str] | None = None, sort_by: str | None = None, ascending: bool = True) DataFrame [source]#
Analyzes trends across multiple datasets based on specified criteria.
- Parameters:
criteria (
TrendCriteria
) – The trend analysis criteria to use.datasets (
Optional
[List
]) – A list of DataFrames or file paths to analyze. If None, uses cached data.ascending (
bool
) – Sorting order (ascending if True, descending if False).
- Returns:
A DataFrame with the trend analysis results.
- Return type:
- Raises:
PatcherError – If criteria is invalid or data loading fails.
- class BaseEnum(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Base class for Enum extensions with reusable CLI parsing.