---
sidebar:
  hidden: true
title: roboto.domain.platform_events.catalog
---
## Module Contents

### DATASET_ROOT

```python
roboto.domain.platform_events.catalog.DATASET_ROOT = 'dataset'
```

`from roboto.domain.platform_events import DATASET_ROOT`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L67-L67)

Root of the fields that read the dataset an event is about or happened within.

An action target's `required_inputs` and `additional_inputs` patterns match that dataset's files, so a trigger may set them only when every event it fires for exposes this root.

### DEFAULT_PLATFORM_EVENT_CATALOG

```python
roboto.domain.platform_events.catalog.DEFAULT_PLATFORM_EVENT_CATALOG
```

`from roboto.domain.platform_events import DEFAULT_PLATFORM_EVENT_CATALOG`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L316-L469)

Catalog with a descriptor for every [`PlatformEventType`](/docs/reference/python-sdk/roboto/domain/platform_events/events#roboto.domain.platform_events.events.PlatformEventType).

Roboto uses it to parse each event's payload, and to validate and evaluate triggers wherever no other catalog is given.

### ENVELOPE_ROOT

```python
roboto.domain.platform_events.catalog.ENVELOPE_ROOT = 'envelope'
```

`from roboto.domain.platform_events import ENVELOPE_ROOT`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L47-L47)

Root of the trigger condition and template fields that read the platform event itself.

These fields read the event's `id`, `source`, `subject`, `type`, `time` and `org_id`, and under `data` its payload as published. No descriptor may list this root in `exposed_roots`.

### OncePerProjection

```python
roboto.domain.platform_events.catalog.OncePerProjection
```

`from roboto.domain.platform_events import OncePerProjection`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L37-L37)

Function that reads a platform event, and returns the value a trigger fires once per, such as the dataset's ID.

A projection reads the event's payload and nothing else: one event in, one string out, with no request to Roboto. A `once_per` value can therefore name only what the event itself identifies; there is no "once per file in the dataset this event is about". `once_per` only collapses repeated events into one run of each target; it never fans one event out into several runs, and a trigger runs each of its targets at most once per event.

### PlatformEventCatalog

```python
class roboto.domain.platform_events.catalog.PlatformEventCatalog(
    descriptors: collections.abc.Iterable[PlatformEventDescriptor],
)
```

`from roboto.domain.platform_events import PlatformEventCatalog`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L251-L313)

Set of platform event descriptors, at most one per event type, looked up by type.

Everything that varies by event type, such as the payload model, the roots and the `once_per` values, is on the `PlatformEventDescriptor` registered for it. `DEFAULT_PLATFORM_EVENT_CATALOG` registers every [`PlatformEventType`](/docs/reference/python-sdk/roboto/domain/platform_events/events#roboto.domain.platform_events.events.PlatformEventType); you may build a catalog of a subset. Iterating a catalog yields its descriptors, and `event_type in catalog` tests whether one is registered for `event_type`.

**Parameters**

- **descriptors** (`collections.abc.Iterable[PlatformEventDescriptor]`): Descriptors to register, at most one per event type.

**Raises**

- `ValueError`: Two descriptors share an event type.

#### PlatformEventCatalog.descriptor()

```python
def descriptor(
    event_type: roboto.domain.platform_events.events.PlatformEventType,
) -> PlatformEventDescriptor
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L279-L291)

Return the descriptor for `event_type`.

**Parameters**

- **event_type** (`roboto.domain.platform_events.events.PlatformEventType`): Event type to look up.

**Raises**

- `ValueError`: No descriptor is registered for `event_type`.

**Returns**

- `PlatformEventDescriptor`

#### PlatformEventCatalog.exposed_roots()

```python
def exposed_roots(
    event_type: roboto.domain.platform_events.events.PlatformEventType,
) -> frozenset[str]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L293-L302)

Return the roots `event_type` exposes to trigger conditions and target templates.

**Parameters**

- **event_type** (`roboto.domain.platform_events.events.PlatformEventType`): Event type to look up.

**Raises**

- `ValueError`: No descriptor is registered for `event_type`.

**Returns**

- `frozenset[str]`

#### PlatformEventCatalog.namespace_roots()

```python
def namespace_roots() -> frozenset[str]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L308-L313)

Return every root that at least one registered event type exposes.

**Returns**

- `frozenset[str]`

#### PlatformEventCatalog.subscribable_types()

```python
def subscribable_types() -> frozenset[roboto.domain.platform_events.events.PlatformEventType]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L304-L306)

Return the event types a trigger may subscribe to.

**Returns**

- `frozenset[roboto.domain.platform_events.events.PlatformEventType]`

### PlatformEventDescriptor

```python
class roboto.domain.platform_events.catalog.PlatformEventDescriptor
```

`from roboto.domain.platform_events import PlatformEventDescriptor`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L122-L248)

Description of one platform event type: its payload, the fields triggers can read, and its `once_per` values.

A root is the first segment of a field path in a trigger's condition or target templates, such as `dataset` in `dataset.metadata.vehicle_id`. A descriptor lists the roots its event type exposes and the root a condition field with no root reads from. It also maps each [`OncePer`](/docs/reference/python-sdk/roboto/domain/platform_events/once_per#roboto.domain.platform_events.once_per.OncePer) value the event type supports to a `OncePerProjection`, which computes the value a trigger with that `once_per` fires once per.

**Raises**

