pdstools.adm.Reports ==================== .. py:module:: pdstools.adm.Reports Classes ------- .. autoapisummary:: pdstools.adm.Reports.Reports Module Contents --------------- .. py:class:: Reports(datamart: pdstools.adm.ADMDatamart.ADMDatamart) Bases: :py:obj:`pdstools.utils.namespaces.LazyNamespace` .. py:attribute:: dependencies :value: ['yaml'] .. py:attribute:: dependency_group :value: 'healthcheck' .. py:attribute:: datamart .. py:method:: model_reports(model_ids: List[str], *, name: Optional[str] = None, title: str = 'ADM Model Report', subtitle: str = '', output_dir: Optional[os.PathLike] = None, only_active_predictors: bool = False, output_type: str = 'html', keep_temp_files: bool = False, verbose: bool = False, progress_callback: Optional[Callable[[int, int], None]] = None, model_file_path: Optional[os.PathLike] = None, predictor_file_path: Optional[os.PathLike] = None) -> pathlib.Path Generates model reports. :param model_ids: The list of model IDs to generate reports for. :type model_ids: List[str] :param name: The (base) file name of the report. :type name: str, optional :param title: Title top put in the report, uses a default string if not given. :type title: str, optional :param subtitle: Subtitle top put in the report, empty if not given. :type subtitle: str, optional :param output_dir: The directory for the output. If None, uses current working directory. :type output_dir: Union[str, Path, None], optional :param only_active_predictors: Whether to only include active predictor details. :type only_active_predictors: bool, default=False :param output_type: The type of the output file (e.g., "html", "pdf"). :type output_type: str, default='html' :param keep_temp_files: If True, the temporary directory with temp files will not be deleted after report generation. :type keep_temp_files: bool, optional :param verbose: If True, prints detailed logs during execution. :type verbose: bool, optional :param progress_callback: A callback function to report progress. Used only in the Streamlit app. The function should accept two integers: the current progress and the total. :type progress_callback: Callable[[int, int], None], optional :param model_file_path: Optional name of the actual model data file, so it does not get copied :type model_file_path: Union[str, Path, None], optional :param predictor_file_path: Optional name of the actual predictor data file, so it does not get copied :type predictor_file_path: Union[str, Path, None], optional :returns: The path to the generated report file. :rtype: Path :raises ValueError: If there's an error in report generation or invalid parameters. :raises FileNotFoundError: If required files are not found. :raises subprocess.SubprocessError: If there's an error in running external commands. .. py:method:: health_check(name: Optional[str] = None, title: str = 'ADM Model Overview', subtitle: str = '', output_dir: Optional[os.PathLike] = None, *, query: Optional[pdstools.utils.types.QUERY] = None, output_type: str = 'html', keep_temp_files: bool = False, verbose: bool = False, model_file_path: Optional[os.PathLike] = None, predictor_file_path: Optional[os.PathLike] = None, prediction_file_path: Optional[os.PathLike] = None) -> pathlib.Path Generates Health Check report based on the provided parameters. :param name: The (base) file name of the report. :type name: str, optional :param title: Title top put in the report, uses a default string if not given. :type title: str, optional :param subtitle: Subtitle top put in the report, empty if not given. :type subtitle: str, optional :param query: Optional extra filter on the datamart data :type query: QUERY, optional :param output_dir: The directory for the output. If None, uses current working directory. :type output_dir: Union[str, Path, None], optional :param output_type: The type of the output file (e.g., "html", "pdf"). :type output_type: str, default='html' :param keep_temp_files: If True, the temporary directory with temp files will not be deleted after report generation. :type keep_temp_files: bool, optional :param verbose: If True, prints detailed logs during execution. :type verbose: bool, optional :param model_file_path: Optional name of the actual model data file, so it does not get copied :type model_file_path: Union[str, Path, None], optional :param predictor_file_path: Optional name of the actual predictor data file, so it does not get copied :type predictor_file_path: Union[str, Path, None], optional :param prediction_file_path: Optional name of the actual predictions data file, so it does not get copied :type prediction_file_path: Union[str, Path, None], optional :returns: The path to the generated report file. :rtype: Path :raises ValueError: If there's an error in report generation or invalid parameters. :raises FileNotFoundError: If required files are not found. :raises subprocess.SubprocessError: If there's an error in running external commands. .. py:method:: _get_output_filename(name: Optional[str], report_type: str, model_id: Optional[str] = None, output_type: str = 'html') -> str :staticmethod: Generate the output filename based on the report parameters. .. py:method:: _copy_quarto_file(qmd_file: str, temp_dir: pathlib.Path) -> None :staticmethod: Copy the report quarto file to the temporary directory. .. py:method:: _write_params_files(temp_dir: pathlib.Path, params: Dict = {}, project: Dict = {'type': 'default'}, analysis: Dict = {}) -> None :staticmethod: Write parameters to a YAML file. .. py:method:: _find_executable(exec_name: str) -> pathlib.Path :staticmethod: Find the executable on the system. .. py:method:: _get_executable_with_version(exec_name: str, verbose: bool = False) -> Tuple[pathlib.Path, str] :staticmethod: .. py:method:: get_quarto_with_version(verbose: bool = True) -> Tuple[pathlib.Path, str] :staticmethod: .. py:method:: get_pandoc_with_version(verbose: bool = True) -> Tuple[pathlib.Path, str] :staticmethod: .. py:method:: run_quarto(qmd_file: str, output_filename: str, output_type: str = 'html', params: Dict = {}, project: Dict = {'type': 'default'}, analysis: Dict = {}, temp_dir: pathlib.Path = Path('.'), verbose: bool = False) -> int :staticmethod: Run the Quarto command to generate the report. .. py:method:: excel_report(name: Union[pathlib.Path, str] = Path('Tables.xlsx'), predictor_binning: bool = False, query: Optional[pdstools.utils.types.QUERY] = None) -> Optional[pathlib.Path] Export aggregated data to an Excel file. This method exports the last snapshots of model_data, predictor summary, and optionally predictor_binning data to separate sheets in an Excel file. If a specific table is not available, it will be skipped without causing the export to fail. :param name: The path where the Excel file will be saved. Defaults to Path("Tables.xlsx"). :type name: Union[Path, str], optional :param predictor_binning: If True, include predictor_binning data in the export. This is the last snapshot of the raw data, so it can be big. Defaults to False. :type predictor_binning: bool, optional :returns: The path to the created Excel file if the export was successful, None if no data was available to export. :rtype: Union[Path, None]