Use Case
Use Case を使って目的ごとに Vision Event をグループ化します。
概要
ユースケースをグループ化する Vision Events 共通の目的とカスタムメタデータ構造を共有し、すべてのイベントがちょうど1つのユースケースに属します。イベントをこのように整理すると、同じフィールドを報告するカメラ、デバイス、ロケーション間でデータを簡単にフィルタリングし、比較できます。
異なるロケーション、カメラ、デバイスから来ていても、カスタムメタデータフィールドを共有している場合は、イベントを同じユースケースに入れてください。たとえば、「Defect Detection」ユースケースには、複数の工場からのイベントが届く可能性があり、すべてに line_id, shift、そして part_numberが含まれます。メタデータ構造が異なる場合は、別々のユースケースを作成してください:
Assembly Line QA:
line_id,shift,part_numberWarehouse Inventory:
aisle,shelf,item_typeConstruction Site Safety:
zone,alert_type,contractor
イベントが到着すると、Roboflow は、検出したフィールドと値の型からカスタムメタデータスキーマを推論します。表示するには、次を呼び出します カスタムメタデータスキーマを取得.
この Roboflow Agent Roboflow Agent は、Vision Events を使ってワークフローを構築するときにユースケースを作成します。条件に合う既存のユースケースがあれば、それを再利用します。セットアップするよう依頼することもできます。
ユースケースをアーカイブすると、既定の表示から非表示になります。イベントは保持され、アーカイブ解除できます。アーカイブされたユースケースに送信されたイベントは保存され続けますが、各イベントに警告が返されます。
イベント値
ユースケースの価値を追跡するために、イベントに金額を設定できます(例: 検出された各不良のコスト)。ユースケースに既定の値と通貨を設定してください。独自の値を送信しない新しいイベントには既定値が適用され、すでに送信済みのイベントはその値のまま保持されます。
イベントは、次の中で独自の値を送信することもできます valueBaseUnits (参照 Vision Event の作成)。値は常にユースケースの通貨で表されます。値の合計は約5分ごとに更新されます。
Webアプリ
左側のサイドバーで「Vision Events」を開き、「+ ユースケースを作成」をクリックします。

ユースケース一覧には、各ユースケースのイベント数、最後のイベント時刻、イベントタイプ、および累計価値が表示されます。ユースケースの概要では、「Value Created」タイルにその価値が表示されます。
既定の イベント値を設定するには、ユースケースのメニューを開き、「設定を更新」をクリックし、「Default Event Value」と「Currency」に入力します。
ダッシュボードからユースケースをアーカイブできます。表の下部にある「アーカイブ済みのユースケースを表示」をクリックすると、アーカイブ済みのものを確認できます。

