{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://witnessedsentence.org/schema/case_record.schema.json",
  "title": "Case Record",
  "description": "A documented case of algorithmic or AI-driven harm in the Witnessed Sentence registry.",
  "type": "object",
  "required": [
    "id",
    "title",
    "jurisdiction",
    "domain",
    "system_type",
    "system_name",
    "deployed_by",
    "year_start",
    "harm_type",
    "subject_identification",
    "oversight_trigger",
    "remedy_status",
    "documentation_status",
    "summary_50w",
    "sources",
    "extraction_metadata"
  ],
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^R-[0-9]{4}$",
      "description": "Registry record identifier in format R-NNNN. Case-files use S-NNN and are published in /data/canonical.json."
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 300,
      "description": "Descriptive title. Subject names only if subject is a public advocate. No PII."
    },
    "jurisdiction": {
      "type": "object",
      "required": [
        "country",
        "level"
      ],
      "additionalProperties": false,
      "properties": {
        "country": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "description": "Country name (English)."
        },
        "region": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 100,
          "description": "Sub-national region, state, or municipality. Null if national-level."
        },
        "level": {
          "type": "string",
          "enum": [
            "municipal",
            "regional",
            "national",
            "supranational"
          ],
          "description": "Jurisdictional level of the deploying authority."
        }
      }
    },
    "domain": {
      "type": "string",
      "enum": [
        "welfare",
        "policing",
        "hiring",
        "healthcare",
        "housing",
        "education",
        "financial",
        "immigration",
        "child_protection",
        "criminal_justice",
        "taxation",
        "insurance",
        "platform_labor",
        "content_moderation",
        "border_control",
        "social_services",
        "other"
      ],
      "description": "Sector or policy domain. See vocabularies/domain.json."
    },
    "system_type": {
      "type": "string",
      "enum": [
        "rule_based_risk_scoring",
        "ml_classifier",
        "face_recognition",
        "predictive_policing",
        "llm_generation",
        "llm_decision_support",
        "recommender_system",
        "biometric_matching",
        "automated_admin_decision",
        "credit_scoring",
        "fraud_detection",
        "other"
      ],
      "description": "Technical category of the system. See vocabularies/system_type.json."
    },
    "system_name": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 200,
      "description": "Public name of the system (e.g. 'SyRI', 'COMPAS'). Null if unnamed/unknown."
    },
    "deployed_by": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "maxLength": 300,
      "description": "Institution or entity that deployed the system. Null if unknown."
    },
    "year_start": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1950,
      "maximum": 2100,
      "description": "Year the system began operating or the harm period began. Null if unknown."
    },
    "year_end": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1950,
      "maximum": 2100,
      "description": "Year the system was shut down or harm period ended. Null if ongoing or unknown."
    },
    "harm_type": {
      "type": "string",
      "enum": [
        "collective",
        "individual",
        "mixed"
      ],
      "description": "Whether harm was collective, individual, or mixed. See vocabularies/harm_type.json."
    },
    "subject_count_estimate": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1,
      "description": "Estimated number of people affected. Null if unknown or not applicable."
    },
    "subject_identification": {
      "type": "string",
      "enum": [
        "named_public_advocate",
        "named_in_record",
        "anonymized_initials",
        "anonymous_collective",
        "unknown"
      ],
      "description": "How subjects are identified in this record, per subject naming rules."
    },
    "oversight_trigger": {
      "type": "string",
      "enum": [
        "court_ruling",
        "litigation",
        "parliamentary_inquiry",
        "regulatory_enforcement",
        "journalism",
        "academic_research",
        "whistleblower",
        "ngo_report",
        "internal_audit",
        "none_yet"
      ],
      "description": "What brought the harm into public visibility. See vocabularies/oversight_trigger.json."
    },
    "oversight_date": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$",
      "description": "Date of the oversight event in YYYY, YYYY-MM, or YYYY-MM-DD. Null if unknown."
    },
    "remedy_status": {
      "type": "string",
      "enum": [
        "none",
        "partial",
        "full",
        "ongoing",
        "unknown"
      ],
      "description": "Degree of remediation applied. See vocabularies/remedy_status.json."
    },
    "documentation_status": {
      "type": "string",
      "enum": [
        "verified"
      ],
      "description": "Published records are always 'verified': checked by the author against their sources."
    },
    "summary_50w": {
      "type": "string",
      "minLength": 10,
      "maxLength": 500,
      "description": "Factual summary of the case, 40-60 words. No personal details, no PII."
    },
    "sources": {
      "type": "array",
      "minItems": 0,
      "items": {
        "type": "object",
        "required": [
          "type",
          "title",
          "url",
          "publisher",
          "date",
          "access_date",
          "is_primary"
        ],
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "court_ruling",
              "regulatory_decision",
              "parliamentary_inquiry",
              "ngo_report",
              "journalism",
              "academic_paper",
              "audit_report",
              "whistleblower_disclosure",
              "press_release",
              "official_statement",
              "other"
            ]
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https?://"
          },
          "publisher": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "date": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$"
          },
          "access_date": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
          },
          "is_primary": {
            "type": "boolean"
          },
          "language": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
          },
          "notes": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500
          }
        }
      },
      "description": "List of public sources supporting this case. At least one required."
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[a-z0-9_]+$",
        "maxLength": 60
      },
      "uniqueItems": true,
      "description": "Optional tags for cross-cutting themes (e.g. 'eu_ai_act_risk', 'court_ruled_unlawful')."
    },
    "extraction_metadata": {
      "type": "object",
      "required": [
        "first_collected",
        "last_verified",
        "verified_by"
      ],
      "additionalProperties": false,
      "properties": {
        "first_collected": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 datetime when record was first collected."
        },
        "last_verified": {
          "type": "string",
          "format": "date-time",
          "description": "ISO 8601 datetime when record was last verified."
        },
        "verified_by": {
          "type": "string",
          "enum": [
            "human_review",
            "automated"
          ],
          "description": "Whether verification was performed by a human or automated check."
        }
      }
    },
    "short_title": {
      "type": [
        "string",
        "null"
      ],
      "description": "Short human-readable title (about 8 words). The full descriptive title is in 'title'."
    }
  }
}
