{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://china-snapshot.com/data/board.schema.json",
  "title": "China Snapshot Board: official documents per publisher per Beijing day",
  "description": "The model behind the publisher-by-day grid on the home page. A cell is the number of documents first seen from one publisher on one Beijing day (UTC+8). Every cell resolves to records in the archive: GET /api/datasets?dataset=documents&source=<publisher>&from=<day-1>&to=<day> (the archive filters by UTC date, so a Beijing day touches two UTC dates). The last day is always partial. A zero is not proof the publisher was silent. The same data as CSV: /data/board.csv.",
  "type": "object",
  "required": ["schema_version", "generated_at", "timezone", "days", "levels", "items"],
  "properties": {
    "schema_version": {"const": 1},
    "generated_at": {"type": "string", "format": "date-time", "description": "UTC instant the file was built."},
    "generated_from": {"type": "array", "items": {"type": "string"}},
    "timezone": {"const": "Asia/Shanghai"},
    "days": {"type": "array", "items": {"type": "string", "format": "date"}, "description": "Beijing days, oldest first. The last is today and partial."},
    "day_totals": {"type": "array", "items": {"type": "integer", "minimum": 0}},
    "gap_days": {"type": "array", "items": {"type": "string", "format": "date"}, "description": "Past days with no document from any publisher: a collection gap, not a quiet day."},
    "document_count": {"type": "integer", "minimum": 0},
    "publisher_count": {"type": "integer", "minimum": 0},
    "levels": {
      "type": "array",
      "description": "Publishers grouped by jurisdiction.",
      "items": {
        "type": "object",
        "required": ["label", "publishers"],
        "properties": {
          "label": {"enum": ["Central government", "Provinces and cities", "Hong Kong, Macao, Taiwan", "Other governments"]},
          "publishers": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["name", "total", "counts"],
              "properties": {
                "name": {"type": "string", "description": "Equals the archive's publisher field, usable as ?source=."},
                "total": {"type": "integer", "minimum": 0},
                "counts": {"type": "array", "items": {"type": "integer", "minimum": 0}, "description": "One count per entry of days."}
              }
            }
          }
        }
      }
    },
    "items": {
      "type": "object",
      "description": "Cell contents keyed '<publisher>|<beijing day>'. Each row is [first_seen_time_beijing HH:MM, english_title, original_title, source_url].",
      "additionalProperties": {
        "type": "array",
        "items": {"type": "array", "prefixItems": [{"type": "string"}, {"type": "string"}, {"type": "string"}, {"type": "string", "format": "uri"}], "minItems": 4, "maxItems": 4}
      }
    },
    "scheduled": {
      "type": "array",
      "description": "Forthcoming NBS releases. date_type is 'planned': the publisher's own preliminary calendar.",
      "items": {"type": "object", "required": ["date", "time", "title"], "properties": {"date": {"type": "string"}, "time": {"type": "string"}, "title": {"type": "string"}, "title_zh": {"type": "string"}, "publisher": {"type": "string"}}}
    },
    "numbers": {
      "type": "array",
      "description": "Latest first-party print per series.",
      "items": {"type": "object", "required": ["label", "value", "source", "feed"], "properties": {"label": {"type": "string"}, "value": {"type": "string"}, "unit": {"type": "string"}, "period": {"type": "string"}, "source": {"type": "string"}, "feed": {"type": "string"}}}
    }
  }
}
