{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://temyrion.com/schemas/clinical-summary-gold-set-demo.schema.json",
  "title": "Temyrion Clinical Summary Gold Set Demo",
  "type": "object",
  "required": [
    "example_id",
    "product_id",
    "specialty",
    "target_label",
    "case_title",
    "task",
    "source_bundle",
    "model_output",
    "review",
    "source_spans",
    "adjudication",
    "export_metadata"
  ],
  "properties": {
    "example_id": {
      "type": "string",
      "pattern": "^CSG-DEMO-[0-9]{3}$"
    },
    "product_id": {
      "const": "temyrion-demo"
    },
    "specialty": {
      "type": "string",
      "minLength": 1
    },
    "target_label": {
      "enum": ["accepted", "minor issue", "major issue", "unsafe"]
    },
    "case_title": {
      "type": "string",
      "minLength": 1
    },
    "task": {
      "type": "string",
      "minLength": 1
    },
    "source_bundle": {
      "type": "object",
      "required": ["referral_letter", "medication_list", "labs_diagnostics"],
      "properties": {
        "referral_letter": { "type": "string", "minLength": 1 },
        "medication_list": { "type": "string", "minLength": 1 },
        "labs_diagnostics": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "model_output": {
      "type": "string",
      "minLength": 1
    },
    "review": {
      "type": "object",
      "required": ["dimension_scores", "safety_flag", "final_label", "failure_taxonomy", "rationale"],
      "properties": {
        "dimension_scores": {
          "type": "object",
          "required": ["faithfulness", "clinical_accuracy", "completeness", "safety", "actionability"],
          "properties": {
            "faithfulness": { "type": "integer", "minimum": 1, "maximum": 5 },
            "clinical_accuracy": { "type": "integer", "minimum": 1, "maximum": 5 },
            "completeness": { "type": "integer", "minimum": 1, "maximum": 5 },
            "safety": { "type": "integer", "minimum": 1, "maximum": 5 },
            "actionability": { "type": "integer", "minimum": 1, "maximum": 5 }
          },
          "additionalProperties": false
        },
        "safety_flag": {
          "enum": ["no issue", "minor issue", "major issue", "unsafe"]
        },
        "final_label": {
          "enum": ["accepted", "minor issue", "major issue", "unsafe"]
        },
        "failure_taxonomy": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 },
          "maxItems": 8
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "source_spans": {
      "type": "array",
      "minItems": 1,
      "maxItems": 8,
      "items": {
        "type": "object",
        "required": ["source", "quote", "supports"],
        "properties": {
          "source": { "enum": ["referral_letter", "medication_list", "labs_diagnostics"] },
          "quote": { "type": "string", "minLength": 1 },
          "supports": { "type": "string", "minLength": 1 }
        },
        "additionalProperties": false
      }
    },
    "adjudication": {
      "type": "object",
      "required": ["reviewer_labels", "final_label", "note"],
      "properties": {
        "reviewer_labels": {
          "type": "array",
          "items": { "enum": ["accepted", "minor issue", "major issue", "unsafe"] },
          "minItems": 2,
          "maxItems": 2
        },
        "final_label": {
          "enum": ["accepted", "minor issue", "major issue", "unsafe"]
        },
        "note": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "export_metadata": {
      "type": "object",
      "required": ["sample_status", "version", "language", "context", "no_phi"],
      "properties": {
        "sample_status": { "const": "synthetic_public_demo" },
        "version": { "type": "string" },
        "language": { "const": "en" },
        "context": { "type": "string" },
        "no_phi": { "const": true }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
