Review Chart

Overview Description

The Review Chart endpoint returns time-series review counts for selected products. It supports two processing modes: AI Viewpoint and Specific Viewpoint (SPVP). Both modes return cumulative counts over time and include product detail in each series item.

Activity Diagram

---
config:
  theme: base
  layout: dagre
  flowchart:
    curve: linear
    htmlLabels: true
  themeVariables:
    edgeLabelBackground: "transparent"
---
flowchart TB
    Client[Client Application]
    API[ProductAnalyzerController]
    Dataset[Dataset Validation]
    AService[ProductAnalyzerService]
    SService[SpvpService]
    Database[(Database)]
    
    Client --- Step1[
        <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'>1</span>
            <p style='margin-top: 8px'>Send GET Request</p>
        </div>
    ]
    Step1 --> API

    API --- Step2[
        <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'>2</span>
            <p style='margin-top: 8px'>Validate Dataset</p>
        </div>
    ]
    Step2 --> Dataset

    Dataset --- Step3[
        <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'>3</span>
            <p style='margin-top: 8px'>Process Parameters</p>
        </div>
    ]
    Step3 --> API

    API --- Step4A[
        <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'>4A</span>
            <p style='margin-top: 8px'>AI Viewpoint</p>
        </div>
    ]
    Step4A --> AService
    AService --> Database
    Database --> AService

    API --- Step4B[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4B</span>
            <p style='margin-top: 8px'>Specific Viewpoint</p>
        </div>
    ]
    Step4B --> SService
    SService --> Database
    Database --> SService

    AService --- Step5A[
        <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'>5A</span>
            <p style='margin-top: 8px'>Format Response</p>
        </div>
    ]
    SService --- Step5B[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #cc66cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>5B</span>
            <p style='margin-top: 8px'>Format Response</p>
        </div>
    ]
    Step5A --> API
    Step5B --> API

    API --- Step6[
        <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'>6</span>
            <p style='margin-top: 8px'>Send JSON Response</p>
        </div>
    ]
    Step6 --> Client
    
    %% Styling
    style Client fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
    style API fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
    style Dataset fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style AService fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style SService fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style Database fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
    style Step1 fill:transparent,stroke:transparent,stroke-width:1px
    style Step2 fill:transparent,stroke:transparent,stroke-width:1px
    style Step3 fill:transparent,stroke:transparent,stroke-width:1px
    style Step4A fill:transparent,stroke:transparent,stroke-width:1px
    style Step4B fill:transparent,stroke:transparent,stroke-width:1px
    style Step5A fill:transparent,stroke:transparent,stroke-width:1px
    style Step5B fill:transparent,stroke:transparent,stroke-width:1px
    style Step6 fill:transparent,stroke:transparent,stroke-width:1px

Swagger Link

API: Review Chart API API: Viewpoint Chart API API: Sales Trend Chart API

Case Documentation

Case 1: Specific Viewpoint (SPVP)

Description

Generate review chart for selected products using Specific Viewpoints.

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as ProductAnalyzerController
    participant Service as SpvpService
    participant Repository as WishlistDatasetHistoryRepository
    participant DB as Database

    Note over Client,DB: Review Chart (SPVP) Flow

    Client->>API: GET /api/v1/general/analyzer/{wldh_slug}/review/chart?params

    API->>Repository: findBySlug(wldh_slug)
    Repository->>DB: SELECT * FROM wishlist_dataset_history WHERE slug = ?
    DB-->>Repository: Dataset
    Repository-->>API: WishlistDatasetHistory

    API->>Service: getReviewChartBySpecificViewpoint(wishlistDataset, params)
    Service->>DB: Query review_sentence_spvp + review_sentences
    DB-->>Service: Review data
    Service-->>API: Chart data (dates, series with product detail)

    API-->>Client: 200 OK (chart data)

    alt Dataset Not Found
        Repository-->>API: null
        API-->>Client: 404 Not Found
    end

Steps

Step 1: Request

  • Request: GET /api/v1/general/analyzer/{wldh_slug}/review/chart
  • Path: wldh_slug
  • Query:
    • viewpoint_type (required): SpecificViewpoint
    • mall_product_ids (required): comma-separated IDs
    • viewpoint_id (required)
    • start_date, end_date (required, YYYY-MM-DD)
    • date_unit (required): day | week | month
    • is_noise (optional): true | false
    • sentiment_type (optional): all | positive | negative

Step 2: Validate Dataset

  • Find dataset history by slug

Step 3: Process (SPVP)

  • Service: SpvpService::getReviewChartBySpecificViewpoint
  • Query: join review_sentence_spvp with review_sentences, filter by products/date/viewpoint, group by time unit

