Rating Retrieval

Context

This function is required for Use Case 1. It is triggered by the VR Designer config app when a user uploads a new garment or updates an existing one. It handles the call to the Consumer Rating Prediction Service, by providing the necessary information and then writing back the results to the VR Designer Data Store.

Invocation

The function is triggered by a Cloud Storage notification when a garment item has been written or updated in the data store.

Input

The input is a JSON payload with the following fields.

Field Description
Photo A downscaled garment photo in base64 encoding. The size must be of size 256 x 256
Metadata Garment metadata
Market Segmentation Array An array that features the current market segmentation properties like age_target, color, and price

Actions

  1. The function sends a JSON payload that features a downscaled photos of a garment, the garment metadata, and an array with market segment details to the Consumer Rating Prediction Service.
  2. It receives a result in the form of a percentage string.
  3. The function then writes to the VR Data Store, an entry that features the garment ID, the market segment ID, and the performance score.

Output

  • Success / Error code.
  • An object that features a garment id, a segment id and a percentage result.
  • Results are written to market_segments_results Data Store collection.
  • Example return object:
   {
       "garment_id": "98237483247",
       "segment_id": "1236",
       "result": "95"
   }

Repository

https://gitlab.com/etryon/uc1/gcf-rating-retrieval