{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "6thsense exploratory annotation dataset v0.1",
  "description": "Cross-field time ordering, full subtask coverage, parent containment and evidence PTS agreement are checked by the local integrity validator.",
  "type": "object",
  "required": [
    "schema_version",
    "dataset_id",
    "status",
    "local_semantic_model_run",
    "external_api_calls",
    "clips"
  ],
  "properties": {
    "schema_version": {
      "const": "0.1.0"
    },
    "dataset_id": {
      "type": "string"
    },
    "status": {
      "const": "assistant_draft_not_ground_truth"
    },
    "local_semantic_model_run": {
      "const": false
    },
    "external_api_calls": {
      "const": 0
    },
    "clips": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/clip"
      }
    }
  },
  "$defs": {
    "clip": {
      "type": "object",
      "required": [
        "id",
        "source",
        "sha256",
        "duration_s",
        "observed_activity",
        "inferred_goal",
        "assigned_instruction",
        "visible_outcome",
        "task_success",
        "objects",
        "subtasks",
        "actions"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "duration_s": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "observed_activity": {
          "type": "string"
        },
        "inferred_goal": {
          "type": "string"
        },
        "assigned_instruction": {
          "type": [
            "string",
            "null"
          ]
        },
        "visible_outcome": {
          "type": "string"
        },
        "task_success": {
          "const": "unknown"
        },
        "unknowns": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "objects": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "description"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "description": {
                "type": "string"
              }
            }
          }
        },
        "subtasks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/segment"
          }
        },
        "actions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/segment"
          }
        }
      }
    },
    "segment": {
      "type": "object",
      "required": [
        "id",
        "level",
        "parent_id",
        "start_s",
        "end_s",
        "label",
        "hands",
        "object_ids",
        "evidence_description",
        "evidence_frames",
        "start_boundary",
        "end_boundary",
        "uncertainty",
        "provenance",
        "review_status"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "level": {
          "enum": [
            "subtask",
            "action"
          ]
        },
        "parent_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "start_s": {
          "type": "number",
          "minimum": 0
        },
        "end_s": {
          "type": "number",
          "minimum": 0
        },
        "label": {
          "type": "string",
          "minLength": 1
        },
        "verb": {
          "type": [
            "string",
            "null"
          ]
        },
        "hands": {
          "enum": [
            "left",
            "right",
            "both",
            "unknown"
          ]
        },
        "hand_roles": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "object_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "state_before": {
          "type": [
            "string",
            "null"
          ]
        },
        "state_after": {
          "type": [
            "string",
            "null"
          ]
        },
        "evidence_description": {
          "type": "string"
        },
        "evidence_frames": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/evidence"
          }
        },
        "start_boundary": {
          "$ref": "#/$defs/boundary"
        },
        "end_boundary": {
          "$ref": "#/$defs/boundary"
        },
        "uncertainty": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "provenance": {
          "const": "assistant_visual_review"
        },
        "review_status": {
          "enum": [
            "pending",
            "accepted",
            "needs_changes"
          ]
        },
        "review_note": {
          "type": "string"
        },
        "revisions": {
          "type": "array",
          "items": {
            "type": "object"
          }
        }
      }
    },
    "evidence": {
      "type": "object",
      "required": [
        "frame_index",
        "time_s",
        "source_pts_s",
        "image"
      ],
      "properties": {
        "frame_index": {
          "type": "integer",
          "minimum": 0
        },
        "time_s": {
          "type": "number",
          "minimum": 0
        },
        "source_pts_s": {
          "type": "number"
        },
        "image": {
          "type": "string"
        }
      }
    },
    "boundary": {
      "type": "object",
      "required": [
        "estimate_s",
        "range_s",
        "basis",
        "clip_edge"
      ],
      "properties": {
        "estimate_s": {
          "type": "number",
          "minimum": 0
        },
        "range_s": {
          "type": "array",
          "items": {
            "type": "number",
            "minimum": 0
          },
          "minItems": 2,
          "maxItems": 2
        },
        "basis": {
          "type": "string"
        },
        "clip_edge": {
          "type": "boolean"
        }
      }
    }
  }
}