Step 4: Response

  • Success: 200 OK
    {
      "dates": ["2023-01-01", "2023-01-08", "2023-01-15"],
      "series": [
        {
          "mall_product_id": "dogparadise:4589602260099",
          "data": [10, 25, 33],
          "image": "https://.../image.jpg",
          "name": "Awesome Dog Food",
          "price": 1980,
          "jan_code": "4589602260099"
        }
      ]
    }
    

Case 2: AI Viewpoint

Description

Generate review chart for selected products using AI viewpoints.

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as ProductAnalyzerController
    participant Service as ProductAnalyzerService
    participant Repository as WishlistDatasetHistoryRepository
    participant DB as Database

    Note over Client,DB: Review Chart (AI) Flow

    Client->>API: GET /api/v1/general/analyzer/{wldh_slug}/review/chart?params

    API->>Repository: findBySlug(wldh_slug)
    Repository->>DB: SELECT * FROM wishlist_dataset_history WHERE slug = ?
    DB-->>Repository: Dataset
    Repository-->>API: WishlistDatasetHistory

    API->>Service: reviewChart(wishlistDataset, params)
    Service->>DB: Query AI viewpoint review sentences
    DB-->>Service: Review data
    Service-->>API: Chart data (dates, series with product detail)

    API-->>Client: 200 OK (chart data)

    alt Dataset Not Found
        Repository-->>API: null
        API-->>Client: 404 Not Found
    end

Steps

Step 1: Request

  • Request: GET /api/v1/general/analyzer/{wldh_slug}/review/chart
  • Path: wldh_slug
  • Query:
    • viewpoint_type (required): AiViewpoint
    • mall_product_ids (required): comma-separated IDs
    • viewpoint_id (required)
    • start_date, end_date (required, YYYY-MM-DD)
    • date_unit (required): day | week | month
    • is_noise (optional): true | false
    • sentiment_type (optional): all | positive | negative

Step 2: Validate Dataset

  • Find dataset history by slug

Step 3: Process (AI)

  • Service: ProductAnalyzerService::reviewChart
  • Query: analyzer AI viewpoint review sentences grouped by time unit

Step 4: Response

  • Success: same structure as SPVP (series items include product detail)

Database Related Tables & Fields (SPVP)

erDiagram
    review_sentences {
        bigint id PK
        string mall_product_id
        double sentiment_score
        date post_date
        boolean is_noise
        int year
        int month
    }
    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

Database Related Tables & Fields (AI Viewpoint)

erDiagram
    review_sentences {
        bigint id PK
        string mall_product_id
        double sentiment_score
        date post_date
        boolean is_noise
        int year
        int month
    }
    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

Error Handling

  • Log: dataset fetch failures; processing errors
  • Errors:
    Status Code Error Message Description
    404 "Dataset not found" Dataset slug does not exist
    400 Generic error with exception message Unexpected processing error

Viewpoint Chart

Activity Diagram

---
config:
  theme: base
  layout: dagre
  flowchart:
    curve: linear
    htmlLabels: true
  themeVariables:
    edgeLabelBackground: "transparent"
---
flowchart TB
    Client[Client Application]
    API[ProductAnalyzerController]
    Dataset[Dataset Validation]
    Service[ProductAnalysisService]
    Database[(Database)]
    
    Client --- Step1[
        <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'>1</span>
            <p style='margin-top: 8px'>Send GET Request</p>
        </div>
    ]
    Step1 --> API

    API --- Step2[
        <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'>2</span>
            <p style='margin-top: 8px'>Validate Dataset</p>
        </div>
    ]
    Step2 --> Dataset

    Dataset --- Step3[
        <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'>3</span>
            <p style='margin-top: 8px'>Process Parameters</p>
        </div>
    ]
    Step3 --> Service

    Service --- Step4[
        <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'>4</span>
            <p style='margin-top: 8px'>Fetch Viewpoints</p>
        </div>
    ]
    Step4 --> Database

    Database --- Step5[
        <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'>5</span>
            <p style='margin-top: 8px'>Query Review Data</p>
        </div>
    ]
    Step5 --> Database

    Database --- Step6[
        <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'>6</span>
            <p style='margin-top: 8px'>Format Viewpoint Chart</p>
        </div>
    ]
    Step6 --> Service

    Service --- Step7[
        <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'>7</span>
            <p style='margin-top: 8px'>Return Chart Data</p>
        </div>
    ]
    Step7 --> API

    API --- Step8[
        <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'>8</span>
            <p style='margin-top: 8px'>Send JSON Response</p>
        </div>
    ]
    Step8 --> Client
    
    %% Styling
    style Client fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
    style API fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
    style Dataset fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style Service fill:#f0f8e6,stroke:#339933,stroke-width:2px
    style Database fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
    style Step1 fill:transparent,stroke:transparent,stroke-width:1px
    style Step2 fill:transparent,stroke:transparent,stroke-width:1px
    style Step3 fill:transparent,stroke:transparent,stroke-width:1px
    style Step4 fill:transparent,stroke:transparent,stroke-width:1px
    style Step5 fill:transparent,stroke:transparent,stroke-width:1px
    style Step6 fill:transparent,stroke:transparent,stroke-width:1px
    style Step7 fill:transparent,stroke:transparent,stroke-width:1px
    style Step8 fill:transparent,stroke:transparent,stroke-width:1px

