{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "district.schema.json",
  "title": "MCPS district aggregate (data/district.json)",
  "description": "County-level MSDE trends (the same metric shapes as a school, minus per-school identity). per_pupil is recomputed as the unweighted mean of school-level spending.",
  "type": "object",
  "required": ["name", "academics"],
  "additionalProperties": false,
  "properties": {
    "name": { "type": "string" },
    "lea": { "type": "string" },
    "accountability": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["year"],
        "additionalProperties": false,
        "properties": {
          "year": { "type": "string" },
          "rating": { "type": ["number", "null"] },
          "points_pct": { "type": ["number", "null"] },
          "percentile": { "type": ["number", "null"] }
        }
      }
    },
    "academics": { "$ref": "#/$defs/academics" },
    "climate": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "attendance_rate": { "$ref": "#/$defs/pointArray" },
        "chronic_absenteeism": { "$ref": "#/$defs/pointArray" }
      }
    },
    "students": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enrollment_by_race_latest": { "$ref": "#/$defs/numMap" },
        "latest_year": { "type": ["string", "null"] },
        "enrollment_trend": { "$ref": "#/$defs/pointArray" }
      }
    },
    "educator": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "poverty_band": { "type": ["string", "null"] },
        "inexperienced_teacher_pct": { "$ref": "#/$defs/pointArray" },
        "out_of_field_pct": { "$ref": "#/$defs/pointArray" },
        "emergency_cred_pct": { "$ref": "#/$defs/pointArray" }
      }
    },
    "per_pupil": { "$ref": "#/$defs/pointArray" },
    "per_pupil_note": { "type": "string" }
  },
  "$defs": {
    "point": {
      "type": "object",
      "required": ["year", "value"],
      "additionalProperties": false,
      "properties": {
        "year": { "type": "string" },
        "value": { "type": ["number", "null"] },
        "suppressed": { "type": ["string", "boolean"] }
      }
    },
    "pointArray": { "type": "array", "items": { "$ref": "#/$defs/point" } },
    "numMap": {
      "type": "object",
      "additionalProperties": { "type": ["number", "null"] }
    },
    "subject": {
      "type": "object",
      "additionalProperties": false,
      "required": ["pct_proficient"],
      "properties": {
        "pct_proficient": { "$ref": "#/$defs/pointArray" },
        "latest_year": { "type": "string" },
        "by_group_latest": { "$ref": "#/$defs/numMap" },
        "by_group_school": { "$ref": "#/$defs/numMap" },
        "by_group_school_trend": {
          "type": "object",
          "additionalProperties": { "$ref": "#/$defs/pointArray" }
        }
      }
    },
    "academics": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "ela": { "$ref": "#/$defs/subject" },
        "math": { "$ref": "#/$defs/subject" },
        "science": { "$ref": "#/$defs/subject" },
        "grad_rate": { "$ref": "#/$defs/pointArray" }
      }
    }
  }
}
