{
  "$defs": {
    "StructureHints": {
      "additionalProperties": false,
      "description": "Corrections to the structure the Data Explorer detects (each one overrides the rule\nfor that dim or variable only): the dims of an image (``y_dim``, ``x_dim``,\n``frame_dim``), the node dim of a network or tree, the time dim, and variables that are\nangles or times of day with their units (``{\"wind_from\": \"deg\"}``).",
      "properties": {
        "angle_vars": {
          "maxProperties": 64,
          "patternProperties": {
            "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$": {
              "enum": [
                "deg",
                "rad",
                "h",
                "d",
                "month"
              ],
              "type": "string"
            }
          },
          "title": "Angle Vars",
          "type": "object"
        },
        "frame_dim": {
          "anyOf": [
            {
              "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Frame Dim"
        },
        "node_dim": {
          "anyOf": [
            {
              "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Node Dim"
        },
        "time_dim": {
          "anyOf": [
            {
              "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Time Dim"
        },
        "x_dim": {
          "anyOf": [
            {
              "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "X Dim"
        },
        "y_dim": {
          "anyOf": [
            {
              "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Y Dim"
        }
      },
      "title": "StructureHints",
      "type": "object"
    }
  },
  "$id": "https://schemas.mapi.dev/v1/api-DataExploreRequest.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Which Data Explorer sections to compute, and how.\n\n``kpi`` is the result the cross-correlations are computed against (default: the\ndataset's target variable); ``facet_by`` splits series by up to two dims; ``period``\nis the season length for STL and seasonal strength (default: from the frequency).",
  "examples": [
    {
      "facet_by": [
        "geo"
      ],
      "kpi": "revenue",
      "max_lag": 12,
      "sections": [
        "overview",
        "timeseries",
        "stationarity",
        "ccf",
        "stl",
        "quality"
      ]
    },
    {
      "hints": {
        "angle_vars": {
          "wind_from": "deg"
        },
        "x_dim": "col",
        "y_dim": "row"
      },
      "sections": [
        "structure",
        "images",
        "circular"
      ]
    }
  ],
  "properties": {
    "alpha": {
      "default": 0.05,
      "exclusiveMaximum": 0.5,
      "exclusiveMinimum": 0,
      "title": "Alpha",
      "type": "number"
    },
    "correlation": {
      "default": "pearson",
      "enum": [
        "pearson",
        "spearman"
      ],
      "title": "Correlation",
      "type": "string"
    },
    "facet_by": {
      "items": {
        "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
        "type": "string"
      },
      "maxItems": 2,
      "title": "Facet By",
      "type": "array"
    },
    "group_by": {
      "anyOf": [
        {
          "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Dim for group comparisons",
      "title": "Group By"
    },
    "hints": {
      "anyOf": [
        {
          "$ref": "#/$defs/StructureHints"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Corrections to the detected structure (image dims, node dim, angle variables)"
    },
    "kpi": {
      "anyOf": [
        {
          "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Kpi"
    },
    "max_lag": {
      "default": 26,
      "maximum": 200,
      "minimum": 1,
      "title": "Max Lag",
      "type": "integer"
    },
    "max_series": {
      "default": 50,
      "maximum": 200,
      "minimum": 1,
      "title": "Max Series",
      "type": "integer"
    },
    "node": {
      "anyOf": [
        {
          "pattern": "^/(?:[A-Za-z_][A-Za-z0-9_.\\-]{0,63}(?:/[A-Za-z_][A-Za-z0-9_.\\-]{0,63}){0,7})?$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "M4: the node of a tree dataset to explore (default: the root, or the first node with variables)",
      "title": "Node"
    },
    "outlier_threshold": {
      "default": 3.5,
      "exclusiveMinimum": 0,
      "maximum": 20,
      "title": "Outlier Threshold",
      "type": "number"
    },
    "outliers": {
      "default": "mad",
      "enum": [
        "iqr",
        "mad",
        "zscore"
      ],
      "title": "Outliers",
      "type": "string"
    },
    "period": {
      "anyOf": [
        {
          "maximum": 400,
          "minimum": 2,
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Period"
    },
    "prewhiten": {
      "default": true,
      "description": "Prewhiten before cross-correlations (filter both series with the driver's AR model, so a peak is not just two smooth series moving together)",
      "title": "Prewhiten",
      "type": "boolean"
    },
    "sections": {
      "items": {
        "enum": [
          "overview",
          "distributions",
          "timeseries",
          "missingness",
          "outliers",
          "correlation",
          "ccf",
          "acf_pacf",
          "stationarity",
          "stl",
          "vif",
          "groups",
          "quality",
          "structure",
          "images",
          "gallery",
          "profiles",
          "map",
          "network",
          "tree",
          "circular",
          "points"
        ],
        "type": "string"
      },
      "maxItems": 22,
      "minItems": 1,
      "title": "Sections",
      "type": "array"
    },
    "time_dim": {
      "anyOf": [
        {
          "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Default: the dataset's time dim",
      "title": "Time Dim"
    },
    "vars": {
      "description": "Default: all",
      "items": {
        "pattern": "^[A-Za-z_][A-Za-z0-9_.\\-]{0,127}$",
        "type": "string"
      },
      "maxItems": 256,
      "title": "Vars",
      "type": "array"
    }
  },
  "title": "DataExploreRequest",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
