m3resp.QualityFlag#

class m3resp.QualityFlag(name, passed, severity, modality=None, category=None, signal_name=None, breath_id=None, breath_ids=None, start_time=None, end_time=None, message=None, value=None, threshold=None, metadata=<factory>)[source]#

The outcome of one quality check against a signal, breath, or run.

A flag covers the whole signal by default. To represent a signal that’s only bad for part of its duration (e.g. good except for a noisy period in the middle), emit one QualityFlag per affected window with start_time/end_time set, rather than a single flag for the whole signal - signal_name ties them all back to the same signal.

A flag about one breath sets breath_id. A flag about several breaths judged together (for example ten breaths marked as a stable stretch, or a set of breaths with gaps between them) sets breath_ids. Set one or the other; setting both, or an empty breath_ids list, raises ValueError. The per-breath steps use the breath’s zero-based position in its breath list as the id ("0", "1", …), the same as for ParameterResult.breath_id.

Methods

to_dict

JSON-serializable representation, one key per field in field order.

Attributes

Parameters:
  • name (str)

  • passed (bool)

  • severity (Literal['info', 'warning', 'error', 'critical'])

  • modality (str | None)

  • category (str | None)

  • signal_name (str | None)

  • breath_id (str | None)

  • breath_ids (list[str] | None)

  • start_time (float | None)

  • end_time (float | None)

  • message (str | None)

  • value (float | None)

  • threshold (float | None)

  • metadata (dict[str, Any])

breath_id: str | None = None#
breath_ids: list[str] | None = None#
category: str | None = None#
end_time: float | None = None#
message: str | None = None#
metadata: dict[str, Any]#
modality: str | None = None#
name: str#
passed: bool#
severity: Literal['info', 'warning', 'error', 'critical']#
signal_name: str | None = None#
start_time: float | None = None#
threshold: float | None = None#
to_dict()[source]#

JSON-serializable representation, one key per field in field order.

breath_ids and metadata are copies, so changing the result leaves the flag unchanged.

Return type:

dict[str, Any]

value: float | None = None#

Tutorials that use QualityFlag#

Process an EMG recording

Process an EMG recording