Analyzer#
- class Analyzer(data_manager: DataManager, excel_path: Path | str | None = None)[source]#
Performs analysis on patch data retrieved via
DataManager.Analyzerclass objects are initialized with aDataManagerinstance and optional Excel file path.- Parameters:
data_manager (
DataManager) – TheDataManagerinstance for retrieving and managing patch data.excel_path (Path | str | None) – Path to the Excel file.
- initialize_dataframe(excel_path: Path | str) DataFrame[source]#
Initializes a DataFrame by reading the Excel file from the provided path.
- Parameters:
excel_path (Path | str) – The path to the Excel file, either as a string or a Path object.
- Returns:
A pandas DataFrame loaded from the Excel file.
- Return type:
- Raises:
PatcherError – If the passed
excel_filecould not be validated (does not exist, or is not a file).PatcherError – 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 (float | None) – The threshold for filtering completion percentages, default is 70.0.
top_n (int | None) – Number of results to return. If None (default), return all matching results.
- Returns:
Filtered and sorted list of
PatchTitleobjects.- Return type:
list[
PatchTitle]
- timelapse(criteria: TrendCriteria, datasets: list[Path | str | DataFrame] | 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 (list[Path | str | pd.DataFrame] | None) – A list of DataFrames or file paths to analyze. If None, uses cached data.
sort_by (str | None) – A column to sort the results by.
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(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Base class for Enum extensions with reusable CLI parsing.