{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Images: [{'name': '0110065002.jpg', 'url': 'https://urfjxlnyxlehjqlucvuu.supabase.co/storage/v1/object/public/images/011/0110065002.jpg'}, {'name': '0111609001.jpg', 'url': 'https://urfjxlnyxlehjqlucvuu.supabase.co/storage/v1/object/public/images/011/0111609001.jpg'}]\n", "Article Data: [{'article_id': '0110065002', 'product_code': '0110065', 'prod_name': 'OP T-shirt (Idro)', 'product_type_no': '306', 'product_type_name': 'Bra', 'product_group_name': 'Underwear', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'colour_group_code': '10', 'colour_group_name': 'White', 'perceived_colour_value_id': '3', 'perceived_colour_value_name': 'Light', 'perceived_colour_master_id': '9', 'perceived_colour_master_name': 'White', 'department_no': '1339', 'department_name': 'Clean Lingerie', 'index_code': 'B', 'index_name': 'Lingeries/Tights', 'index_group_no': '1', 'index_group_name': 'Ladieswear', 'section_no': '61', 'section_name': 'Womens Lingerie', 'garment_group_no': '1017', 'garment_group_name': 'Under-, Nightwear', 'detail_desc': 'Microfibre T-shirt bra with underwired, moulded, lightly padded cups that shape the bust and provide good support. Narrow adjustable shoulder straps and a narrow hook-and-eye fastening at the back. Without visible seams for greater comfort.'}, {'article_id': '0111609001', 'product_code': '0111609', 'prod_name': '200 den 1p Tights', 'product_type_no': '304', 'product_type_name': 'Underwear Tights', 'product_group_name': 'Socks & Tights', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'colour_group_code': '09', 'colour_group_name': 'Black', 'perceived_colour_value_id': '4', 'perceived_colour_value_name': 'Dark', 'perceived_colour_master_id': '5', 'perceived_colour_master_name': 'Black', 'department_no': '3608', 'department_name': 'Tights basic', 'index_code': 'B', 'index_name': 'Lingeries/Tights', 'index_group_no': '1', 'index_group_name': 'Ladieswear', 'section_no': '62', 'section_name': 'Womens Nightwear, Socks & Tigh', 'garment_group_no': '1021', 'garment_group_name': 'Socks and Tights', 'detail_desc': 'Opaque matt tights. 200 denier.'}]\n", "Customer Data: [{'customer_id': '00000dbacae5abe5e23885899a1fa44253a17956c6d1c3d25f88aa139fdfc657', 'FN': '', 'Active': '', 'club_member_status': 'ACTIVE', 'fashion_news_frequency': 'NONE', 'age': '49', 'postal_code': '52043ee2162cf5aa7ee79974281641c6f11a68d276429a91f8ca0d4b6efa8100'}]\n", "Recommendations: [{'customer': [{'customer_id': '00000dbacae5abe5e23885899a1fa44253a17956c6d1c3d25f88aa139fdfc657', 'FN': '', 'Active': '', 'club_member_status': 'ACTIVE', 'fashion_news_frequency': 'NONE', 'age': '49', 'postal_code': '52043ee2162cf5aa7ee79974281641c6f11a68d276429a91f8ca0d4b6efa8100'}], 'prediction': [{'article': {'prod_name': 'Jade HW Skinny Denim TRS', 'article_id': '0706016001', 'index_code': 'D', 'index_name': 'Divided', 'section_no': '53', 'detail_desc': 'High-waisted jeans in washed superstretch denim with a zip fly and button, fake front pockets, real back pockets and super-skinny legs.', 'product_code': '0706016', 'section_name': 'Divided Collection', 'department_no': '1747', 'index_group_no': '2', 'department_name': 'Trousers', 'product_type_no': '272', 'garment_group_no': '1009', 'index_group_name': 'Divided', 'colour_group_code': '09', 'colour_group_name': 'Black', 'product_type_name': 'Trousers', 'garment_group_name': 'Trousers', 'product_group_name': 'Garment Lower body', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '4', 'perceived_colour_master_id': '5', 'perceived_colour_value_name': 'Dark', 'perceived_colour_master_name': 'Black'}}, {'article': {'prod_name': 'Jade HW Skinny Denim TRS', 'article_id': '0706016002', 'index_code': 'D', 'index_name': 'Divided', 'section_no': '53', 'detail_desc': 'High-waisted jeans in washed superstretch denim with a zip fly and button, fake front pockets, real back pockets and super-skinny legs.', 'product_code': '0706016', 'section_name': 'Divided Collection', 'department_no': '1747', 'index_group_no': '2', 'department_name': 'Trousers', 'product_type_no': '272', 'garment_group_no': '1009', 'index_group_name': 'Divided', 'colour_group_code': '71', 'colour_group_name': 'Light Blue', 'product_type_name': 'Trousers', 'garment_group_name': 'Trousers', 'product_group_name': 'Garment Lower body', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '3', 'perceived_colour_master_id': '2', 'perceived_colour_value_name': 'Light', 'perceived_colour_master_name': 'Blue'}}, {'article': {'prod_name': '7p Basic Shaftless', 'article_id': '0372860001', 'index_code': 'B', 'index_name': 'Lingeries/Tights', 'section_no': '62', 'detail_desc': 'Fine-knit trainer socks in a soft cotton blend.', 'product_code': '0372860', 'section_name': 'Womens Nightwear, Socks & Tigh', 'department_no': '3611', 'index_group_no': '1', 'department_name': 'Shopbasket Socks', 'product_type_no': '302', 'garment_group_no': '1021', 'index_group_name': 'Ladieswear', 'colour_group_code': '09', 'colour_group_name': 'Black', 'product_type_name': 'Socks', 'garment_group_name': 'Socks and Tights', 'product_group_name': 'Socks & Tights', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '4', 'perceived_colour_master_id': '5', 'perceived_colour_value_name': 'Dark', 'perceived_colour_master_name': 'Black'}}, {'article': {'prod_name': 'Tilly (1)', 'article_id': '0610776002', 'index_code': 'A', 'index_name': 'Ladieswear', 'section_no': '16', 'detail_desc': 'T-shirt in lightweight jersey with a rounded hem. Slightly longer at the back.', 'product_code': '0610776', 'section_name': 'Womens Everyday Basics', 'department_no': '1676', 'index_group_no': '1', 'department_name': 'Jersey Basic', 'product_type_no': '255', 'garment_group_no': '1002', 'index_group_name': 'Ladieswear', 'colour_group_code': '09', 'colour_group_name': 'Black', 'product_type_name': 'T-shirt', 'garment_group_name': 'Jersey Basic', 'product_group_name': 'Garment Upper body', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '4', 'perceived_colour_master_id': '5', 'perceived_colour_value_name': 'Dark', 'perceived_colour_master_name': 'Black'}}, {'article': {'prod_name': 'Tilda tank', 'article_id': '0759871002', 'index_code': 'D', 'index_name': 'Divided', 'section_no': '80', 'detail_desc': 'Cropped, fitted top in cotton jersey with narrow shoulder straps.', 'product_code': '0759871', 'section_name': 'Divided Complements Other', 'department_no': '3936', 'index_group_no': '2', 'department_name': 'EQ Divided Basics', 'product_type_no': '253', 'garment_group_no': '1002', 'index_group_name': 'Divided', 'colour_group_code': '09', 'colour_group_name': 'Black', 'product_type_name': 'Vest top', 'garment_group_name': 'Jersey Basic', 'product_group_name': 'Garment Upper body', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '4', 'perceived_colour_master_id': '5', 'perceived_colour_value_name': 'Dark', 'perceived_colour_master_name': 'Black'}}, {'article': {'prod_name': 'Greta Thong Mynta Low 3p', 'article_id': '0464297007', 'index_code': 'B', 'index_name': 'Lingeries/Tights', 'section_no': '61', 'detail_desc': 'Thong briefs in cotton jersey with a wide lace trim at the top. Low waist, lined gusset, narrow sides and a string back.', 'product_code': '0464297', 'section_name': 'Womens Lingerie', 'department_no': '1334', 'index_group_no': '1', 'department_name': 'Casual Lingerie', 'product_type_no': '286', 'garment_group_no': '1017', 'index_group_name': 'Ladieswear', 'colour_group_code': '09', 'colour_group_name': 'Black', 'product_type_name': 'Underwear bottom', 'garment_group_name': 'Under-, Nightwear', 'product_group_name': 'Underwear', 'graphical_appearance_no': '1010014', 'graphical_appearance_name': 'Placement print', 'perceived_colour_value_id': '4', 'perceived_colour_master_id': '5', 'perceived_colour_value_name': 'Dark', 'perceived_colour_master_name': 'Black'}}, {'article': {'prod_name': '7p Basic Shaftless', 'article_id': '0372860002', 'index_code': 'B', 'index_name': 'Lingeries/Tights', 'section_no': '62', 'detail_desc': 'Fine-knit trainer socks in a soft cotton blend.', 'product_code': '0372860', 'section_name': 'Womens Nightwear, Socks & Tigh', 'department_no': '3611', 'index_group_no': '1', 'department_name': 'Shopbasket Socks', 'product_type_no': '302', 'garment_group_no': '1021', 'index_group_name': 'Ladieswear', 'colour_group_code': '10', 'colour_group_name': 'White', 'product_type_name': 'Socks', 'garment_group_name': 'Socks and Tights', 'product_group_name': 'Socks & Tights', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '3', 'perceived_colour_master_id': '9', 'perceived_colour_value_name': 'Light', 'perceived_colour_master_name': 'White'}}, {'article': {'prod_name': 'Tilly (1)', 'article_id': '0610776001', 'index_code': 'A', 'index_name': 'Ladieswear', 'section_no': '16', 'detail_desc': 'T-shirt in lightweight jersey with a rounded hem. Slightly longer at the back.', 'product_code': '0610776', 'section_name': 'Womens Everyday Basics', 'department_no': '1676', 'index_group_no': '1', 'department_name': 'Jersey Basic', 'product_type_no': '255', 'garment_group_no': '1002', 'index_group_name': 'Ladieswear', 'colour_group_code': '10', 'colour_group_name': 'White', 'product_type_name': 'T-shirt', 'garment_group_name': 'Jersey Basic', 'product_group_name': 'Garment Upper body', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '3', 'perceived_colour_master_id': '9', 'perceived_colour_value_name': 'Light', 'perceived_colour_master_name': 'White'}}, {'article': {'prod_name': 'Curvy Jeggings HW Ankle', 'article_id': '0399223001', 'index_code': 'D', 'index_name': 'Divided', 'section_no': '57', 'detail_desc': 'Jeggings in washed, superstretch denim with a high waist, fake front pockets, real back pockets and skinny legs.', 'product_code': '0399223', 'section_name': 'Ladies Denim', 'department_no': '1772', 'index_group_no': '2', 'department_name': 'Denim Trousers', 'product_type_no': '272', 'garment_group_no': '1016', 'index_group_name': 'Divided', 'colour_group_code': '09', 'colour_group_name': 'Black', 'product_type_name': 'Trousers', 'garment_group_name': 'Trousers Denim', 'product_group_name': 'Garment Lower body', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '4', 'perceived_colour_master_id': '5', 'perceived_colour_value_name': 'Dark', 'perceived_colour_master_name': 'Black'}}, {'article': {'prod_name': 'Jade HW Skinny Denim TRS', 'article_id': '0706016003', 'index_code': 'D', 'index_name': 'Divided', 'section_no': '53', 'detail_desc': 'High-waisted jeans in washed superstretch denim with a zip fly and button, fake front pockets, real back pockets and super-skinny legs.', 'product_code': '0706016', 'section_name': 'Divided Collection', 'department_no': '1747', 'index_group_no': '2', 'department_name': 'Trousers', 'product_type_no': '272', 'garment_group_no': '1009', 'index_group_name': 'Divided', 'colour_group_code': '73', 'colour_group_name': 'Dark Blue', 'product_type_name': 'Trousers', 'garment_group_name': 'Trousers', 'product_group_name': 'Garment Lower body', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '2', 'perceived_colour_master_id': '2', 'perceived_colour_value_name': 'Medium Dusty', 'perceived_colour_master_name': 'Blue'}}, {'article': {'prod_name': 'SUPREME RW tights', 'article_id': '0720125001', 'index_code': 'S', 'index_name': 'Sport', 'section_no': '5', 'detail_desc': 'Sports tights in fast-drying functional fabric with a wide waistband to hold in and shape the waist. Regular waist with a concealed key pocket in the waistband.', 'product_code': '0720125', 'section_name': 'Ladies H&M Sport', 'department_no': '8310', 'index_group_no': '26', 'department_name': 'Ladies Sport Bottoms', 'product_type_no': '273', 'garment_group_no': '1005', 'index_group_name': 'Sport', 'colour_group_code': '09', 'colour_group_name': 'Black', 'product_type_name': 'Leggings/Tights', 'garment_group_name': 'Jersey Fancy', 'product_group_name': 'Garment Lower body', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '4', 'perceived_colour_master_id': '5', 'perceived_colour_value_name': 'Dark', 'perceived_colour_master_name': 'Black'}}, {'article': {'prod_name': 'Box 4p Tights', 'article_id': '0156231001', 'index_code': 'B', 'index_name': 'Lingeries/Tights', 'section_no': '62', 'detail_desc': 'Matt tights with an elasticated waist. 20 denier.', 'product_code': '0156231', 'section_name': 'Womens Nightwear, Socks & Tigh', 'department_no': '3608', 'index_group_no': '1', 'department_name': 'Tights basic', 'product_type_no': '304', 'garment_group_no': '1021', 'index_group_name': 'Ladieswear', 'colour_group_code': '09', 'colour_group_name': 'Black', 'product_type_name': 'Underwear Tights', 'garment_group_name': 'Socks and Tights', 'product_group_name': 'Socks & Tights', 'graphical_appearance_no': '1010016', 'graphical_appearance_name': 'Solid', 'perceived_colour_value_id': '4', 'perceived_colour_master_id': '5', 'perceived_colour_value_name': 'Dark', 'perceived_colour_master_name': 'Black'}}]}]\n" ] } ], "source": [ "import requests\n", "import json\n", "import os \n", "\n", "# API Configuration\n", "BASE_URL = \"https://urfjxlnyxlehjqlucvuu.functions.supabase.co\"\n", "API_KEY = \"CFSekdHEW2EPasoqjWTuPpvVHYQukD3ootXhd3JVUXdpuEea5d\"\n", "\n", "def make_api_request(endpoint, ids):\n", " \"\"\"\n", " Generic function to make API requests with error handling\n", " \n", " :param endpoint: The specific API endpoint (e.g. 'get-images-from-id')\n", " :param ids: List of IDs to query\n", " :return: JSON response or None if error occurs\n", " \"\"\"\n", " api_key = os.environ.get(\"RECOMMENDER_KEY\")\n", " headers = {\n", " \"x-api-key\": api_key,\n", " \"Content-Type\": \"application/json\"\n", " }\n", " \n", " payload = {\"ids\": ids}\n", " \n", " try:\n", " recommender_url = os.environ.get(\"RECOMMENDER_URL\")\n", " response = requests.post(f\"{recommender_url}/{endpoint}\", \n", " headers=headers, \n", " data=json.dumps(payload))\n", " \n", " response.raise_for_status() # Raise an exception for bad status codes\n", " return response.json()\n", " \n", " except requests.exceptions.RequestException as e:\n", " print(f\"Error occurred while calling {endpoint}: {e}\")\n", " return None\n", "\n", "def get_images_from_id(ids):\n", " \"\"\"Get images for specific product IDs\"\"\"\n", " return make_api_request(\"get-images-from-id\", ids)\n", "\n", "def get_article_data(ids):\n", " \"\"\"Get article data for specific product IDs\"\"\"\n", " return make_api_request(\"get-articles-data\", ids)\n", "\n", "def get_customer_data(customer_ids):\n", " \"\"\"Get customer data for specific customer IDs\"\"\"\n", " return make_api_request(\"get-customer-data\", customer_ids)\n", "\n", "def get_recommendations(customer_ids):\n", " \"\"\"Get product recommendations for specific customer IDs\"\"\"\n", " return make_api_request(\"get-recommendations\", customer_ids)\n", "\n", "\n", "# Example product IDs\n", "product_ids = [\"0110065002\", \"0111609001\"]\n", "\n", "# Example customer ID\n", "customer_id = [\"00000dbacae5abe5e23885899a1fa44253a17956c6d1c3d25f88aa139fdfc657\"]\n", "\n", "# Demonstrate different API calls\n", "print(\"Images:\", get_images_from_id(product_ids))\n", "print(\"Article Data:\", get_article_data(product_ids))\n", "print(\"Customer Data:\", get_customer_data(customer_id))\n", "print(\"Recommendations:\", get_recommendations(customer_id))\n", "\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "a = get_recommendations([\"00000dbacae5abe5e23885899a1fa44253a17956c6d1c3d25f88aa139fdfc657\"])" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "a[0]['prediction'][0]['article']['article_id']\n", "img = get_images_from_id([str(a[0]['prediction'][0]['article']['article_id'])])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "img = get_images_from_id([str(a[0]['prediction'][0]['article']['article_id'])])" ] }, { "cell_type": "code", "execution_count": 57, "metadata": {}, "outputs": [], "source": [ "product_ids = [\"0110065002\", \"0111609001\"]\n" ] }, { "cell_type": "code", "execution_count": 71, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "None\n" ] } ], "source": [ "import os\n", "l = os.environ.get(\"RECOMMENDER_KEY\")\n", "print(l)" ] }, { "cell_type": "code", "execution_count": 61, "metadata": {}, "outputs": [], "source": [ "im = get_images_from_id([product_ids[0]])\n" ] }, { "cell_type": "code", "execution_count": 64, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'name': '0110065002.jpg',\n", " 'url': 'https://urfjxlnyxlehjqlucvuu.supabase.co/storage/v1/object/public/images/011/0110065002.jpg'}" ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "im[0]['url']" ] }, { "cell_type": "code", "execution_count": 62, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'name': '0110065002.jpg',\n", " 'url': 'https://urfjxlnyxlehjqlucvuu.supabase.co/storage/v1/object/public/images/011/0110065002.jpg'}]" ] }, "execution_count": 62, "metadata": {}, "output_type": "execute_result" } ], "source": [ "im" ] }, { "cell_type": "code", "execution_count": 67, "metadata": {}, "outputs": [], "source": [ "def parse_article_data(article_data):\n", " \"\"\"Parse the article data and return a dictionary\"\"\"\n", " \n", " # get the article information\n", " article_info = article_data['article']\n", " aricle_id = article_info.get('article_id', 'Unknown')\n", " article_name = article_info.get('prod_name', 'Unknown')\n", " article_type = article_info.get('department_name', 'Unknown')\n", " article_color = article_info.get('perceived_colour_master_name', 'Unknown')\n", " \n", " # get the article images\n", " article_images = get_images_from_id([aricle_id])\n", " img_url = 'no image'\n", " if len(article_images) > 0:\n", " img_url = article_images[0].get('url', 'no image')\n", " \n", " return {\n", " \"product_name\": article_name,\n", " \"product_type\": article_type,\n", " \"product_color\": article_color,\n", " \"product_image_url\": img_url\n", " }\n", "\n", "\n", "\n", "def parse_recommendations(recommendations):\n", " \"\"\"Parse the recommendations and return a list of product IDs\"\"\"\n", " \n", " # get the client information\n", " customer_info = recommendations[0]['customer'][0]\n", " customer_name = customer_info.get('name', 'Unknown')\n", " customer_age = customer_info.get('age', 'Unknown')\n", "\n", " print(customer_name)\n", " print(customer_age)\n", " \n", "\n", " # get the recommendations\n", " formatted_recommendations = [parse_article_data(article) for article in recommendations[0]['prediction']]\n", "\n", " return {\n", " \"customer_name\": customer_name,\n", " \"customer_age\": customer_age,\n", " \"recommendations\": formatted_recommendations\n", " }\n", " " ] }, { "cell_type": "code", "execution_count": 68, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Unknown\n", "49\n" ] }, { "data": { "text/plain": [ "{'customer_name': 'Unknown',\n", " 'customer_age': '49',\n", " 'recommendations': [{'name': 'Jade HW Skinny Denim TRS',\n", " 'type': 'Trousers',\n", " 'color': 'Black',\n", " 'image_url': 'no image'},\n", " {'name': 'Jade HW Skinny Denim TRS',\n", " 'type': 'Trousers',\n", " 'color': 'Blue',\n", " 'image_url': 'no image'},\n", " {'name': '7p Basic Shaftless',\n", " 'type': 'Shopbasket Socks',\n", " 'color': 'Black',\n", " 'image_url': 'https://urfjxlnyxlehjqlucvuu.supabase.co/storage/v1/object/public/images/037/0372860001.jpg'},\n", " {'name': 'Tilly (1)',\n", " 'type': 'Jersey Basic',\n", " 'color': 'Black',\n", " 'image_url': 'no image'},\n", " {'name': 'Tilda tank',\n", " 'type': 'EQ Divided Basics',\n", " 'color': 'Black',\n", " 'image_url': 'no image'},\n", " {'name': 'Greta Thong Mynta Low 3p',\n", " 'type': 'Casual Lingerie',\n", " 'color': 'Black',\n", " 'image_url': 'https://urfjxlnyxlehjqlucvuu.supabase.co/storage/v1/object/public/images/046/0464297007.jpg'},\n", " {'name': '7p Basic Shaftless',\n", " 'type': 'Shopbasket Socks',\n", " 'color': 'White',\n", " 'image_url': 'https://urfjxlnyxlehjqlucvuu.supabase.co/storage/v1/object/public/images/037/0372860002.jpg'},\n", " {'name': 'Tilly (1)',\n", " 'type': 'Jersey Basic',\n", " 'color': 'White',\n", " 'image_url': 'no image'},\n", " {'name': 'Curvy Jeggings HW Ankle',\n", " 'type': 'Denim Trousers',\n", " 'color': 'Black',\n", " 'image_url': 'no image'},\n", " {'name': 'Jade HW Skinny Denim TRS',\n", " 'type': 'Trousers',\n", " 'color': 'Blue',\n", " 'image_url': 'no image'},\n", " {'name': 'SUPREME RW tights',\n", " 'type': 'Ladies Sport Bottoms',\n", " 'color': 'Black',\n", " 'image_url': 'no image'},\n", " {'name': 'Box 4p Tights',\n", " 'type': 'Tights basic',\n", " 'color': 'Black',\n", " 'image_url': 'https://urfjxlnyxlehjqlucvuu.supabase.co/storage/v1/object/public/images/015/0156231001.jpg'}]}" ] }, "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ "parse_recommendations(a)" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'prod_name': 'Jade HW Skinny Denim TRS',\n", " 'article_id': '0706016001',\n", " 'index_code': 'D',\n", " 'index_name': 'Divided',\n", " 'section_no': '53',\n", " 'detail_desc': 'High-waisted jeans in washed superstretch denim with a zip fly and button, fake front pockets, real back pockets and super-skinny legs.',\n", " 'product_code': '0706016',\n", " 'section_name': 'Divided Collection',\n", " 'department_no': '1747',\n", " 'index_group_no': '2',\n", " 'department_name': 'Trousers',\n", " 'product_type_no': '272',\n", " 'garment_group_no': '1009',\n", " 'index_group_name': 'Divided',\n", " 'colour_group_code': '09',\n", " 'colour_group_name': 'Black',\n", " 'product_type_name': 'Trousers',\n", " 'garment_group_name': 'Trousers',\n", " 'product_group_name': 'Garment Lower body',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '4',\n", " 'perceived_colour_master_id': '5',\n", " 'perceived_colour_value_name': 'Dark',\n", " 'perceived_colour_master_name': 'Black'}" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a[0]['prediction'][0]['article']\n" ] }, { "cell_type": "code", "execution_count": 72, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'customer': [{'customer_id': '00000dbacae5abe5e23885899a1fa44253a17956c6d1c3d25f88aa139fdfc657',\n", " 'FN': '',\n", " 'Active': '',\n", " 'club_member_status': 'ACTIVE',\n", " 'fashion_news_frequency': 'NONE',\n", " 'age': '49',\n", " 'postal_code': '52043ee2162cf5aa7ee79974281641c6f11a68d276429a91f8ca0d4b6efa8100'}],\n", " 'prediction': [{'article': {'prod_name': 'Jade HW Skinny Denim TRS',\n", " 'article_id': '0706016001',\n", " 'index_code': 'D',\n", " 'index_name': 'Divided',\n", " 'section_no': '53',\n", " 'detail_desc': 'High-waisted jeans in washed superstretch denim with a zip fly and button, fake front pockets, real back pockets and super-skinny legs.',\n", " 'product_code': '0706016',\n", " 'section_name': 'Divided Collection',\n", " 'department_no': '1747',\n", " 'index_group_no': '2',\n", " 'department_name': 'Trousers',\n", " 'product_type_no': '272',\n", " 'garment_group_no': '1009',\n", " 'index_group_name': 'Divided',\n", " 'colour_group_code': '09',\n", " 'colour_group_name': 'Black',\n", " 'product_type_name': 'Trousers',\n", " 'garment_group_name': 'Trousers',\n", " 'product_group_name': 'Garment Lower body',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '4',\n", " 'perceived_colour_master_id': '5',\n", " 'perceived_colour_value_name': 'Dark',\n", " 'perceived_colour_master_name': 'Black'}},\n", " {'article': {'prod_name': 'Jade HW Skinny Denim TRS',\n", " 'article_id': '0706016002',\n", " 'index_code': 'D',\n", " 'index_name': 'Divided',\n", " 'section_no': '53',\n", " 'detail_desc': 'High-waisted jeans in washed superstretch denim with a zip fly and button, fake front pockets, real back pockets and super-skinny legs.',\n", " 'product_code': '0706016',\n", " 'section_name': 'Divided Collection',\n", " 'department_no': '1747',\n", " 'index_group_no': '2',\n", " 'department_name': 'Trousers',\n", " 'product_type_no': '272',\n", " 'garment_group_no': '1009',\n", " 'index_group_name': 'Divided',\n", " 'colour_group_code': '71',\n", " 'colour_group_name': 'Light Blue',\n", " 'product_type_name': 'Trousers',\n", " 'garment_group_name': 'Trousers',\n", " 'product_group_name': 'Garment Lower body',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '3',\n", " 'perceived_colour_master_id': '2',\n", " 'perceived_colour_value_name': 'Light',\n", " 'perceived_colour_master_name': 'Blue'}},\n", " {'article': {'prod_name': '7p Basic Shaftless',\n", " 'article_id': '0372860001',\n", " 'index_code': 'B',\n", " 'index_name': 'Lingeries/Tights',\n", " 'section_no': '62',\n", " 'detail_desc': 'Fine-knit trainer socks in a soft cotton blend.',\n", " 'product_code': '0372860',\n", " 'section_name': 'Womens Nightwear, Socks & Tigh',\n", " 'department_no': '3611',\n", " 'index_group_no': '1',\n", " 'department_name': 'Shopbasket Socks',\n", " 'product_type_no': '302',\n", " 'garment_group_no': '1021',\n", " 'index_group_name': 'Ladieswear',\n", " 'colour_group_code': '09',\n", " 'colour_group_name': 'Black',\n", " 'product_type_name': 'Socks',\n", " 'garment_group_name': 'Socks and Tights',\n", " 'product_group_name': 'Socks & Tights',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '4',\n", " 'perceived_colour_master_id': '5',\n", " 'perceived_colour_value_name': 'Dark',\n", " 'perceived_colour_master_name': 'Black'}},\n", " {'article': {'prod_name': 'Tilly (1)',\n", " 'article_id': '0610776002',\n", " 'index_code': 'A',\n", " 'index_name': 'Ladieswear',\n", " 'section_no': '16',\n", " 'detail_desc': 'T-shirt in lightweight jersey with a rounded hem. Slightly longer at the back.',\n", " 'product_code': '0610776',\n", " 'section_name': 'Womens Everyday Basics',\n", " 'department_no': '1676',\n", " 'index_group_no': '1',\n", " 'department_name': 'Jersey Basic',\n", " 'product_type_no': '255',\n", " 'garment_group_no': '1002',\n", " 'index_group_name': 'Ladieswear',\n", " 'colour_group_code': '09',\n", " 'colour_group_name': 'Black',\n", " 'product_type_name': 'T-shirt',\n", " 'garment_group_name': 'Jersey Basic',\n", " 'product_group_name': 'Garment Upper body',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '4',\n", " 'perceived_colour_master_id': '5',\n", " 'perceived_colour_value_name': 'Dark',\n", " 'perceived_colour_master_name': 'Black'}},\n", " {'article': {'prod_name': 'Tilda tank',\n", " 'article_id': '0759871002',\n", " 'index_code': 'D',\n", " 'index_name': 'Divided',\n", " 'section_no': '80',\n", " 'detail_desc': 'Cropped, fitted top in cotton jersey with narrow shoulder straps.',\n", " 'product_code': '0759871',\n", " 'section_name': 'Divided Complements Other',\n", " 'department_no': '3936',\n", " 'index_group_no': '2',\n", " 'department_name': 'EQ Divided Basics',\n", " 'product_type_no': '253',\n", " 'garment_group_no': '1002',\n", " 'index_group_name': 'Divided',\n", " 'colour_group_code': '09',\n", " 'colour_group_name': 'Black',\n", " 'product_type_name': 'Vest top',\n", " 'garment_group_name': 'Jersey Basic',\n", " 'product_group_name': 'Garment Upper body',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '4',\n", " 'perceived_colour_master_id': '5',\n", " 'perceived_colour_value_name': 'Dark',\n", " 'perceived_colour_master_name': 'Black'}},\n", " {'article': {'prod_name': 'Greta Thong Mynta Low 3p',\n", " 'article_id': '0464297007',\n", " 'index_code': 'B',\n", " 'index_name': 'Lingeries/Tights',\n", " 'section_no': '61',\n", " 'detail_desc': 'Thong briefs in cotton jersey with a wide lace trim at the top. Low waist, lined gusset, narrow sides and a string back.',\n", " 'product_code': '0464297',\n", " 'section_name': 'Womens Lingerie',\n", " 'department_no': '1334',\n", " 'index_group_no': '1',\n", " 'department_name': 'Casual Lingerie',\n", " 'product_type_no': '286',\n", " 'garment_group_no': '1017',\n", " 'index_group_name': 'Ladieswear',\n", " 'colour_group_code': '09',\n", " 'colour_group_name': 'Black',\n", " 'product_type_name': 'Underwear bottom',\n", " 'garment_group_name': 'Under-, Nightwear',\n", " 'product_group_name': 'Underwear',\n", " 'graphical_appearance_no': '1010014',\n", " 'graphical_appearance_name': 'Placement print',\n", " 'perceived_colour_value_id': '4',\n", " 'perceived_colour_master_id': '5',\n", " 'perceived_colour_value_name': 'Dark',\n", " 'perceived_colour_master_name': 'Black'}},\n", " {'article': {'prod_name': '7p Basic Shaftless',\n", " 'article_id': '0372860002',\n", " 'index_code': 'B',\n", " 'index_name': 'Lingeries/Tights',\n", " 'section_no': '62',\n", " 'detail_desc': 'Fine-knit trainer socks in a soft cotton blend.',\n", " 'product_code': '0372860',\n", " 'section_name': 'Womens Nightwear, Socks & Tigh',\n", " 'department_no': '3611',\n", " 'index_group_no': '1',\n", " 'department_name': 'Shopbasket Socks',\n", " 'product_type_no': '302',\n", " 'garment_group_no': '1021',\n", " 'index_group_name': 'Ladieswear',\n", " 'colour_group_code': '10',\n", " 'colour_group_name': 'White',\n", " 'product_type_name': 'Socks',\n", " 'garment_group_name': 'Socks and Tights',\n", " 'product_group_name': 'Socks & Tights',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '3',\n", " 'perceived_colour_master_id': '9',\n", " 'perceived_colour_value_name': 'Light',\n", " 'perceived_colour_master_name': 'White'}},\n", " {'article': {'prod_name': 'Tilly (1)',\n", " 'article_id': '0610776001',\n", " 'index_code': 'A',\n", " 'index_name': 'Ladieswear',\n", " 'section_no': '16',\n", " 'detail_desc': 'T-shirt in lightweight jersey with a rounded hem. Slightly longer at the back.',\n", " 'product_code': '0610776',\n", " 'section_name': 'Womens Everyday Basics',\n", " 'department_no': '1676',\n", " 'index_group_no': '1',\n", " 'department_name': 'Jersey Basic',\n", " 'product_type_no': '255',\n", " 'garment_group_no': '1002',\n", " 'index_group_name': 'Ladieswear',\n", " 'colour_group_code': '10',\n", " 'colour_group_name': 'White',\n", " 'product_type_name': 'T-shirt',\n", " 'garment_group_name': 'Jersey Basic',\n", " 'product_group_name': 'Garment Upper body',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '3',\n", " 'perceived_colour_master_id': '9',\n", " 'perceived_colour_value_name': 'Light',\n", " 'perceived_colour_master_name': 'White'}},\n", " {'article': {'prod_name': 'Curvy Jeggings HW Ankle',\n", " 'article_id': '0399223001',\n", " 'index_code': 'D',\n", " 'index_name': 'Divided',\n", " 'section_no': '57',\n", " 'detail_desc': 'Jeggings in washed, superstretch denim with a high waist, fake front pockets, real back pockets and skinny legs.',\n", " 'product_code': '0399223',\n", " 'section_name': 'Ladies Denim',\n", " 'department_no': '1772',\n", " 'index_group_no': '2',\n", " 'department_name': 'Denim Trousers',\n", " 'product_type_no': '272',\n", " 'garment_group_no': '1016',\n", " 'index_group_name': 'Divided',\n", " 'colour_group_code': '09',\n", " 'colour_group_name': 'Black',\n", " 'product_type_name': 'Trousers',\n", " 'garment_group_name': 'Trousers Denim',\n", " 'product_group_name': 'Garment Lower body',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '4',\n", " 'perceived_colour_master_id': '5',\n", " 'perceived_colour_value_name': 'Dark',\n", " 'perceived_colour_master_name': 'Black'}},\n", " {'article': {'prod_name': 'Jade HW Skinny Denim TRS',\n", " 'article_id': '0706016003',\n", " 'index_code': 'D',\n", " 'index_name': 'Divided',\n", " 'section_no': '53',\n", " 'detail_desc': 'High-waisted jeans in washed superstretch denim with a zip fly and button, fake front pockets, real back pockets and super-skinny legs.',\n", " 'product_code': '0706016',\n", " 'section_name': 'Divided Collection',\n", " 'department_no': '1747',\n", " 'index_group_no': '2',\n", " 'department_name': 'Trousers',\n", " 'product_type_no': '272',\n", " 'garment_group_no': '1009',\n", " 'index_group_name': 'Divided',\n", " 'colour_group_code': '73',\n", " 'colour_group_name': 'Dark Blue',\n", " 'product_type_name': 'Trousers',\n", " 'garment_group_name': 'Trousers',\n", " 'product_group_name': 'Garment Lower body',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '2',\n", " 'perceived_colour_master_id': '2',\n", " 'perceived_colour_value_name': 'Medium Dusty',\n", " 'perceived_colour_master_name': 'Blue'}},\n", " {'article': {'prod_name': 'SUPREME RW tights',\n", " 'article_id': '0720125001',\n", " 'index_code': 'S',\n", " 'index_name': 'Sport',\n", " 'section_no': '5',\n", " 'detail_desc': 'Sports tights in fast-drying functional fabric with a wide waistband to hold in and shape the waist. Regular waist with a concealed key pocket in the waistband.',\n", " 'product_code': '0720125',\n", " 'section_name': 'Ladies H&M Sport',\n", " 'department_no': '8310',\n", " 'index_group_no': '26',\n", " 'department_name': 'Ladies Sport Bottoms',\n", " 'product_type_no': '273',\n", " 'garment_group_no': '1005',\n", " 'index_group_name': 'Sport',\n", " 'colour_group_code': '09',\n", " 'colour_group_name': 'Black',\n", " 'product_type_name': 'Leggings/Tights',\n", " 'garment_group_name': 'Jersey Fancy',\n", " 'product_group_name': 'Garment Lower body',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '4',\n", " 'perceived_colour_master_id': '5',\n", " 'perceived_colour_value_name': 'Dark',\n", " 'perceived_colour_master_name': 'Black'}},\n", " {'article': {'prod_name': 'Box 4p Tights',\n", " 'article_id': '0156231001',\n", " 'index_code': 'B',\n", " 'index_name': 'Lingeries/Tights',\n", " 'section_no': '62',\n", " 'detail_desc': 'Matt tights with an elasticated waist. 20 denier.',\n", " 'product_code': '0156231',\n", " 'section_name': 'Womens Nightwear, Socks & Tigh',\n", " 'department_no': '3608',\n", " 'index_group_no': '1',\n", " 'department_name': 'Tights basic',\n", " 'product_type_no': '304',\n", " 'garment_group_no': '1021',\n", " 'index_group_name': 'Ladieswear',\n", " 'colour_group_code': '09',\n", " 'colour_group_name': 'Black',\n", " 'product_type_name': 'Underwear Tights',\n", " 'garment_group_name': 'Socks and Tights',\n", " 'product_group_name': 'Socks & Tights',\n", " 'graphical_appearance_no': '1010016',\n", " 'graphical_appearance_name': 'Solid',\n", " 'perceived_colour_value_id': '4',\n", " 'perceived_colour_master_id': '5',\n", " 'perceived_colour_value_name': 'Dark',\n", " 'perceived_colour_master_name': 'Black'}}]}]" ] }, "execution_count": 72, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a" ] } ], "metadata": { "kernelspec": { "display_name": "apis", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.10" } }, "nbformat": 4, "nbformat_minor": 2 }