# CheckDefinition

## class nominal.experimental.compute_as_code.CheckDefinition(title, expression, *, priority, description='', key=None, event_type=None, event_labels=None)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object "(in Python v3.15)")

A reusable failure condition written in the frontend compute language.

Bind channels when adding this definition to a [`ChecklistBuilder`](https://dev.nominal.io/python/ref/generated/nominal.experimental.compute_as_code.ChecklistBuilder.md#nominal.experimental.compute_as_code.ChecklistBuilder "nominal.experimental.compute_as_code.ChecklistBuilder"). Use
`dataclasses.replace` or ordinary Python functions to create variations.

Parameters:
:   - **title** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))

      Display name of the check.
    - **expression** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))

      Source ending in a range expression describing violations. Assignments
      are allowed; omit imports. Convert boolean conditions with `.ranges()`.
    - **priority** ([*Priority*](https://dev.nominal.io/python/ref/generated/nominal.core.Priority.md#nominal.core.Priority "nominal.core._checklist_types.Priority"))

      Severity of violations, from P0 (most severe) to P4.
    - **event_type** ([*EventType*](https://dev.nominal.io/python/ref/generated/nominal.core.EventType.md#nominal.core.EventType "nominal.core._event_types.EventType") *|* *None*)

      Category of generated events. When omitted, the service uses `EventType.ERROR`.
      This does not change the condition or turn absence of matching ranges into success.
      `EventType.UNKNOWN` is not a valid category for creation.
    - **event_labels** ([*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.15)")*[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*]* *|* *None*)

      Labels applied to generated events, not checklist grouping labels.
      When omitted or empty, this check supplies no event labels.
      Labels are copied when the definition is added to a builder.
    - **description** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"))

      Description of the check.
    - **key** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* *None*)

      Optional stable identity, independent of title and source. The same key preserves
      lineage across revisions. Omit to generate an identity each time the check is added.
      Keys are case-sensitive, are not trimmed, and must not be blank or repeated in a builder.

### title: str

### expression: str

### priority: Priority

### description: str = ''

### key: str | None = None

### event_type: EventType | None = None

### event_labels: Sequence[str] | None = None
