{
  "$defs": {
    "DimOverview": {
      "additionalProperties": true,
      "properties": {
        "end": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "End"
        },
        "freq": {
          "anyOf": [
            {
              "maxLength": 32,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Freq"
        },
        "kind": {
          "maxLength": 32,
          "title": "Kind",
          "type": "string"
        },
        "name": {
          "maxLength": 256,
          "title": "Name",
          "type": "string"
        },
        "size": {
          "minimum": 0,
          "title": "Size",
          "type": "integer"
        },
        "start": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Start"
        }
      },
      "required": [
        "name",
        "kind",
        "size"
      ],
      "title": "DimOverview",
      "type": "object"
    },
    "ShapeView": {
      "additionalProperties": true,
      "description": "One detected data shape: which variables it shows, the dims it uses by role\n(``{\"y\": \"row\", \"x\": \"col\", \"frame\": \"quarter\"}``) and where to see it.",
      "properties": {
        "dims": {
          "additionalProperties": {
            "type": "string"
          },
          "maxProperties": 16,
          "title": "Dims",
          "type": "object"
        },
        "kind": {
          "enum": [
            "timeseries",
            "sequence",
            "image",
            "vector_field",
            "areal_map",
            "points",
            "network",
            "tree",
            "circular",
            "profile",
            "table"
          ],
          "title": "Kind",
          "type": "string"
        },
        "label_plain": {
          "maxLength": 300,
          "title": "Label Plain",
          "type": "string"
        },
        "score": {
          "maximum": 1,
          "minimum": 0,
          "title": "Score",
          "type": "number"
        },
        "sections": {
          "items": {
            "type": "string"
          },
          "maxItems": 8,
          "title": "Sections",
          "type": "array"
        },
        "vars": {
          "items": {
            "type": "string"
          },
          "maxItems": 256,
          "title": "Vars",
          "type": "array"
        }
      },
      "required": [
        "kind",
        "score",
        "label_plain"
      ],
      "title": "ShapeView",
      "type": "object"
    },
    "VarOverview": {
      "additionalProperties": true,
      "properties": {
        "constant": {
          "default": false,
          "title": "Constant",
          "type": "boolean"
        },
        "dims": {
          "items": {
            "type": "string"
          },
          "maxItems": 32,
          "title": "Dims",
          "type": "array"
        },
        "distinct": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Distinct"
        },
        "dtype": {
          "maxLength": 64,
          "title": "Dtype",
          "type": "string"
        },
        "missing_share": {
          "default": 0.0,
          "maximum": 1,
          "minimum": 0,
          "title": "Missing Share",
          "type": "number"
        },
        "name": {
          "maxLength": 256,
          "title": "Name",
          "type": "string"
        },
        "role": {
          "anyOf": [
            {
              "maxLength": 32,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Role"
        },
        "units": {
          "anyOf": [
            {
              "maxLength": 64,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Units"
        },
        "used_as": {
          "anyOf": [
            {
              "enum": [
                "data",
                "geometry",
                "mask",
                "weight",
                "index",
                "label"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "How the explorer uses the variable: data, or geometry (polygon rings, neighbours, tree links), a mask, a weight, an index or a label. Absent for a plain time-series panel",
          "title": "Used As"
        }
      },
      "required": [
        "name",
        "dtype"
      ],
      "title": "VarOverview",
      "type": "object"
    }
  },
  "$id": "https://schemas.mapi.dev/v1/explore-overview.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": true,
  "description": "``overview``: shape, dims, variables and a plain-language summary.",
  "properties": {
    "caption_plain": {
      "anyOf": [
        {
          "maxLength": 1000,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Caption Plain"
    },
    "dims": {
      "items": {
        "$ref": "#/$defs/DimOverview"
      },
      "maxItems": 32,
      "title": "Dims",
      "type": "array"
    },
    "format": {
      "const": "mapi.data-explorer.overview/v1",
      "default": "mapi.data-explorer.overview/v1",
      "title": "Format",
      "type": "string"
    },
    "n_cells": {
      "minimum": 0,
      "title": "N Cells",
      "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 the view describes (absent for a flat dataset)",
      "title": "Node"
    },
    "quality_score": {
      "anyOf": [
        {
          "maximum": 1,
          "minimum": 0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "1 = no issues found",
      "title": "Quality Score"
    },
    "shapes": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/ShapeView"
          },
          "maxItems": 64,
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The detected data shapes, best first (absent for a plain time-series panel)",
      "title": "Shapes"
    },
    "summary_plain": {
      "maxLength": 1000,
      "title": "Summary Plain",
      "type": "string"
    },
    "vars": {
      "items": {
        "$ref": "#/$defs/VarOverview"
      },
      "maxItems": 256,
      "title": "Vars",
      "type": "array"
    },
    "warnings_plain": {
      "items": {
        "type": "string"
      },
      "maxItems": 50,
      "title": "Warnings Plain",
      "type": "array"
    }
  },
  "required": [
    "n_cells",
    "summary_plain"
  ],
  "title": "DataOverviewView",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
