mozanalysis.exposure

class mozanalysis.exposure.ExposureSignal(name: str, data_source: DataSource, select_expr: str, friendly_name: str | None = None, description: str | None = None, window_start: str | None = None, window_end: str | None = None)[source]

Represents a signal that determines an exposure has happened.

The optional window_start and window_end parameters define the window of data used to determine whether each client has been exposed. window_start and window_end are integers, representing the number of days before or after the first enrollment date. If window_start is set to None, then by default the first enrollment date is used. If window_end is set to None, then by default the last enrollment date is used.

Parameters:
  • name (str) – A slug; uniquely identifies this exposure signal in tables

  • data_source (DataSource) – data source to query from

  • select_expr (str) – a SQL snippet representing a clause of a SELECT expression describing how to compute the exposure signal; must be a boolean condition

  • friendly_name (str) – A human-readable dashboard title for this exposure signal

  • description (str) – A paragraph of Markdown-formatted text describing what the exposure signal represents, to be shown on dashboards

  • window_start (int) – Optional, see above

  • window_end (int) – Optional, see above

build_query(time_limits, analysis_unit: AnalysisUnit = AnalysisUnit.CLIENT)[source]

Return a nearly self-contained query for determining exposures.

This query does not define enrollments but otherwise could be executed to query all exposures based on the exposure metric from this data source.