Table of Contents

Settings-Collections

pci_reco_rules

also look at: RecoRules
api: http://dev01.picalike.corpex-kunden.de:8055/docs

general document structure:

"uid": int  # uid from the user collection (currently not implemented)
"apikey": "string"  # association to uid
"type": literal["meta", "group", "ruleset", "cats"]
  # meta: top level settings for the reco rules
  # group: settings for a group and "links" to rule-sets (deprecated)
  # ruleset: definition of a rule set
  # cats: lists the current categories of the shop (including intermediate categories if a "category_delimiter" is defined in the user settings
# additional values according to the type
  

type: meta

"values": dict
  # default_group_name: str
  # [category_delimiter: str]
["groups": <string of group names>]  # required when we switch to the structure that does not need the groups document

example:

{
  "_id": ...,
  "uid": 1234,
  "type": "meta",
  "groups": ["live", "prelive", "experiment-a", "experiment-b"],
  "values": {"default_group_name": "live", "category_delimiter": "|"}
}

type: group

(deprecated)

"name": str
"version": int  # should be an incrementing version number (could be a timestamp)
"global": RuleSet-ID
"categories": Dict[str, RuleSet-ID]
"api": Dict[str, RuleSet-ID]

example:

{"_id": ..., "uid": 1234, "type": "group", "name": "live", "version": 123, "global": ..., "categories": {"pants": ...}, "api": {"sim_api": ...}}

type: ruleset

a RuleSet document looks like this (<placeholder>, [optional]):

"_id": mongo-id
"groups": <list of groups where the ruleset is active> Ex: [{"name": "live", "active": true}]
"apis": <list of apis where the ruleset is active> Ex: ["look", "sim", "alsoreco", "vmail"]
"categories_version": int Ex: 1541951532
"base_category": Optional[int]  # if null -> global, int: position in the categories array of the cats-document Ex: 1
"included_categories": Optional[<list of int>]  # if empty or null -> all sub-categories are excluded Ex: [89, 10]
"filters":
  {<filter name>:
    {
      ["default": <val ("sameAsRef" means, take from product)>],
      ["matches": {<val (from feed)>: <list of matches}],
      ["excludes": {<val (from feed)>: <list of excludes>]  # Not Yet Implemented
    }
  }
"options": Dict[str, Any]  # to enable special solutions
  # TODO

example:

{
  "_id": ...,
  "uid": 1234,
  "type": "ruleset",
  "filters": {
    "season": {
      "default": "sameAsRef",
      "matches": {
        "summer": ["summer", "neutral", "null"]
  }}},
  "options": {}
}

type: cats

"categories": List[str]  # alphabetically sorted list of categories including intermediate categories if category_delimiter is defined
"version": float  # timestamp currently
["del_categories": List[str]]  # only exists or empty if there were deleted categories compared to before
["new_categories": List[str]]  # only exists or empty if there were new categories compared to before
["id": mongo-id  # pointing to the previous document if exists

examples:

{
  "_id": "1234",
  "categories": ["a", "b", "c", "d"],
  "type": "cats",
  "version": 123000
}
{
  "_id": "2345",
  "categories": ["a", "b", "c", "e"],
  "type": "cats",
  "del_categories": ["d"],
  "new_categories": ["e"],
  "id": "1234",
  "version": 123999
}