---
sidebar:
  hidden: true
title: roboto.domain.topics.mcap_topic_reader
---
## Module Contents

### McapTopicReader

```python
class roboto.domain.topics.mcap_topic_reader.McapTopicReader(
    roboto_client: Optional[roboto.http.RobotoClient] = None,
    signed_url_resolver: Optional[SignedUrlResolver] = None,
)
```

`from roboto.domain.topics.mcap_topic_reader import McapTopicReader`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/topics/mcap_topic_reader.py#L48-L197)

Bases: [`roboto.domain.topics.topic_reader.TopicReader`](/reference/python-sdk/roboto/domain/topics/topic_reader#roboto.domain.topics.topic_reader.TopicReader)

Private interface for retrieving topic data stored in MCAP files.

Uses HTTP Range requests to efficiently fetch only required chunks from remote storage, avoiding full file downloads.

> **Note**
>
> This is not intended as a public API. To access topic data, prefer the `get_data` or `get_data_as_df` methods on [`Topic`](/reference/python-sdk/roboto/domain/topics/topic#roboto.domain.topics.topic.Topic), [`MessagePath`](/reference/python-sdk/roboto/domain/topics/message_path#roboto.domain.topics.message_path.MessagePath), or [`Event`](/reference/python-sdk/roboto/domain/events/event#roboto.domain.events.event.Event).

**Parameters**

- **roboto_client** (`Optional[roboto.http.RobotoClient]`)
- **signed_url_resolver** (`Optional[SignedUrlResolver]`)

#### McapTopicReader.accepts()

```python
@staticmethod
def accepts(
    message_paths_to_representations: collections.abc.Iterable[roboto.domain.topics.record.MessagePathRepresentationMapping],
) -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/topics/mcap_topic_reader.py#L64-L70)

**Parameters**

- **message_paths_to_representations** (`collections.abc.Iterable[roboto.domain.topics.record.MessagePathRepresentationMapping]`)

**Returns**

- `bool`

#### McapTopicReader.get_data()

```python
def get_data(
    message_paths_to_representations: collections.abc.Iterable[roboto.domain.topics.record.MessagePathRepresentationMapping],
    start_time: Optional[int] = None,
    end_time: Optional[int] = None,
    timestamp_message_path_representation_mapping: Optional[roboto.domain.topics.record.MessagePathRepresentationMapping] = None,
    topic_name: Optional[str] = None,
) -> collections.abc.Generator[tuple[roboto.domain.topics.topic_reader.Timestamp, dict[str, Any]], None, None]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/topics/mcap_topic_reader.py#L95-L177)

Yield `(log_time, record)` pairs from the mappings' MCAP files in log-time order.

Each record merges the projected fields of one message from every file whose next message has that log time.

**Parameters**

- **message_paths_to_representations** (`collections.abc.Iterable[roboto.domain.topics.record.MessagePathRepresentationMapping]`): The message paths to read. Each [`MessagePathRepresentationMapping`](/reference/python-sdk/roboto/domain/topics/record#roboto.domain.topics.record.MessagePathRepresentationMapping) pairs message paths with the representation whose associated MCAP file stores them; a mapping whose representation is not associated with a file is skipped.
- **start_time** (`Optional[int]`): Inclusive lower bound on message log time in nanoseconds, or `None` for unbounded.
- **end_time** (`Optional[int]`): Exclusive upper bound on message log time in nanoseconds, or `None` for unbounded.
- **timestamp_message_path_representation_mapping** (`Optional[roboto.domain.topics.record.MessagePathRepresentationMapping]`): Not read; each row's timestamp is the log time of the messages it merges.
- **topic_name** (`Optional[str]`): Read only messages on MCAP channels of this topic, or on every channel when `None`.

**Yields**

- The log time in nanoseconds and the merged record.

**Raises**

- [`RobotoInternalException`](/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInternalException): `topic_name` is given and a file's summary lists no channel on that topic.

**Returns**

- `collections.abc.Generator[tuple[roboto.domain.topics.topic_reader.Timestamp, dict[str, Any]], None, None]`

#### McapTopicReader.get_data_as_df()

```python
def get_data_as_df(
    message_paths_to_representations: collections.abc.Iterable[roboto.domain.topics.record.MessagePathRepresentationMapping],
    start_time: Optional[int] = None,
    end_time: Optional[int] = None,
    timestamp_message_path_representation_mapping: Optional[roboto.domain.topics.record.MessagePathRepresentationMapping] = None,
) -> tuple[pandas.Series, pandas.DataFrame]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/topics/mcap_topic_reader.py#L179-L197)

**Parameters**

- **message_paths_to_representations** (`collections.abc.Iterable[roboto.domain.topics.record.MessagePathRepresentationMapping]`)
- **start_time** (`Optional[int]`)
- **end_time** (`Optional[int]`)
- **timestamp_message_path_representation_mapping** (`Optional[roboto.domain.topics.record.MessagePathRepresentationMapping]`)

**Returns**

- `tuple[pandas.Series, pandas.DataFrame]`

### RobotoClientUrlResolver

```python
class roboto.domain.topics.mcap_topic_reader.RobotoClientUrlResolver(
    roboto_client: roboto.http.RobotoClient,
)
```

`from roboto.domain.topics.mcap_topic_reader import RobotoClientUrlResolver`

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

A [`SignedUrlResolver`](/reference/python-sdk/roboto/domain/topics/mcap_topic_reader#roboto.domain.topics.mcap_topic_reader.SignedUrlResolver) that fetches signed URLs via the Roboto API.

**Parameters**

- **roboto_client** (`roboto.http.RobotoClient`)

### SignedUrlResolver

```python
class roboto.domain.topics.mcap_topic_reader.SignedUrlResolver
```

`from roboto.domain.topics.mcap_topic_reader import SignedUrlResolver`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/topics/mcap_topic_reader.py#L31-L34)

Bases: `Protocol`

Resolves a file ID to a signed download URL.

### logger

```python
roboto.domain.topics.mcap_topic_reader.logger
```

`from roboto.domain.topics.mcap_topic_reader import logger`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/topics/mcap_topic_reader.py#L28-L28)
