{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/statorigin/main/json-schema/statorigin-statistic-schema.json",
  "title": "Statistic",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/statorigin-openapi.json#/components/schemas/Statistic",
  "type": "object",
  "required": [
    "id",
    "url",
    "indicator",
    "region",
    "period",
    "value",
    "unit",
    "source",
    "citation"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "indicator": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "definition": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "industry": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "isic": {
            "type": "string",
            "description": "ISIC Rev.4 code"
          },
          "is_primary": {
            "type": "boolean"
          }
        }
      }
    },
    "region": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "world",
            "country",
            "bloc",
            "subnational"
          ]
        }
      }
    },
    "period": {
      "type": "object",
      "properties": {
        "start": {
          "type": "string",
          "format": "date"
        },
        "end": {
          "type": "string",
          "format": "date"
        },
        "type": {
          "type": "string",
          "enum": [
            "year",
            "quarter",
            "month",
            "point",
            "range"
          ]
        }
      }
    },
    "value": {
      "type": "number"
    },
    "value_text": {
      "type": [
        "string",
        "null"
      ],
      "description": "The source's own phrasing, preserved verbatim"
    },
    "unit": {
      "type": "string"
    },
    "currency": {
      "type": [
        "string",
        "null"
      ]
    },
    "scale": {
      "type": "string",
      "enum": [
        "1",
        "thousand",
        "million",
        "billion",
        "trillion"
      ]
    },
    "value_type": {
      "type": "string",
      "enum": [
        "actual",
        "estimate",
        "forecast"
      ]
    },
    "source": {
      "type": "object",
      "description": "Complete provenance. Never omitted.",
      "properties": {
        "org": {
          "type": "string"
        },
        "org_short_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "org_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "org_tier": {
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        },
        "document_title": {
          "type": "string"
        },
        "document_url": {
          "type": "string",
          "format": "uri"
        },
        "document_type": {
          "type": "string"
        },
        "locator": {
          "type": [
            "string",
            "null"
          ],
          "description": "Page, table or section"
        },
        "quote": {
          "type": [
            "string",
            "null"
          ],
          "description": "Verbatim quotation for quote evidence; explicitly labelled generated description for dataset evidence"
        },
        "evidence_type": {
          "type": "string",
          "enum": [
            "quote",
            "dataset"
          ],
          "description": "How the value is evidenced"
        },
        "dataset_query": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": true,
          "description": "Dataset code and keys selecting the unique observation"
        },
        "dataset_evidence": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": true,
          "description": "Publisher response URL, version, retrieval time, SHA-256, schema mapping and methodology URL"
        },
        "published_date": {
          "type": [
            "string",
            "null"
          ],
          "format": "date"
        },
        "accessed_at": {
          "type": "string",
          "format": "date"
        },
        "license": {
          "type": [
            "string",
            "null"
          ]
        },
        "url_status": {
          "type": "string",
          "enum": [
            "ok",
            "redirect",
            "dead"
          ]
        },
        "self_reported": {
          "type": "boolean",
          "description": "True when the publisher reports on itself (a company's own results or operations) rather than on the market. Industry hub pages exclude these; they remain available here and on the publisher's page."
        }
      }
    },
    "verification": {
      "type": "string",
      "enum": [
        "pending",
        "verified",
        "disputed",
        "rejected"
      ]
    },
    "verified_by": {
      "type": [
        "string",
        "null"
      ]
    },
    "verified_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "confidence": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "maximum": 1
    },
    "is_secondhand": {
      "type": "boolean",
      "description": "True when the figure was relayed from a secondary source"
    },
    "supersedes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Id of the older record this one corrected, if any"
    },
    "superseded_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "Id of the newer record that corrected this one. Non-null means this record is no longer current; its URL still resolves."
    },
    "is_current": {
      "type": "boolean",
      "description": "False once superseded_by is set"
    },
    "citation": {
      "type": "object",
      "properties": {
        "apa": {
          "type": "string"
        },
        "bibtex": {
          "type": "string"
        }
      }
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}