{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/amigo/main/json-schema/amigo-district-metrics-response-schema.json",
  "title": "DistrictMetricsResponse",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amigo-m42-api-openapi.yml#/components/schemas/DistrictMetricsResponse",
  "properties": {
    "workspace_id": {
      "type": "string",
      "format": "uuid",
      "title": "Workspace Id"
    },
    "count": {
      "type": "integer",
      "title": "Count"
    },
    "items": {
      "items": {
        "$ref": "#/$defs/DistrictMetricsRow"
      },
      "type": "array",
      "title": "Items"
    }
  },
  "type": "object",
  "required": [
    "workspace_id",
    "count",
    "items"
  ],
  "$defs": {
    "DistrictMetricsRow": {
      "properties": {
        "workspace_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "string",
              "const": "labs"
            }
          ],
          "title": "Workspace Id"
        },
        "district_name": {
          "type": "string",
          "title": "District Name"
        },
        "t2d_incidence_per_1k": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "T2D Incidence Per 1K"
        },
        "t2d_predicted_per_1k": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "T2D Predicted Per 1K"
        },
        "residual": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Residual"
        },
        "cohort_size": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cohort Size"
        },
        "is_anomaly": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Is Anomaly"
        },
        "anomaly_narrative": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Anomaly Narrative"
        },
        "pcp_per_1k": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pcp Per 1K"
        },
        "capacity_gap_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Capacity Gap Pct"
        },
        "access_narrative": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Access Narrative"
        },
        "unmet_demand_score": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unmet Demand Score"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated At"
        }
      },
      "type": "object",
      "required": [
        "workspace_id",
        "district_name"
      ],
      "title": "DistrictMetricsRow"
    }
  }
}