データセット概要
説明
データセットコンポーネントは、TV Python API(アナライザーAPI)サービスを通じて分析とレポートに使用されるデータセットの作成と監視を管理します。このコンポーネントは、コンソールデータベース(gb_console)から商品、カテゴリ、検索クエリデータを処理し、外部APIサービスに構造化されたリクエストを送信し、生成ステータスを監視します。結果として得られるデータセットは、アクティブなサブスクリプションを持つウィッシュリストグループのトレンド分析、パターン認識、特定の視点生成を可能にします。
システム概要図
---
config:
theme: base
layout: dagre
flowchart:
curve: linear
htmlLabels: true
themeVariables:
edgeLabelBackground: "transparent"
---
flowchart TB
%% Main database tables as separate entities
WishlistDB[(gb_console.wishlist_to_groups)]
DatasetHistoryDB[(gb_console.wishlist_dataset_histories)]
DatasetLogsDB[(gb_console.wishlist_dataset_creation_logs)]
PythonAPI((TV Python API))
subgraph Commands
CreateDatasetCmd[dataset:create]
GetStatusCmd[dataset:get-status]
end
subgraph ConsoleTables["コンソールデータベーステーブル"]
direction TB
subgraph SummaryTables
direction LR
WishlistSearchProducts[summary_wishlist_products]
WishlistCategories[summary_wishlist_categories]
WishlistSearchQueries[summary_wishlist_search_queries]
end
subgraph ViewpointTables
direction LR
WishlistSpecificVP[wl_spec_vps]
WishlistCategoryVP[wl_cat_vps]
end
end
subgraph AnalyzerTables["アナライザーデータベーステーブル"]
direction TB
subgraph ProductTables
direction LR
Products[products]
ReviewSentences[review_sentences]
end
subgraph CategoryTables
direction LR
CategoryRankings[category_rankings]
ProductCategoryRankings[product_category_rankings]
end
subgraph SearchTables
direction LR
SearchQueryRankings[search_query_rankings]
ProductSearchQueryRankings[product_search_query_rankings]
end
end
CreateDatasetCmd --- CreateDatasetCmdStep1A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>1A</span>
<p style='margin-top: 8px'>対象ウィッシュリスト取得</p>
</div>
]
CreateDatasetCmdStep1A --> WishlistDB
CreateDatasetCmd --- CreateDatasetCmdStep2A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>2A</span>
<p style='margin-top: 8px'>ランキングデータ取得</p>
</div>
]
CreateDatasetCmdStep2A --> AnalyzerTables
CreateDatasetCmd --- CreateDatasetCmdStep3A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3A</span>
<p style='margin-top: 8px'>データセットリクエスト送信</p>
</div>
]
CreateDatasetCmdStep3A --> PythonAPI
CreateDatasetCmd --- CreateDatasetCmdStep4A[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4A</span>
<p style='margin-top: 8px'>データセットID保存</p>
</div>
]
CreateDatasetCmdStep4A --> DatasetHistoryDB
GetStatusCmd --- GetStatusCmdStep1B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>1B</span>
<p style='margin-top: 8px'>保留中データセット取得</p>
</div>
]
GetStatusCmdStep1B --> DatasetHistoryDB
GetStatusCmd --- GetStatusCmdStep2B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>2B</span>
<p style='margin-top: 8px'>ステータス確認</p>
</div>
]
GetStatusCmdStep2B --> PythonAPI
GetStatusCmd --- GetStatusCmdStep3B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3B</span>
<p style='margin-top: 8px'>ステータス更新</p>
</div>
]
GetStatusCmdStep3B --> DatasetHistoryDB
GetStatusCmd --- GetStatusCmdStep4B[
<div style='text-align: center'>
<span style='display: inline-block; background-color: #99cc66 !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4B</span>
<p style='margin-top: 8px'>イベントログ</p>
</div>
]
GetStatusCmdStep4B --> DatasetLogsDB
%% Main relationships
WishlistDB -.-> DatasetHistoryDB
WishlistDB -.-> ConsoleTables
DatasetHistoryDB -.-> DatasetLogsDB
%% Relationship to analyzer data
ConsoleTables -.-> AnalyzerTables
%% Database prefixes in label text
classDef consoleLabel text-anchor:start,fill:#fcf3d2
classDef analyzerLabel text-anchor:start,fill:#d2e3fc
class ConsoleTables consoleLabel
class AnalyzerTables analyzerLabel
style WishlistDB fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
style DatasetHistoryDB fill:#d9f2d9,stroke:#339933,stroke-width:1px
style DatasetLogsDB fill:#d9f2d9,stroke:#339933,stroke-width:1px
style PythonAPI fill:#fcd9d9,stroke-width:2px
style CreateDatasetCmd fill:#d9f2d9
style GetStatusCmd fill:#d9f2d9
style ConsoleTables fill:#fcf3d2
style AnalyzerTables fill:#d2e3fc
style Commands fill:#f9f9f9
style SummaryTables fill:#fff9db
style ViewpointTables fill:#fff9db
style ProductTables fill:#e6f0ff
style CategoryTables fill:#e6f0ff
style SearchTables fill:#e6f0ff
style CreateDatasetCmdStep1A fill:transparent,stroke:transparent,stroke-width:1px
style CreateDatasetCmdStep2A fill:transparent,stroke:transparent,stroke-width:1px
style CreateDatasetCmdStep3A fill:transparent,stroke:transparent,stroke-width:1px
style CreateDatasetCmdStep4A fill:transparent,stroke:transparent,stroke-width:1px
style GetStatusCmdStep1B fill:transparent,stroke:transparent,stroke-width:1px
style GetStatusCmdStep2B fill:transparent,stroke:transparent,stroke-width:1px
style GetStatusCmdStep3B fill:transparent,stroke:transparent,stroke-width:1px
style GetStatusCmdStep4B fill:transparent,stroke:transparent,stroke-width:1px
データベーススキーマ
コンソールデータベーステーブル(gb_console)
erDiagram
wishlist_to_groups {
bigint id PK
bigint subscription_id FK "サブスクリプションテーブルへの外部キー(適格性チェックに使用)"
string name "ウィッシュリストグループの名前(データセット命名とログに使用)"
string slug "URL対応識別子(特定ウィッシュリスト処理に使用)"
tinyint training_schedule "トレーニングスケジュール列挙値(手動vs自動処理に使用)"
timestamp manual_request_dataset_at "手動データセットリクエストタイムスタンプ(手動処理タイミングに使用)"
integer status "アクティブまたは非アクティブステータス(buildWishlistQueryでフィルタリング)"
tinyint admin_status "管理者承認ステータス(buildWishlistQueryでフィルタリング)"
text error_message "失敗した操作のエラーメッセージ(検証失敗時に更新)"
timestamp created_at
timestamp updated_at
timestamp deleted_at "ソフト削除タイムスタンプ(buildWishlistQueryでフィルタリング)"
}
wishlist_dataset_histories {
bigint id PK
bigint wishlist_to_group_id FK "wishlist_to_groupsへの外部キー(データセット追跡に使用)"
string dataset_id "TV Python APIからのデータセットID(ステータスチェックに使用)"
integer status "データセットステータス列挙値(get-statusコマンドによって更新)"
text error_message "失敗したデータセットのエラーメッセージ(失敗時に更新)"
json config "データセット作成に使用された設定(バッチジョブ用のproduct_idsを保存)"
boolean batch_job_created "バッチジョブが作成されたかどうか(完了後に更新)"
string batch_job_id "バッチジョブ識別子(バッチジョブ作成後に更新)"
timestamp created_at "スケジュール間隔計算に使用"
timestamp updated_at
}
wishlist_dataset_creation_logs {
bigint id PK
string wishlist_to_group_name "ウィッシュリストグループの名前(ログ用にコピー)"
bigint wishlist_to_group_id FK "wishlist_to_groupsへの外部キー(イベント追跡に使用)"
bigint wishlist_dataset_history_id FK "wishlist_dataset_historiesへの外部キー(イベントリンクに使用)"
string event_type "イベントタイプ列挙値(request、success、failure)"
json data "イベントデータ(リクエスト/レスポンスペイロードを保存)"
text message "イベントメッセージ(エラー詳細を保存)"
timestamp created_at
timestamp updated_at
}
summary_wishlist_products {
bigint id PK
bigint wishlist_to_group_id FK "wishlist_to_groupsへの外部キー(データ収集に使用)"
string input "商品の入力(商品ID抽出に使用)"
string input_type "入力のタイプ:jan、asin、rakuten_id(商品マッチングに使用)"
integer mall_id "mallsテーブルへの外部キー(商品フィルタリングに使用)"
integer crawl_status "クロールのステータス(成功検証に使用)"
timestamp updated_at "時間制約検証に使用"
}
summary_wishlist_categories {
bigint id PK
bigint wishlist_to_group_id FK "wishlist_to_groupsへの外部キー(データ収集に使用)"
string category_id "カテゴリ識別子(ランキングデータ収集に使用)"
integer mall_id "mallsテーブルへの外部キー(カテゴリフィルタリングに使用)"
integer crawl_status "クロールのステータス(成功検証に使用)"
timestamp updated_at "時間制約検証に使用"
}
summary_wishlist_search_queries {
bigint id PK
bigint wishlist_to_group_id FK "wishlist_to_groupsへの外部キー(データ収集に使用)"
integer mall_id "mallsテーブルへの外部キー(検索フィルタリングに使用)"
string keyword "検索キーワード(ランキングデータ収集に使用)"
integer crawl_status "クロールのステータス(成功検証に使用)"
timestamp updated_at "時間制約検証に使用"
}
wl_spec_vps {
bigint id PK
bigint wishlist_id "ウィッシュリストへの外部キー(視点関連付けに使用)"
string name "視点名(バッチジョブ作成に使用)"
text description "視点説明(設定に使用)"
timestamp created_at
timestamp updated_at
}
wl_cat_vps {
bigint id PK
bigint wishlist_category_id "ウィッシュリストカテゴリへの外部キー(視点リンクに使用)"
bigint wishlist_id "ウィッシュリストへの外部キー(視点関連付けに使用)"
timestamp created_at
timestamp updated_at
}
wishlist_to_groups ||--o{ wishlist_dataset_histories : "has many"
wishlist_to_groups ||--o{ wishlist_dataset_creation_logs : "has many"
wishlist_dataset_histories ||--o{ wishlist_dataset_creation_logs : "has many"
wishlist_to_groups ||--o{ summary_wishlist_products : "has many"
wishlist_to_groups ||--o{ summary_wishlist_categories : "has many"
wishlist_to_groups ||--o{ summary_wishlist_search_queries : "has many"
アナライザーデータベーステーブル(gb_analyzer)
erDiagram
products {
bigint id PK
integer mall_id "モール識別子(データセット収集での商品フィルタリングに使用)"
string mall_product_id "モールからの商品ID(ランキングデータ収集に使用)"
string jan_code "JANコード(商品ID拡張に使用)"
string input_type "入力タイプ:asin、jan、rakuten_id(商品マッチングに使用)"
string unique_key "一意識別子(商品重複排除に使用)"
timestamp created_at
timestamp updated_at
timestamp crawl_created_at "商品がクロールされた時刻(時間制約に使用)"
}
category_rankings {
bigint id PK
string mall_category_id "モールからのカテゴリID(カテゴリランキング収集に使用)"
integer mall_id "モール識別子(カテゴリフィルタリングに使用)"
string unique_key "一意識別子(カテゴリ重複排除に使用)"
timestamp crawl_created_at "カテゴリがクロールされた時刻(最新データ選択に使用)"
timestamp created_at
timestamp updated_at
}
product_category_rankings {
bigint id PK
bigint category_ranking_id FK "category_rankingsへの外部キー(ランキングデータ収集に使用)"
string mall_product_id "モールからの商品ID(商品ランキング収集に使用)"
tinyint mall_id "モール識別子(ランキングフィルタリングに使用)"
timestamp crawl_created_at "ランキングがクロールされた時刻(最新データ選択に使用)"
timestamp created_at
timestamp updated_at
}
search_query_rankings {
bigint id PK
string keyword "検索キーワード(検索ランキング収集に使用)"
timestamp crawl_created_at "検索クエリがクロールされた時刻(最新データ選択に使用)"
timestamp created_at
timestamp updated_at
}
product_search_query_rankings {
bigint id PK
bigint search_query_ranking_id FK "search_query_rankingsへの外部キー(ランキングデータ収集に使用)"
string mall_product_id "モールからの商品ID(商品ランキング収集に使用)"
tinyint mall_id "モール識別子(ランキングフィルタリングに使用)"
timestamp crawl_created_at "ランキングがクロールされた時刻(最新データ選択に使用)"
timestamp created_at
timestamp updated_at
}
review_sentences {
bigint id PK
string mall_product_id "モールからの商品ID(レビュー文検証に使用)"
text content "レビューから抽出された文内容(データセット検証に使用)"
timestamp created_at
timestamp updated_at
}
category_rankings ||--o{ product_category_rankings : "has many"
search_query_rankings ||--o{ product_search_query_rankings : "has many"
データセットコマンドロジックフィールド
データセット作成コマンドで使用されるフィールド:
ウィッシュリスト適格性フィルタリング:
wishlist_to_groups.id- データセット関連付けの主キーwishlist_to_groups.subscription_id- アクティブサブスクリプションとの結合に使用wishlist_to_groups.status- アクティブステータスでフィルタリングwishlist_to_groups.admin_status- アクティブ管理者ステータスでフィルタリングwishlist_to_groups.training_schedule- 手動vs自動処理ロジックに使用wishlist_to_groups.manual_request_dataset_at- 手動処理タイミングに使用wishlist_to_groups.name- データセット命名とログに使用wishlist_to_groups.slug- 特定ウィッシュリスト処理に使用wishlist_to_groups.deleted_at- 削除されていないレコードでフィルタリング
データ収集と検証:
summary_wishlist_products.input、input_type、mall_id- 商品ID抽出に使用summary_wishlist_categories.category_id、mall_id- カテゴリランキング収集に使用summary_wishlist_search_queries.keyword、mall_id- 検索ランキング収集に使用summary_*.crawl_status- 成功数検証に使用summary_*.updated_at- 時間制約検証に使用
データセット作成:
wishlist_dataset_histories.wishlist_to_group_id- データセットをウィッシュリストにリンクwishlist_dataset_histories.dataset_id- APIレスポンスデータセットIDを保存wishlist_dataset_histories.status- 初期データセットステータスを保存wishlist_dataset_histories.config- データセット設定を保存wishlist_dataset_histories.created_at- スケジュール間隔計算に使用
データセットget-statusコマンドで使用されるフィールド:
ステータス監視:
wishlist_dataset_histories.id- 更新の主キーwishlist_dataset_histories.dataset_id- APIステータスクエリに使用wishlist_dataset_histories.status- APIからの新しいステータスで更新wishlist_dataset_histories.wishlist_to_group_id- ログと通知に使用wishlist_dataset_histories.batch_job_created- バッチジョブ作成時に更新wishlist_dataset_histories.batch_job_id- バッチジョブ識別子を保存wishlist_dataset_histories.config- バッチジョブ用のproduct_ids抽出に使用wishlist_dataset_histories.error_message- 失敗時に更新
バッチジョブ作成:
wl_spec_vps- 特定視点バッチジョブ作成に使用wl_cat_vps- カテゴリ視点関連付けに使用
API統合
システムはTV Python API(アナライザーAPI)サービスと統合します:
- AnalyzerApiService: API通信用のサービスクラス
- データセット作成エンドポイント: 構造化データを受け入れ、データセットIDを返す
- ステータスチェックエンドポイント: データセット処理の現在のステータスを提供
- エラーハンドリング: API失敗とリトライロジックを管理
- 設定: API設定に
config/analyzer_api.phpを使用
頻度概要
タイムライン
timeline
title データセット操作スケジュール
section 作成プロセス
30分毎<br>(例:08.00、08.30など) : dataset create
section ステータス監視
5分毎<br>(例:08.00、08.05など) : dataset get-status
期待される結果
これらのコマンドが正常に実行されると、システムは以下を提供します:
- 自動データセット生成: サブスクリプションを持つアクティブなウィッシュリストグループの定期的なデータセット作成により、分析用の継続的なデータ可用性を確保
- 包括的データ統合: 複数のデータベースソースからの商品ランキング、カテゴリデータ、検索クエリ結果、視点情報のシームレスな集約
- 外部APIオーケストレーション: リクエスト形式、レスポンス処理、エラー回復メカニズムを含むTV Python APIサービスとの信頼性の高い通信
- ステータス追跡と監視: 保留中から分析中、完了/失敗状態へのステータス遷移を含むデータセット作成進捗のリアルタイム監視
- 監査証跡管理: トラブルシューティングとコンプライアンスのための作成イベント、ステータス変更、エラー条件を含むデータセット操作の完全なログ
- 通知システム統合: 管理者向けのSlackによる自動アラートと、データセット完了または失敗時のエンドユーザー向けのPusherによるリアルタイム更新
- サブスクリプションベース処理: アクティブなサブスクリプションと適切な設定を持つ適格なウィッシュリストのみを処理するインテリジェントフィルタリング
- データ品質保証: 意味のある分析結果を確保するためのデータセット作成前の最小閾値とデータ可用性の検証
バッチリスト
| 名前 | 説明 |
|---|---|
| データセット作成 | 30分毎に実行され、適格なウィッシュリストグループを特定し、分析済みデータを収集し、TV Python APIにデータセット作成リクエストを送信するコマンド |
| データセットステータス取得 | 5分毎に実行され、保留中のデータセット生成プロセスを監視し、ステータスレコードを更新し、完了通知をトリガーするコマンド |