Skip to content

reporter

flamme.reporter

Contain reporters.

flamme.reporter.BaseReporter

Bases: ABC

Define the base class to compute a HTML report.

Example usage:

>>> from flamme.analyzer import NullValueAnalyzer
>>> from flamme.ingestor import ParquetIngestor
>>> from flamme.transformer.dataframe import SequentialDataFrameTransformer
>>> from flamme.reporter import Reporter
>>> reporter = Reporter(
...     ingestor=ParquetIngestor("/path/to/data.parquet"),
...     transformer=SequentialDataFrameTransformer(transformers=[]),
...     analyzer=NullValueAnalyzer(),
...     report_path="/path/to/report.html",
... )
>>> reporter
Reporter(
  (ingestor): ParquetIngestor(path=/path/to/data.parquet)
  (transformer): SequentialDataFrameTransformer()
  (analyzer): NullValueAnalyzer(figsize=None)
  (report_path): /path/to/report.html
  (max_toc_depth): 6
)
>>> report = reporter.compute()  # doctest: +SKIP

flamme.reporter.BaseReporter.compute

compute() -> None

Generate a HTML report.

Example usage:

>>> from flamme.analyzer import NullValueAnalyzer
>>> from flamme.ingestor import ParquetIngestor
>>> from flamme.transformer.dataframe import SequentialDataFrameTransformer
>>> from flamme.reporter import Reporter
>>> reporter = Reporter(
...     ingestor=ParquetIngestor("/path/to/data.parquet"),
...     transformer=SequentialDataFrameTransformer(transformers=[]),
...     analyzer=NullValueAnalyzer(figsize=None),
...     report_path="/path/to/report.html",
... )
>>> report = reporter.compute()  # doctest: +SKIP

flamme.reporter.NoRepeatReporter

Bases: BaseReporter

Implement a reporter that computes the report only once.

Parameters:

Name Type Description Default
reporter BaseReporter | dict

The reporter or its configuration.

required
report_path Path | str

The path where to save the HTML report.

required

Example usage:

>>> from flamme.analyzer import NullValueAnalyzer
>>> from flamme.ingestor import ParquetIngestor
>>> from flamme.transformer.dataframe import SequentialDataFrameTransformer
>>> from flamme.reporter import Reporter, NoRepeatReporter
>>> reporter = NoRepeatReporter(
...     reporter=Reporter(
...         ingestor=ParquetIngestor("/path/to/data.parquet"),
...         transformer=SequentialDataFrameTransformer(transformers=[]),
...         analyzer=NullValueAnalyzer(),
...         report_path="/path/to/report.html",
...     ),
...     report_path="/path/to/report.html",
... )
>>> report = reporter.compute()  # doctest: +SKIP

flamme.reporter.Reporter

Bases: BaseReporter

Implement a simple reporter.

Parameters:

Name Type Description Default
ingestor BaseIngestor | dict

The ingestor or its configuration.

required
transformer BaseDataFrameTransformer | dict

Specifies a pandas.DataFrame transformer or its configuration.

required
ingestor BaseIngestor | dict

The analyzer or its configuration.

required
report_path Path | str

The path where to save the HTML report.

required
max_toc_depth int

The maximum level to show in the table of content.

6

Example usage:

>>> from flamme.analyzer import NullValueAnalyzer
>>> from flamme.ingestor import ParquetIngestor
>>> from flamme.transformer.dataframe import SequentialDataFrameTransformer
>>> from flamme.reporter import Reporter
>>> reporter = Reporter(
...     ingestor=ParquetIngestor("/path/to/data.parquet"),
...     transformer=SequentialDataFrameTransformer(transformers=[]),
...     analyzer=NullValueAnalyzer(),
...     report_path="/path/to/report.html",
... )
>>> report = reporter.compute()  # doctest: +SKIP

flamme.reporter.is_reporter_config

is_reporter_config(config: dict) -> bool

Indicate if the input configuration is a configuration for a BaseReporter.

This function only checks if the value of the key _target_ is valid. It does not check the other values. If _target_ indicates a function, the returned type hint is used to check the class.

Parameters:

Name Type Description Default
config dict

The configuration to check.

required

Returns:

Name Type Description
bool bool

True if the input configuration is a configuration for a BaseReporter object.

Example usage:

>>> from flamme.reporter import is_reporter_config
>>> is_reporter_config(
...     {
...         "_target_": "flamme.reporter.Reporter",
...         "ingestor": {
...             "_target_": "flamme.ingestor.CsvIngestor",
...             "path": "/path/to/data.csv",
...         },
...         "transformer": {
...             "_target_": "flamme.transformer.dataframe.ToNumeric",
...             "columns": ["col1", "col3"],
...         },
...         "analyzer": {"_target_": "flamme.analyzer.NullValueAnalyzer"},
...         "report_path": "/path/to/report.html",
...     }
... )
True

flamme.reporter.setup_reporter

setup_reporter(
    reporter: BaseReporter | dict,
) -> BaseReporter

Set up a reporter.

The reporter is instantiated from its configuration by using the BaseReporter factory function.

Parameters:

Name Type Description Default
reporter BaseReporter | dict

Specifies an reporter or its configuration.

required

Returns:

Type Description
BaseReporter

An instantiated reporter.

Example usage:

>>> from flamme.reporter import setup_reporter
>>> reporter = setup_reporter(
...     {
...         "_target_": "flamme.reporter.Reporter",
...         "ingestor": {
...             "_target_": "flamme.ingestor.CsvIngestor",
...             "path": "/path/to/data.csv",
...         },
...         "transformer": {
...             "_target_": "flamme.transformer.dataframe.ToNumeric",
...             "columns": ["col1", "col3"],
...         },
...         "analyzer": {"_target_": "flamme.analyzer.NullValueAnalyzer"},
...         "report_path": "/path/to/report.html",
...     }
... )
>>> reporter
Reporter(
  (ingestor): CsvIngestor(path=/path/to/data.csv)
  (transformer): ToNumericDataFrameTransformer(columns=('col1', 'col3'), ignore_missing=False)
  (analyzer): NullValueAnalyzer(figsize=None)
  (report_path): /path/to/report.html
  (max_toc_depth): 6
)