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 a DataManager instance and optional Excel file path.

Parameters:
  • data_manager (DataManager) – The DataManager instance for retrieving and managing patch data.

  • excel_path (Union [Path | str]) – 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 (Union [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:

pandas.DataFrame

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.

Parameters:
  • data (List [List]) – The data to display in the table.

  • headers (Optional [List]) – Header names for the columns of the tables.

Returns:

The formatted table as a string.

Return type:

str

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:

List [PatchTitle]

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.

  • sort_by (Optional [str]) – 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:

pandas.DataFrame

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.

classmethod from_cli(value: str) BaseEnum[source]#

Maps CLI-friendly inputs (e.g., '--most-installed', '--release-frequency') to Enum values.

Parameters:

value (str) – CLI-friendly string.

Returns:

Corresponding Enum value

Return type:

FilterCriteria | TrendCriteria

Raises:

PatcherError – If the input is invalid

class FilterCriteria(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Enumeration for filtering criteria used in patch data analysis.

class TrendCriteria(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Enumeration for trend analysis criteria.