Description

Aggregate review counts grouped by viewpoints. Supports both SPVP and AI modes. Note: response does not include product detail.

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as ProductAnalyzerController
    participant Spvp as SpvpService
    participant PA as ProductAnalyzerService
    participant Repository as WishlistDatasetHistoryRepository
    participant DB as Database

    Note over Client,DB: Viewpoint Chart Flow

    Client->>API: GET /api/v1/general/analyzer/{wldh_slug}/review/chart/viewpoint?params

    API->>Repository: findBySlug(wldh_slug)
    Repository->>DB: SELECT * FROM wishlist_dataset_history WHERE slug = ?
    DB-->>Repository: Dataset
    Repository-->>API: WishlistDatasetHistory

    alt viewpoint_type == SpecificViewpoint
        API->>Spvp: getSpecificViewpointChart(wishlistDataset, params)
        Spvp->>DB: Query review_sentence_spvp + review_sentences (group by date, ordinal)
        DB-->>Spvp: Viewpoint data
        Spvp-->>API: Chart data (dates, series by viewpoint)
    else viewpoint_type == AiViewpoint
        API->>PA: reviewChartByViewpoint(wishlistDataset, params)
        PA->>DB: Query AI viewpoint review sentences (group by date, vp)
        DB-->>PA: Viewpoint data
        PA-->>API: Chart data (dates, series by viewpoint)
    end

    API-->>Client: 200 OK (chart data)

Steps

Step 1: Request

  • Request: GET /api/v1/general/analyzer/{wldh_slug}/review/chart/viewpoint
  • Path: wldh_slug
  • Query:
    • Common: viewpoint_type (SpecificViewpoint | AiViewpoint), start_date, end_date, date_unit, is_noise
    • SpecificViewpoint: mall_product_ids (string), view_all_products (true/false), sentiment_type (all/positive/negative)

Step 2: Validate Dataset

Step 3: Process

  • SPVP: SpvpService::getSpecificViewpointChart
  • AI: ProductAnalyzerService::reviewChartByViewpoint

Step 4: Response

  • Success: 200 OK
    {
      "dates": ["2024-01-01", "2024-01-08"],
      "series": [
        { "viewpoint_id": 515, "viewpoint_name": "Price", "data": [12, 27] },
        { "viewpoint_id": 516, "viewpoint_name": "Quality", "data": [9, 21] }
      ]
    }
    

Sales Trend Chart

Description

Return monthly sales counts per product (cumulative or raw per month depending on client visualization). Includes product detail.

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as ProductAnalyzerController
    participant Service as ProductAnalyzerService
    participant Repository as WishlistDatasetHistoryRepository
    participant DB as Database

    Note over Client,DB: Sales Trend Chart Flow

    Client->>API: GET /api/v1/general/analyzer/{wldh_slug}/review/chart/sales?params

    API->>Repository: findBySlug(wldh_slug)
    Repository->>DB: SELECT * FROM wishlist_dataset_history WHERE slug = ?
    DB-->>Repository: Dataset
    Repository-->>API: WishlistDatasetHistory

    API->>Service: saleTrendChart(wishlistDataset, params)
    Service->>DB: Query product sales (pair-aware)
    DB-->>Service: Sales data
    Service-->>API: Chart data (dates, series with product detail)

    API-->>Client: 200 OK (chart data)

Steps

Step 1: Request

  • Request: GET /api/v1/general/analyzer/{wldh_slug}/review/chart/sales
  • Path: wldh_slug
  • Query:
    • mall_product_ids (required): comma-separated IDs
    • start_date, end_date (required, YYYY-MM-DD)

Step 2: Validate Dataset

Step 3: Process

  • Service: ProductAnalyzerService::saleTrendChart
  • Query: aggregates sales_one_month per product (pair-aware), maps product details

Step 4: Response

  • Success: 200 OK
    {
      "dates": ["2024-01-01", "2024-02-01"],
      "series": [
        {
          "mall_product_id": "B0B6ZZ69QY",
          "data": [120, 180],
          "image": "https://.../image.jpg",
          "name": "Awesome Dog Food",
          "price": 1980,
          "summary_unique_product_code": "XYZ-123"
        }
      ]
    }