- `ValueError`: `default_root` is not in `exposed_roots`, `once_per_projections` has no entry for [`Occurrence`](/docs/reference/python-sdk/roboto/domain/platform_events/once_per#roboto.domain.platform_events.once_per.OncePer.Occurrence), or `exposed_roots` includes a root in `RESERVED_ROOTS`.

**Attributes**

- **PlatformEventDescriptor.default_root** (`str`): Root that a condition field with no root reads from. Always one of `exposed_roots`.

- **PlatformEventDescriptor.event_type** (`roboto.domain.platform_events.events.PlatformEventType`): Event type this descriptor describes.

- **PlatformEventDescriptor.exposed_roots** (`frozenset[str]`): Roots this event type exposes to trigger conditions and target templates.

  Examples are `dataset`, `file` and `changed`.

- **PlatformEventDescriptor.once_per_projections** (`collections.abc.Mapping[roboto.domain.platform_events.once_per.OncePer, OncePerProjection]`): `once_per` values this event type supports, each mapped to its projection.

  A value absent from the keys is unsupported, and every event type supports [`Occurrence`](/docs/reference/python-sdk/roboto/domain/platform_events/once_per#roboto.domain.platform_events.once_per.OncePer.Occurrence).

- **PlatformEventDescriptor.payload_model** (`type[pydantic.BaseModel]`): Pydantic model of [`data`](/docs/reference/python-sdk/roboto/domain/platform_events/events#roboto.domain.platform_events.events.PlatformEvent.data) for this event type.

- **PlatformEventDescriptor.subject_type** (`roboto.uri.RobotoUriType`): Kind of entity this event is about, its CloudEvents `subject`.

  The payload carries that entity's ID under `<subject_type>_id` and may say more about it, such as the version a file was at. The rest of the payload is context around the entity, such as the upload transaction a file arrived in or the metadata changes applied.

- **PlatformEventDescriptor.subscribable** (`bool`) = `True`: Whether a trigger may name this event type in an [`EventSubscription`](/docs/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.EventSubscription).

  `False` for an event Roboto delivers to a single trigger rather than to every subscriber, such as a trigger's schedule reaching one of its minutes. Such an event type still has a descriptor, so its `once_per` values and roots work the same way.

**Properties**

- **PlatformEventDescriptor.supported_once_per** (`frozenset[roboto.domain.platform_events.once_per.OncePer]`): [`OncePer`](/docs/reference/python-sdk/roboto/domain/platform_events/once_per#roboto.domain.platform_events.once_per.OncePer) values this event type supports.

#### PlatformEventDescriptor.idempotency_token()

```python
def idempotency_token(
    event: roboto.domain.platform_events.events.PlatformEvent,
    once_per: roboto.domain.platform_events.once_per.OncePer,
) -> str
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L221-L248)

Return the token that identifies `event` for a trigger that fires once per `once_per`.

A trigger runs each of its targets at most once for all the events that share a token.

**Parameters**

- **event** (`roboto.domain.platform_events.events.PlatformEvent`): Event to compute the token for. Must be of this descriptor's event type.
- **once_per** (`roboto.domain.platform_events.once_per.OncePer`): What the trigger fires once per.

**Returns**

- `str`: Token of the form `<event type>|<once_per>:<value>`, such as `file.uploaded|dataset:ds_12345`.

**Raises**

- `ValueError`: `event` is of another event type, or this event type does not support `once_per`.

#### PlatformEventDescriptor.subject()

```python
def subject(
    event: roboto.domain.platform_events.events.PlatformEvent,
) -> roboto.uri.RobotoUri
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L205-L219)

Return the `roboto://` URI of the entity `event` is about.

**Parameters**

- **event** (`roboto.domain.platform_events.events.PlatformEvent`): Event to name the subject of. Must be of this descriptor's event type.

**Raises**

- `ValueError`: `event` is of another event type.

**Returns**

- `roboto.uri.RobotoUri`

#### PlatformEventDescriptor.supports_once_per()

```python
def supports_once_per(once_per: roboto.domain.platform_events.once_per.OncePer) -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L197-L203)

Return whether this event type supports `once_per`.

**Parameters**

- **once_per** (`roboto.domain.platform_events.once_per.OncePer`): Value to check.

**Returns**

- `bool`

### RESERVED_ROOTS

```python
roboto.domain.platform_events.catalog.RESERVED_ROOTS
```

`from roboto.domain.platform_events import RESERVED_ROOTS`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L60-L60)

Roots Roboto fills in for every event, which no descriptor may list in `exposed_roots`.

They are `ENVELOPE_ROOT` and `TRIGGER_ROOT`. The event or the trigger would hide a descriptor's root of the same name, so a descriptor that lists one in `exposed_roots` raises `ValueError`.

### TRIGGER_ROOT

```python
roboto.domain.platform_events.catalog.TRIGGER_ROOT = 'trigger'
```

`from roboto.domain.platform_events import TRIGGER_ROOT`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L54-L54)

Root of the trigger condition and template fields that read the trigger being evaluated.

No descriptor may list this root in `exposed_roots`.

### event_catalog_manifest()

```python
def roboto.domain.platform_events.catalog.event_catalog_manifest(
    catalog: PlatformEventCatalog = DEFAULT_PLATFORM_EVENT_CATALOG,
) -> dict[str, Any]
```

`from roboto.domain.platform_events import event_catalog_manifest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/platform_events/catalog.py#L476-L497)

Build a JSON-serializable summary of `catalog`, keyed by event type.

`event_catalog.json` in this package holds its output for the default catalog, which the Roboto web app mirrors.

**Parameters**

- **catalog** (`PlatformEventCatalog`): Catalog to summarize. Defaults to `DEFAULT_PLATFORM_EVENT_CATALOG`.

**Returns**

- `dict[str, Any]`: Dictionary that maps each event type to its `roots`, `default_root`, supported `once_per` values, `subject_type`, and whether a trigger may subscribe to it (`subscribable`).
