Output Functions: Writing the Data Out

These functions can be imported from the ppc_robot_lib.reporting.output module.

Writing Spreadsheets

write_tables(tables)[source]

Writes collection of tables as a spreadsheet (Excel), or writes them to external service (Google Sheets). It prepares all the data, loads previously stored state, and delegates the output process to a specified adapter.

After the adapter completes (or fails with an exception), state is stored for further use for the current job.

This function can be called multiple times in a single report. You can

Parameters:

tables (list[Table]) – List of tables to output. See ppc_robot_lib.utils.types.Table for more details.

Return type:

None

Notifications

emit_notification(data: dict | str | NotificationData | NotificationException | type[NotificationException] | Callable[[...], NotificationException], *, text: str | None = None, code: int | None = None, category: int | None = None, score: int | None = None, text_plural: str | None = None, text_localized: bool | None = None, text_number: int | None = None, text_params: dict[str, Any] | list[Any] | None = None, level: NotificationLevel | None = None, details_table: DataFrame | None = None, entity_id_column: str | None = None)

In current task context emit a Notification.

Note: Use aliases: emit_error_notification, emit_warning_notification and emit_info_notification, which explicitly defines notification level.

emit_custom_notifications(table, notifications, filter_factory)[source]

Emits notifications specified by the user via the UI.

Each notification has a condition that must be met in order to emit the notification.

Parameters:
  • table (DataFrame) – Data Frame that will be queries in the conditions.

  • notifications (list[dict[str, Any]]) – List of user-defined notifications.

  • filter_factory – Filter factory that will be used to perform in-memory filtering when checking whether the conditions are met.

Return type:

list[Notification]

Returns: