{
  "type": "object",
  "properties": {
    "retrieved": {
      "type": "string"
    },
    "judges": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "judge_id": {
            "type": "string"
          },
          "name_listing": {
            "type": "string"
          },
          "name_reported": {
            "type": "string"
          },
          "court_reported": {
            "type": "string"
          },
          "assignment_listing": {
            "type": "string"
          },
          "date_appointment_reported": {
            "type": "string"
          },
          "serving_since_listing": {
            "type": "string"
          },
          "commission_finding_reported": {
            "type": "string"
          },
          "commission_meets_votes": {
            "type": "string",
            "description": "Empty string means not supplied, not zero."
          },
          "commission_does_not_meet_votes": {
            "type": "string",
            "description": "Empty string means not supplied, not zero."
          },
          "in_state_publicity_pamphlet_maricopa_scope": {
            "type": "string",
            "description": "String True/False; not a boolean."
          },
          "in_county_candidates_on_ballot_pdf": {
            "type": "string",
            "description": "String True/False; not current ballot verification."
          },
          "county_list_applicable": {
            "type": "string",
            "description": "String True/False; not a boolean."
          },
          "report_url": {
            "type": "string"
          },
          "bio_url": {
            "type": "string"
          },
          "pdf_page_count": {
            "type": "string"
          }
        },
        "required": [
          "judge_id",
          "name_listing",
          "name_reported",
          "court_reported",
          "assignment_listing",
          "date_appointment_reported",
          "serving_since_listing",
          "commission_finding_reported",
          "commission_meets_votes",
          "commission_does_not_meet_votes",
          "in_state_publicity_pamphlet_maricopa_scope",
          "in_county_candidates_on_ballot_pdf",
          "county_list_applicable",
          "report_url",
          "bio_url",
          "pdf_page_count"
        ],
        "additionalProperties": false
      }
    },
    "cohorts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "cohort_id": {
            "type": "string"
          },
          "judge_id": {
            "type": "string"
          },
          "instrument_id": {
            "type": "string",
            "description": "Join to questions.instrument_id; never combine instruments."
          },
          "scale_id": {
            "type": "string",
            "description": "Foreign key: scales.scale_id."
          },
          "survey_period_raw": {
            "type": "string"
          },
          "survey_start_month": {
            "type": "string"
          },
          "survey_end_month": {
            "type": "string"
          },
          "total_surveys_reported_values": {
            "type": "string",
            "description": "JSON array encoded as a string; returned questionnaires, not question N."
          },
          "source_pages": {
            "type": "string",
            "description": "JSON array encoded as a string; physical PDF pages."
          }
        },
        "required": [
          "cohort_id",
          "judge_id",
          "instrument_id",
          "scale_id",
          "survey_period_raw",
          "survey_start_month",
          "survey_end_month",
          "total_surveys_reported_values",
          "source_pages"
        ],
        "additionalProperties": false
      }
    },
    "questions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "question_id": {
            "type": "string"
          },
          "instrument_id": {
            "type": "string"
          },
          "section_label_reported": {
            "type": "string"
          },
          "question_label_reported": {
            "type": "string"
          },
          "row_type": {
            "type": "string"
          }
        },
        "required": [
          "question_id",
          "instrument_id",
          "section_label_reported",
          "question_label_reported",
          "row_type"
        ],
        "additionalProperties": false
      }
    },
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "judge": {
            "type": "string",
            "description": "Foreign key: judges.judge_id."
          },
          "cohort": {
            "type": "string",
            "description": "Foreign key: cohorts.cohort_id."
          },
          "question": {
            "type": "string",
            "description": "Foreign key: questions.question_id."
          },
          "group": {
            "type": "string",
            "description": "Respondent group code; see guide."
          },
          "mean": {
            "type": [
              "null",
              "number"
            ],
            "description": "Published rounded mean, not a custom rollup; null means missing."
          },
          "n": {
            "type": [
              "null",
              "number"
            ],
            "description": "Valid answers for this question/group only. Never pool across questions."
          },
          "page": {
            "type": "number",
            "description": "One-based physical page of judge.report_url."
          },
          "status": {
            "type": "string",
            "description": "Source extraction status; retain alongside warnings."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Source inconsistencies or qualifications; preserve in interpretation."
          },
          "counts": {
            "type": "object",
            "properties": {
              "VG": {
                "type": [
                  "null",
                  "number"
                ]
              },
              "GD": {
                "type": [
                  "null",
                  "number"
                ]
              },
              "AC": {
                "type": [
                  "null",
                  "number"
                ]
              },
              "PO": {
                "type": [
                  "null",
                  "number"
                ]
              },
              "VP": {
                "type": [
                  "null",
                  "number"
                ]
              },
              "SU": {
                "type": [
                  "null",
                  "number"
                ]
              },
              "SA": {
                "type": [
                  "null",
                  "number"
                ]
              },
              "UN": {
                "type": [
                  "null",
                  "number"
                ]
              }
            },
            "required": [
              "VG",
              "GD",
              "AC",
              "PO",
              "VP",
              "SU",
              "SA",
              "UN"
            ],
            "additionalProperties": false,
            "description": "Counts by code; use only cohort scale display_order. Inactive codes and missing values are null."
          }
        },
        "required": [
          "judge",
          "cohort",
          "question",
          "group",
          "mean",
          "n",
          "page",
          "status",
          "warnings",
          "counts"
        ],
        "additionalProperties": false
      }
    },
    "scales": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "scale_id": {
            "type": "string"
          },
          "display_order": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "values": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "numeric_value": {
                  "type": "number"
                }
              },
              "required": [
                "code",
                "label",
                "numeric_value"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "scale_id",
          "display_order",
          "values"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "retrieved",
    "judges",
    "cohorts",
    "questions",
    "results",
    "scales"
  ],
  "additionalProperties": false,
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://arizonacharts.com/agents/schema.json",
  "title": "Arizona Charts public judge dataset",
  "description": "Full dataset or self-contained single-judge subset. Snapshot schema version 1. Null is missing; see guide for joins and interpretation."
}
