比較ツール
概要説明
比較ツール機能により、ユーザーはデータセット内の製品を並べて比較することができます。この機能は、製品属性、パフォーマンス指標、レビューの洞察を表形式で構造化して表示し、類似点と相違点を強調します。比較表は、製品がさまざまな重要な側面でどのように比較されるかを明確に視覚化することで、ユーザーが情報に基づいた意思決定を行うのに役立ちます。
この機能は、競合分析、製品選択、製品の強みと弱みに基づく市場機会の特定に特に価値があります。比較可能な属性を持つ複数の製品を含む有効なデータセットが必要です。
Swagger リンク
API: 比較表 API
ケース文書
ケース1: 比較表(SPVP視点)
説明
Specific Viewpoint(SPVP)に基づいて比較表を生成します。review_sentence_spvp から集計し、各製品のポジティブ/ネガティブ比率を観点ごとに返します。
シーケンス図
sequenceDiagram
participant User
participant API as ProductAnalyzerController
participant Service as SpvpService
participant Repo as WishlistDatasetHistoryRepository
participant DB as Database
Note over User,DB: Step 1: Request SPVP Comparison Table
User->>API: GET /api/v1/general/analyzer/{wldh_slug}/products/comparison (viewpoint_type=SpecificViewpoint)
Note over API,Repo: Step 2: Validate Dataset
API->>Repo: findBySlug(wldh_slug)
Repo-->>API: wishlistDataset
Note over API,Service: Step 3: Aggregate by Specific Viewpoints
API->>Service: getComparitionTableBySpecificViewpoint(wishlistDataset, params)
Service->>DB: Query review_sentence_spvp joined with review_sentences
DB-->>Service: SPVP review data
Note over Service,API: Step 4: Structure Comparison Table
Service-->>API: Formatted comparison table
Note over API,User: Step 5: Return Response
API-->>User: 200 OK (Comparison table data)
ステップ
ステップ1: リクエスト(SPVP)
- 説明: Specific Viewpoint による比較表の生成
- リクエスト:
GET /api/v1/general/analyzer/{wldh_slug}/products/comparison - パラメータ:
- パス:
wldh_slug - クエリ:
viewpoint_type(必須):SpecificViewpointstart_date(必須): YYYY-MM-DDend_date(必須): YYYY-MM-DDmall_product_ids(任意): カンマ区切りの製品IDall_products(任意, boolean, 既定:false):trueの場合、比率に加えて製品ごとのポジティブ/ネガティブ件数(総数)も含めて返却base_product_id(任意)is_noise(任意):true|false
- パス:
ステップ2: データセットの検証
- リポジトリでスラグ検索
ステップ3: 集計(SPVP)
review_sentence_spvpとreview_sentencesを結合- 製品と
viewpoint_ordinal_numberでグループ化 - 製品ごとのポジ/ネガ比率を算出
ステップ4: 構造化(SPVP)
- 出力フィールド:
viewpoint_id,viewpoint_namedata:mall_product_id=>{ positive, negative }
ステップ5: レスポンス
- 例(SPVP, デフォルト=件数なし):
[ { "viewpoint_id": 515, "viewpoint_name": "Price", "data": { "dogparadise:4589602260099": { "positive": "60.0%(30)", "negative": "40.0%(20)" }, "1001000497050103287": { "positive": "55.0%(22)", "negative": "45.0%(18)" } } } ] - 例(SPVP,
all_products=trueの場合):[ { "viewpoint_id": 515, "viewpoint_name": "Price", "data": { "dogparadise:4589602260099": { "positive": { "rate": "60.0%", "count": 30 }, "negative": { "rate": "40.0%", "count": 20 }, "total_count": 50 }, "1001000497050103287": { "positive": { "rate": "55.0%", "count": 22 }, "negative": { "rate": "45.0%", "count": 18 }, "total_count": 40 } } } ]
ケース2: 比較表(AI視点)
説明
AI 視点による比較表を生成します。選択製品に跨いで AI 視点で集計します。
シーケンス図
sequenceDiagram
participant User
participant API as ProductAnalyzerController
participant Service as ProductAnalyzerService
participant Repo as WishlistDatasetHistoryRepository
participant DB as Database
Note over User,DB: Step 1: Request AI Comparison Table
User->>API: GET /api/v1/general/analyzer/{wldh_slug}/products/comparison (viewpoint_type=AiViewpoint)
Note over API,Repo: Step 2: Validate Dataset
API->>Repo: findBySlug(wldh_slug)
Repo-->>API: wishlistDataset
Note over API,Service: Step 3: Aggregate by AI Viewpoints
API->>Service: comparisonTable(request, wishlistDataset)
Service->>DB: Query review_sentence_aivp + review_sentences
DB-->>Service: AI viewpoint review data
Note over Service,API: Step 4: Structure Comparison Table
Service-->>API: Formatted comparison table
Note over API,User: Step 5: Return Response
API-->>User: 200 OK (Comparison table data)
ステップ
ステップ1: リクエスト(AI)
- リクエスト:
GET /api/v1/general/analyzer/{wldh_slug}/products/comparison - パラメータ:
- パス:
wldh_slug - クエリ:
viewpoint_type(必須):AiViewpointstart_date(必須): YYYY-MM-DDend_date(必須): YYYY-MM-DDmall_product_ids(任意)all_products(任意, boolean, 既定:false):trueの場合、比率に加えて製品ごとのポジティブ/ネガティブ件数も含めるis_noise(任意):true|false
- パス:
ステップ2: 集計(AI)
review_sentence_aivpとreview_sentencesを結合- 製品と AI の
viewpoint_idでグループ化 - 製品ごとのポジ/ネガ合計を算出
ステップ3: レスポンス(AI)
- 例(デフォルト=件数なし):
[ { "viewpoint_id": 101, "viewpoint_name": "Delivery", "data": { "dogparadise:4589602260099": { "positive": "62.0%(31)", "negative": "38.0%(19)" } } } ] - 例(
all_products=trueの場合):[ { "viewpoint_id": 101, "viewpoint_name": "Delivery", "data": { "dogparadise:4589602260099": { "positive": { "rate": "62.0%", "count": 31 }, "negative": { "rate": "38.0%", "count": 19 }, "total_count": 50 } } } ]
関連データベーステーブルとフィールド(SPVP)
erDiagram
review_sentences {
bigint id PK
string mall_product_id
double sentiment_score
date post_date
boolean is_noise
}
review_sentence_spvp {
bigint id PK
bigint sentence_id FK
int viewpoint_category_id
int viewpoint_ordinal_number
}
review_sentences ||--o{ review_sentence_spvp : has
関連データベーステーブルとフィールド(AI視点)
erDiagram
review_sentences {
bigint id PK
string mall_product_id
double sentiment_score
date post_date
boolean is_noise
}
review_sentence_aivp {
bigint id PK
bigint sentence_id FK
bigint ai_viewpoint_id FK
bigint dataset_id FK
}
review_sentences ||--o{ review_sentence_aivp : has
エラー処理
- ログ: 比較表生成の失敗をアプリケーションログに記録
- エラー詳細:
| ステータスコード | エラーメッセージ | 説明 |
|---|---|---|
| 404 | "データセットが見つかりません" | 指定されたデータセットスラグが存在しない場合 |
| 400 | "無効な製品選択" | 無効な製品IDが提供された場合 |
| 400 | "比較するには製品が不足しています" | 2つ未満の製品が選択された場合 |
| 500 | 例外メッセージを含む一般的なエラー | 処理中に予期しないエラーが発生した場合 |
追加メモ
- 最適な比較のために、2〜5製品が推奨されます
- 比較表は CSV/PDF 等でエクスポート可能
- 製品属性に基づくカスタム比較指標の計算が可能
- 多数の製品・属性を比較する場合はパフォーマンス影響に注意