{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/spatialindia-com/json-schema/spatialindia-com-district-profile-schema.json",
  "title": "DistrictProfile",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/spatialindia-com-openapi.json#/components/schemas/DistrictProfile",
  "type": "object",
  "properties": {
    "meta": {
      "$ref": "#/$defs/Meta"
    },
    "district": {
      "$ref": "#/$defs/District"
    }
  },
  "required": [
    "meta",
    "district"
  ],
  "$defs": {
    "District": {
      "type": "object",
      "properties": {
        "objectid": {
          "type": "integer"
        },
        "dist_lgd": {
          "type": [
            "string",
            "null"
          ],
          "description": "The government's own LGD district code. Null where the district has none."
        },
        "district": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "population_2011": {
          "type": [
            "integer",
            "null"
          ]
        },
        "area_sqkm": {
          "type": [
            "number",
            "null"
          ]
        },
        "values": {
          "type": "object",
          "additionalProperties": {
            "type": [
              "number",
              "null"
            ]
          },
          "description": "Indicator id to value. `null` means not covered, never zero."
        },
        "estimated": {
          "type": "object",
          "additionalProperties": {
            "type": "boolean"
          },
          "description": "Per district and per indicator, not per source. `true` means this value was estimated — see `meta.indicators[].estimation_method` for how."
        }
      },
      "required": [
        "objectid",
        "district",
        "state"
      ]
    },
    "IndicatorMeta": {
      "type": "object",
      "description": "What one returned indicator is, where it came from and what it does not say.",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "unit": {
          "type": [
            "string",
            "null"
          ]
        },
        "source": {
          "type": [
            "string",
            "null"
          ]
        },
        "vintage": {
          "type": [
            "string",
            "null"
          ],
          "description": "The reference period of the data, not the publication date."
        },
        "caveat": {
          "type": [
            "string",
            "null"
          ],
          "description": "Reproduce this alongside the number."
        },
        "estimation_method": {
          "type": [
            "string",
            "null"
          ]
        },
        "polarity": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "higher-better",
            "higher-worse",
            "neutral",
            null
          ],
          "description": "Which direction is good. `neutral` means neither tail is good or bad — a headcount, a share, a rate with two failure modes — and must not be ranked as an achievement."
        },
        "status": {
          "type": "string",
          "enum": [
            "published",
            "deprecated"
          ]
        }
      },
      "required": [
        "id",
        "name",
        "status"
      ]
    },
    "Meta": {
      "type": "object",
      "description": "On every response. This block is what makes the numbers quotable.",
      "properties": {
        "dataset_version": {
          "type": "string",
          "description": "The date this dataset was last updated."
        },
        "boundary_vintage": {
          "type": "string"
        },
        "districts": {
          "type": "integer",
          "description": "Named districts in this dataset."
        },
        "indicators": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IndicatorMeta"
          },
          "description": "One entry per indicator returned, in the order requested."
        },
        "attribution": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The credit each source licence requires. Reproduce these wherever the data appears."
        },
        "citation": {
          "type": "string"
        }
      },
      "required": [
        "dataset_version",
        "boundary_vintage",
        "districts",
        "attribution",
        "citation"
      ]
    }
  }
}