mentat.reports.overview module

Library for generating statistical overview reports.

The implementation is based on mentat.reports.base.BaseReporter.

class mentat.reports.overview.OverviewReporter(logger, reports_dir, templates_dir, locale='en', timezone='UTC', translations_dir=None)[source]

Bases: BaseReporter

Implementation of reporting class providing Mentat system overview reports.

format_section_key(section, key)[source]

Helper function for section key translation and/or formating.

render_report_overall(template_id, time_l, time_h, result, template_vars=None)[source]

Render summary section of the event report email.

  • report (mentat.datatype.sqldb.EventReportModel) – Event report.

  • events (dict) – Dictionary structure with IDEA events to be reported.

  • locale_name (str) – Name of the locale.

  • timezone_name (str) – Name of the timezone.

  • template_file (str) – Name of the template file.

  • template_vars (dict) – Additional template variables.


Content of the extra section of report email.

Return type


report(time_h, time_l, sqlalchemy_session, template_id, mailer, template_vars=None)[source]

Perform reporting for given time interval.

  • time_h (datetime.datetime) – Upper threshold of reporting time interval.

  • time_l (datetime.datetime) – Lower threshold of reporting time interval.

  • sqlalchemy_session – SQLAlchemy session to be used to retrieve the raw data.

  • template_id (str) – Identifier of the template to use to render the report.

  • mailer – Mailer to use to mail the report.

  • template_vars (dict) – Dictionary containing additional template variables.


Tuple containing generated report as dict and email text.

Return type


mentat.reports.overview.REPORT_SUBJECT = 'Periodical statistical summary report'

Subject for report emails.


Helper function for JSON serialization of non basic data types.