# Query Events

## QueryとFilter Events

Vision Eventsダッシュボードのフィルターを使って特定のイベントを見つけるか、REST API経由でプログラム的にクエリできます。

### ダッシュボードでEventsを閲覧する

#### Use Caseを選択する

Vision Eventsページから、Use Caseをクリックしてそのイベントを表示します。イベントは時系列の逆順で表示されます。

<figure><img src="/files/7edb5cb53e115468c51a739a7d680c3decb80316" alt="" width="375"><figcaption></figcaption></figure>

#### Eventsをフィルタリングする

結果を絞り込むには、イベント一覧上部のフィルターコントロールを使用します：

* **日付範囲** — 開始と終了のタイムスタンプ
* **イベントタイプ** — quality\_check、inventory\_count、safety\_alert、custom、operator\_feedback
* **デバイス** — device IDでフィルター
* **Stream** — streamまたはcamera IDでフィルター
* **Workflow** — イベントを生成したWorkflowでフィルター
* **Detection class** — 特定の検出オブジェクトクラスでフィルター
* **Feedback status** — correct、incorrect、inconclusive、または feedbackなし
* **カスタムメタデータ** — 任意のカスタムメタデータのフィールドと値でフィルター
* **警告** — ingestion warnings があったイベントのみを表示

イベント詳細サイドバー内の値（device ID、stream、quality check result、custom metadata valuesなど）をクリックして、すばやくフィルターとして追加することもできます。

Filter chipsは編集可能です -- アクティブなfilter chipをクリックすると、削除して再追加しなくても値や演算子を変更できます。

フィルターを適用すると、 **合計件数** 一致するイベント数が結果一覧の上部に表示されます。この件数はイベント一覧とは独立して更新されるため、イベントの読み込み中でもフィルターに一致するイベント数を確認できます。

<figure><img src="/files/00d41330baaf4b32a4e1b3531b87a99a9d4be841" alt="" width="375"><figcaption></figcaption></figure>

#### イベント詳細を表示する

一覧内の任意のイベントをクリックして、完全な詳細を表示します：

* 元画像と出力画像
* すべてのソースメタデータ（device、stream、workflow）
* イベントタイプ固有のデータ（例：pass/fail結果、item count、alert severity）
* カスタムメタデータのキーと値のペア

**検出結果を描画する**

イベントに予測データ（object detections、instance segmentations、keypoints）が含まれる場合、画像の上に "Draw Detections" チェックボックスが表示されます。これを有効にすると、source imageの上にbounding boxes、segmentation polygons、confidence scores付きのラベルを重ねて表示できます。

これは、pipelineが元の入力画像だけを保存し、別の出力画像を保存せずにモデルが何を検出したかを可視化したい場合に便利です。

{% hint style="info" %}
別の出力画像を表示している場合は、その画像にはすでに検出結果が描画されているため、チェックボックスは表示されません。
{% endhint %}

<figure><img src="/files/68984c606cb473cb3005f91bd32311838144a763" alt="" width="375"><figcaption></figcaption></figure>

### API経由でEventsをクエリする

query endpointは、ダッシュボードと同じフィルターに加えて、cursorベースのページネーションをサポートしています。パラメータとレスポンスフィールドの完全な一覧については、 [Vision Events API Reference](https://docs.roboflow.com/developer/rest-api/vision-events).

#### 基本クエリ

```bash
curl -X POST "https://api.roboflow.com/vision-events/query" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "useCaseId": "assembly-line-qa",
    "startTime": "2026-03-01T00:00:00Z",
    "endTime": "2026-03-31T23:59:59Z",
    "limit": 25
  }'
```

**レスポンス：**

```json
{
  "events": [
    {
      "eventId": "evt-789ghi",
      "eventType": "quality_check",
      "timestamp": "2026-03-30T14:30:00.000Z",
      "deviceId": "factory-cam-01",
      "streamId": "line-3",
      "images": [],
      "eventData": { "result": "fail" },
      "customMetadata": {
        "line_id": "line-3",
        "shift": "morning",
        "part_number": "PN-4421"
      }
    }
  ],
  "nextCursor": "eyJ0cyI6IjIwMjYtMDMtMzAifQ==",
  "hasMore": true
}
```

#### ページネーション

結果はcursorを使ってページ分割されます。レスポンスに `nextCursor` の値が含まれ、 `hasMore` が `true`の場合は、次のリクエストでcursorを渡して次のページを取得します：

```bash
curl -X POST "https://api.roboflow.com/vision-events/query" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "useCaseId": "assembly-line-qa",
    "limit": 25,
    "cursor": "eyJ0cyI6IjIwMjYtMDMtMzAifQ=="
  }'
```

続けて、 `hasMore` が `false`.

#### イベントタイプでフィルター

単一のイベントタイプをクエリします：

```json
{
  "useCaseId": "assembly-line-qa",
  "eventType": "quality_check"
}
```

または複数のイベントタイプ（最大20件）：

```json
{
  "useCaseId": "assembly-line-qa",
  "eventTypes": ["quality_check", "operator_feedback"]
}
```

#### Feedback statusでフィルター

を使用します `feedbackStatus` オペレーターがレビューしたかどうか、またどのように評価されたかに基づいてイベントを見つけます：

```json
{
  "useCaseId": "assembly-line-qa",
  "feedbackStatus": ["incorrect", "none"]
}
```

有効な値： `correct`, `incorrect`, `inconclusive`, `none`。 `none` を使用して、まだレビューされていないイベントを見つけます。

#### カスタムメタデータでフィルター

を使用します `customMetadataFilters` を使って、独自のメタデータフィールドでイベントをフィルターします：

```json
{
  "useCaseId": "assembly-line-qa",
  "customMetadataFilters": [
    { "key": "line_id", "operator": "eq", "value": "line-3" },
    { "key": "shift", "operator": "eq", "value": "morning" }
  ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-jp/deploy/vision-events/query-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
