Data Manager#
- class DataManager(disable_cache: bool = False)[source]#
The
DataManagerclass handles data management for patch reports, including caching, validation and exporting to Excel.Data caching can be disabled by setting
disable_cachetoTrueat 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:
- property titles: list[PatchTitle][source]#
Retrieve and validate the current list of
PatchTitleobjects.If titles are not already loaded, they are fetched from the latest available dataset.
- Returns:
The validated list of
PatchTitleobjects.- 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, header_color: str | None = '#6432bdff', device_reports: dict[str, list[PatchDevice]] | None = None) dict[str, str][source]#
Exports patch data to the specified formats.
- Parameters:
patch_titles (list [
PatchTitle]) – A list ofPatchTitleobjects to include in the report. Defaults toself.titlesif not providedoutput_dir (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_TEXTkey incom.liquidzoo.patcher.plistfile.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 (set | None) – A set of formats to export. Defaults to all ({“excel”, “html”, “pdf”}).
header_color (str | None) – Hex color to use for HTML header table background (defaults to “#6432bdff”)
device_reports (dict[str, list[
PatchDevice]] | None) – Optional dictionary mapping title IDs to device lists for per-title detail sheets.
- Returns:
A dictionary containing paths to generated reports.
- Return type:
- 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:
- 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
Pathobjects 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:
Path | None