Data Manager#

class DataManager(disable_cache: bool = False)[source]#

The DataManager class handles data management for patch reports, including caching, validation and exporting to Excel.

Data caching can be disabled by setting disable_cache to True at runtime.

Parameters:

disable_cache (bool) – Whether caching functionality should be disabled.

property cache_off: bool[source]#

Indicates whether caching is disabled.

Returns:

True if caching is disabled, False otherwise.

Return type:

bool

property titles: List[PatchTitle][source]#

Retrieve and validate the current list of PatchTitle objects.

If titles are not already loaded, they are fetched from the latest available dataset.

Returns:

The validated list of PatchTitle objects.

Return type:

List [PatchTitle]

Raises:

PatcherError – If validation fails.

async export(patch_titles: List[PatchTitle], output_dir: str | Path, report_title: str, analysis: bool = False, date_format: str = '%B %d %Y', formats: set[str] | None = None) Dict[str, str][source]#

Exports patch data to the specified formats.

Parameters:
  • patch_titles (List [PatchTitle]) – A list of PatchTitle objects to include in the report. Defaults to self.titles if not provided

  • output_dir (Union [str | Path]) – The directory in which to save the exported report(s).

  • report_title (str) – The title to use for the header in exported report(s). Defaults to HEADER_TEXT key in com.liquidzoo.patcher.plist file.

  • analysis (bool) – Denotes whether this is analysis report (affects HTML output path).

  • date_format (str) – The date format for PDF/HTML headers. Defaults to “%B %d %Y” (Month Day Year).

  • formats (Optional [set]) – A set of formats to export. Defaults to all ({“excel”, “html”, “pdf”}).

Returns:

A dictionary containing paths to generated reports.

Return type:

Dict [str, str]

reset_cache() bool[source]#

Removes all cached files from Cache directory. See reset.

Returns:

True if all files were able to be removed, False otherwise.

Return type:

bool

load_cached_data() List[DataFrame][source]#

Load all cached data files into a list of DataFrames.

Returns:

List of pandas DataFrame objects with cached data.

Return type:

List [pandas.DataFrame]

get_cached_files() List[Path][source]#

Retrieves all cached file Paths.

Returns:

A list of Path objects pointing to cached files.

Return type:

List [Path]

get_latest_dataset() Path | None[source]#

Retrieves the most recent dataset of patch reports and returns the path.

If a tracked Excel file is available, it is preferred. Otherwise, searches the cache directory.

Returns:

Path to the latest dataset (Excel or pickle file), or None if no dataset is found.

Return type:

Optional [Path]