HTTP API
制限なしの Workspace API キーには、既定で vision-events:manage スコープが付与されています。
ユースケースを作成
ワークスペースに新しいユースケースを作成します。ユースケースは、展開コンテキスト(例: 「Manufacturing Line 1」、「Warehouse Inventory」)ごとに Vision Events を整理するのに役立ちます。
必須スコープ: vision-events:manage
Create a new use case in your workspace. It starts active. Requires the vision-events:manage scope.
Roboflow API key passed as a Bearer token.
A name for the use case. Leading and trailing spaces are trimmed. Must be unique within the workspace.
Value given to new events that don't send valueBaseUnits, in the smallest unit of the currency (ex: cents for USD).
5000Three-letter currency code for event values (ex: USD, EUR, JPY), in any case. Defaults to USD. An unsupported code returns 400.
USDUse case created successfully.
Use this as useCaseId when you create events.
name is missing or too long, a default value field is invalid, or another use case already has this name.
Insufficient permissions for this resource.
POST /vision-events/use-cases HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 31
{
"name": "Manufacturing Line 1"
}{
"id": "a1b3c8e1",
"name": "Manufacturing Line 1"
}注意
新しいユースケースは、既定で
アクティブステータスで作成されます。ユースケースを作成した後、その
idをuseCaseIdとして Vision Events を作成するときに.
ユースケースを更新
既存のユースケースの名前、ステータス、または既定のイベント値を更新します。
必須スコープ: vision-events:manage
Update the name, status, or default event value of an existing use case. A new default applies only to events created afterward. Requires the vision-events:manage scope.
Roboflow API key passed as a Bearer token.
The ID of the use case to update.
Send at least one field.
A new name for the use case. Must be unique within the workspace.
The new status for the use case.
Value given to new events that don't send valueBaseUnits, in the smallest unit of the currency (ex: cents for USD). null removes the default.
5000Three-letter currency code for event values (ex: USD, EUR, JPY), in any case. Send defaultValueBaseUnits too when changing the currency of a use case that has a default value.
USDUse case updated successfully.
The default event value after the update. null when unset.
The currency after the update. USD when unset.
No field was sent, a field is invalid, another use case already has this name, or the currency changed without defaultValueBaseUnits on a use case that has a default value.
Insufficient permissions for this resource.
Use case not found.
PUT /vision-events/use-cases/{useCaseId} HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 31
{
"name": "Manufacturing Line 2"
}{
"id": "a1b3c8e1",
"name": "Manufacturing Line 2",
"defaultValueBaseUnits": 5000,
"defaultValueCurrency": "USD"
}ユースケース一覧
ワークスペース内のユースケースを一覧表示します。ユースケースの作成と管理方法については、 ユースケースのドキュメント.
必須スコープ: vision-events:read または device:read
List the use cases in your workspace with the given status, whether or not they have events. Requires the vision-events:read or device:read scope.
Roboflow API key passed as a Bearer token.
Filter by use case status. Use inactive to list archived use cases.
active可能な値: List of use cases.
The workspace's retention window in days (14 by default).
Insufficient permissions for this resource.
GET /vision-events/use-cases HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"useCases": [
{
"id": "a1b3c8e1",
"name": "Manufacturing Line 1",
"status": "active",
"workspaceId": "Xk2mP9qLr4TzW8vN1bYc",
"automationsCount": 1,
"defaultValueBaseUnits": 5000,
"defaultValueCurrency": "USD",
"createdAt": "2024-01-10T08:00:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
},
{
"id": "d4e5f6a7",
"name": "Warehouse Inventory",
"status": "active",
"workspaceId": "Xk2mP9qLr4TzW8vN1bYc",
"automationsCount": 0,
"defaultValueBaseUnits": null,
"defaultValueCurrency": "USD",
"createdAt": "2024-01-12T14:00:00.000Z",
"updatedAt": "2024-01-15T09:00:00.000Z"
}
],
"lookbackDays": 14
}ユースケースをアーカイブ
ユースケースのステータスを inactiveに設定してユースケースをアーカイブします。アーカイブされたユースケースは、既定では一覧から非表示になります。アーカイブされたユースケースに送信されたイベントは保存され続けますが、 entity_not_found の警告が返されます。
必須スコープ: vision-events:manage
Archive a use case by setting its status to inactive. Its events are kept. Events sent to it afterward are still stored, but each returns an entity_not_found warning. Archiving an archived use case succeeds. Requires the vision-events:manage scope.
Roboflow API key passed as a Bearer token.
The ID of the use case to archive.
Use case archived successfully.
Insufficient permissions for this resource.
Use case not found.
POST /vision-events/use-cases/{useCaseId}/archive HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"success": true
}注意
アーカイブはソフト削除です。ユースケースとそのイベントは保持されますが、アクティブな一覧からは非表示になります。
アーカイブ済みのユースケースを表示するには、 ユースケース一覧 エンドポイントを
status=inactive.を指定して使用します。アーカイブ済みのユースケースは、 ユースケースのアーカイブ解除 エンドポイントを使用して復元できます。
ユースケースのアーカイブ解除
ステータスを アクティブ.
必須スコープ: vision-events:manage
Restore a previously archived use case by setting its status back to active. Requires the vision-events:manage scope.
Roboflow API key passed as a Bearer token.
The ID of the use case to unarchive.
Use case unarchived successfully.
Use case is not archived.
Insufficient permissions for this resource.
Use case not found.
POST /vision-events/use-cases/{useCaseId}/unarchive HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"success": true
}注意
アーカイブ済みの
inactiveに戻すことで、以前アーカイブしたユースケースを復元します。アーカイブ解除されると、ユースケースは再びアクティブな一覧に表示され、新しいイベントでは警告が返されなくなります。
Python SDK
各 Vision Event は、ユースケースに関連付けられています。Python SDK には、ユースケースの作成、一覧表示、名前変更、アーカイブ、アーカイブ解除を行うメソッドがあります。
ユースケース一覧
ステータスでフィルタできます:
ユースケースを作成
ユースケースの名前を変更
ユースケースをアーカイブ
ユースケースのアーカイブ解除
ユースケース管理の詳細については、 REST API リファレンス.
MCP Server
AI エージェントを次の MCP Server に接続すると、これらのツールでユースケースを管理できます:
vision_events_use_cases_list
ワークスペース内の Vision Events ユースケースを一覧表示します。
vision_events_use_case_create
新しい Vision Events ユースケースを作成します。
vision_events_use_case_rename
既存のユースケースの名前を変更します。
vision_events_use_case_archive
ユースケースをアーカイブします。
vision_events_use_case_unarchive
以前アーカイブしたユースケースを復元します。
最終更新
役に立ちましたか?