====== OBSOLETE ====== **new page**: [[v5_get_category_trends|v5_get_category_trends]] ====== OBSOLETE ====== ====== Get Category Trend ====== ==== NOTE: this is currently rewritten due to port ==== ==== HINT: many parts are currently outdated ==== ===== NEW WIKI ENTRY ===== ==== INPUT ==== //required//: * key: [str] apikey, encoded //optional//: * i: [str] DEFAULT: False; produkt id (not picalike_id), if given, shop_cats and gender are derived from the product (overwrite) * b: [List(str)] DEFAULT: False; brand; HINT: not a list in psql backend * limit: [int] DEFAULT: 10 * price_from: [int/float?] DEFAULT: None * price_till: [int/float?] DEFAULT: None * gender: [str] DEFAULT: False * size: [list(str)] DEFAULT: False * format: [str] DEFAULT: “json” * r: [int/bool] DEFAULT: False * shop_cat: [str] DEFAULT: False; may this be a list? * session: pass to billing * test: IGNORE * testid: pass to billing ==== OUTPUT ==== **results** [dict] =\\ {\\ “count”: [int] num products returned,\\ “description”: “Category Trends”,\\ “link”: “http://picalike.com”,\\ “generator”: “http://picalike.com”,\\ “title”: “picalike Request”,\\ “modified”: str(datetime.datetime.now()),\\ “ids”: product_trends\\ }\\ → product_trends: sorted (by cluster trend descendent) list of products\\ → product: dict containing data about the product\\ **product** [dict] =\\ {\\ brand [?] none\\ extraimg [?] none\\ gender [str]\\ id [str]\\ img [str]\\ location [str]\\ name [str]\\ price [int] - nicht besser float?\\ prod_id [str]\\ shop_cat [str] nie liste?\\ w [?] -404\\ x_max_price [float]\\ x_min_price [float]\\ x_strike_price [?] none\\ x_size [list(dict)] = [{avail [str], display_size: [str], filter_size [str], is_reduced [bool], price [str], strike_price [str]}, …]\\ } Example: http://frontend05-hpc.picalike.corpex-kunden.de:5003/get_cat_trends/?key=cGljc2ltaWxhcjo0MTU2&i=&limit=12&format=json&r=1&size=&session=8103291ed655653ad4d35f6cadf92e56&testid=5da4902fe4227 ===== OLD WIKI ENTRY ===== Helps finding the product with the highest trend scores in certain shops, categories or other filters. The APP is currently in use at Madeleine's online page at the Picalike widget. It is mainly used to recommend the products with the highest trend score from the customer shop, if no reference product is currently viewed. Maintainer: ? Git REPO: https://git.picalike.corpex-kunden.de/ply/get-category-trends Host: frontend05-hpc.picalike.corpex-kunden.de:5003 ==== Dependencies ==== Live Solr Database Billing Database OSA DATA for Shop_ID look up ==== Technical ==== This APP uses flask as framework and redis for the billing collection. As usual it is dockerized and can be run with the standard build, push, deploy bash scripts. The ice_tea tags do not apply to this APPs image, that is uploaded into our Docker Harbor. === "/get_cat_trends_post/" [POST] === With shop_id and prod_id as input, returns most trendy prod_ids from the prod_ids shop category == Input == Optional Fields shop_id_key = data.get("shop_id_key", False) prod_id = data.get("prod_id", False) session = data.get("session", False) brand = data.get("brand", False) limit = int(data.get("limit", 10)) min_price = data.get("min_price", False) max_price = data.get("max_price", False) gender = data.get("gender", False) size = data.get("size", False) return_prod_ref = data.get("return_prod_ref", False) --> "0"/"1" shop_cat = data.get("shop_cat", False) == Output == results = { "count": count, "description":"Category Trends", "generator":"http://picalike.com", "title":"picalike Request", "modified":str(datetime.datetime.now()), "ids":[ { "shop_id_key": shop_id_key, "prod_id": prod_id, "session": session, "brand": brand, "limit":limit, "min_price":min_price, "max_price":max_price, "gender":gender, "size":size, "return_prod_ref": return_prod_ref, "shop_cat":shop_cat}] } === "/get_cat_trends" [GET] === With shop_id and prod_id as input, returns most trendy prod_ids from the prod_ids shop. This endpoint is being used by our widget on our customers page and therefore counts the billing information on a billing file. == Input == shop_id_key = request.args.get("key", False) feed_id = get_user(shop_id_key) prod_id = request.args.get("i", False) session = request.args.get("session", False) brand = request.args.getlist("b") # if brand name given, only returns prods from this brand limit = request.args.get("limit", 10) min_price = request.args.get("price_from", None) max_price = request.args.get("price_till", None) gender = request.args.get("gender", False) size = request.args.getlist("size") # can be M, 36, 12 or XXL format = request.args.get("format", "json") # value can be json or csv return_prod_ref = request.args.get("r", False) # r=1 or r=False for not returning the prod_ref shop_cat = request.args.get("shop_cat", False) == Output == results = { "count": count, "description":"Category Trends", "generator":"http://picalike.com", "title":"picalike Request", "modified":str(datetime.datetime.now()), "ids":[ { "shop_id_key": shop_id_key, "prod_id": prod_id, "session": session, "brand": brand, "limit":limit, "min_price":min_price, "max_price":max_price, "gender":gender, "size":size, "return_prod_ref": return_prod_ref, "shop_cat":shop_cat}] } === "/display_cat_trends/" [GET] === With shop_id and prod_id as input, returns most trendy prod_ids from the prod_ids shop Functions similar to “/get_cat_trends” with thew same in- and outputs, but does not collects billing information.