{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/centaur-labs/main/json-schema/centaur-labs-case-result-schema.json",
  "title": "CaseResult",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/centaur-labs-label-apis-openapi.yml#/components/schemas/CaseResult",
  "type": "object",
  "properties": {
    "task_id": {
      "type": "integer",
      "description": "The task ID."
    },
    "task_name": {
      "type": "string",
      "description": "The task name."
    },
    "project_id": {
      "type": "integer",
      "description": "The project ID."
    },
    "project_name": {
      "type": "string",
      "description": "The project name."
    },
    "case_id": {
      "type": "integer",
      "description": "The case ID."
    },
    "task_type": {
      "type": "string",
      "description": "The labeling task (e.g. choice, box, circle, etc.)"
    },
    "content_type": {
      "type": "string",
      "description": "The content type of the task (e.g. image, video, etc.)"
    },
    "labeling_state": {
      "type": "string",
      "description": "The labeling state of the case (e.g. Labeled, Gold Standard, etc.)"
    },
    "n_qualified_opinions": {
      "type": "integer",
      "description": "The number of qualified opinions collected for the case."
    },
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "content_metadata": {
            "type": "array",
            "items": {
              "$ref": "#/$defs/ContentMetadata"
            }
          },
          "prelabel": {
            "type": "array",
            "description": "The pre-label for the content element.  Included for non-classification tasks only.",
            "items": {
              "$ref": "#/$defs/ClassAnswer"
            }
          },
          "correct_annotation": {
            "type": "array",
            "description": "The correct annotation for the content element being labeled.",
            "items": {
              "$ref": "#/$defs/ClassAnswer"
            }
          },
          "combined_opinion": {
            "type": "array",
            "description": "The combined opinion for the content element based on labeler opinions.",
            "items": {
              "$ref": "#/$defs/ClassAnswer"
            }
          },
          "correct_annotation_classes": {
            "type": [
              "array",
              "null"
            ],
            "description": "The correct answer classes for the content element being labeled.  Included for classification tasks only.",
            "items": {
              "type": "string"
            }
          },
          "combined_opinion_classes": {
            "type": [
              "array",
              "null"
            ],
            "description": "The answer classes for the combined opinion for the content element.  Included for classification tasks only.",
            "items": {
              "type": "string"
            }
          },
          "agreement": {
            "type": [
              "number",
              "null"
            ],
            "description": "The agreement between labeler opinions on the content element within the case."
          },
          "difficulty": {
            "type": [
              "number",
              "null"
            ],
            "description": "The difficulty of the content element within the case."
          },
          "answer_class_stats": {
            "type": "array",
            "description": "The opinion statistics for each answer class in the case.",
            "items": {
              "$ref": "#/$defs/AnswerClassStats"
            }
          }
        }
      }
    },
    "top_reads": {
      "type": "array",
      "description": "The list of top labeler opinions used to create the combined opinion for the case. Included for non-cuboid task types.",
      "maxItems": 500,
      "items": {
        "type": "object",
        "properties": {
          "read_id": {
            "type": "integer",
            "description": "An identifier for the labeler opinion."
          },
          "user_id": {
            "type": "integer",
            "description": "The ID of the labeler who submitted the opinion."
          },
          "qscore": {
            "type": "number",
            "description": "The confidence level of the user opinion."
          }
        }
      }
    },
    "patch": {
      "type": [
        "string",
        "null"
      ],
      "description": "An identifier for the patch within the image."
    },
    "internal_notes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Internal notes for the case."
    },
    "explanation": {
      "type": [
        "string",
        "null"
      ],
      "description": "Explanation for the case."
    },
    "pre_answer_explainer": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pre-answer explainer for the case."
    },
    "tags": {
      "type": "array",
      "description": "Tags associated with the case.",
      "items": {
        "type": "string"
      }
    },
    "comments": {
      "type": "array",
      "description": "Comments submitted by users on the case.",
      "items": {
        "type": "string"
      }
    },
    "flags": {
      "type": "array",
      "description": "Messages submitted by users who flagged the case.",
      "items": {
        "type": "string"
      }
    },
    "static_highlight_ranges": {
      "type": "array",
      "description": "Range and text for static highlighted ranges",
      "items": {
        "type": "object",
        "properties": {
          "range": {
            "type": "array",
            "description": "The range for static highlights",
            "items": {
              "type": "array",
              "items": {
                "type": "integer"
              },
              "minItems": 2,
              "maxItems": 2
            }
          },
          "text": {
            "type": "string",
            "description": "The text for the static highlighted range"
          }
        }
      }
    }
  },
  "$defs": {
    "AnswerClassStats": {
      "type": "object",
      "properties": {
        "answer_class": {
          "type": "string",
          "description": "The answer class for the case."
        },
        "n_qualified_opinions": {
          "type": "integer",
          "description": "The number of qualified opinions supporting the answer class (i.e. classification opinions including it, or segmentation/range opinions including a finding of the answer class)."
        },
        "sum_confidence_scores": {
          "type": "number",
          "description": "The sum of confidence scores (each between 0 and 1) of the supporting opinions for the answer class."
        },
        "agreement": {
          "type": [
            "number",
            "null"
          ],
          "description": "The agreement between labeler opinions on the answer class."
        },
        "difficulty": {
          "type": [
            "number",
            "null"
          ],
          "description": "The difficulty of the answer class on the content element being labeled."
        }
      }
    },
    "ClassAnswer": {
      "type": "object",
      "properties": {
        "answer_class": {
          "type": "string",
          "description": "The label class within the answer (correct annotation, combined opinion, or labeler opinion)."
        },
        "is_correct": {
          "type": "boolean",
          "description": "Whether the answer includes the class. Included for classification tasks only."
        },
        "geometries": {
          "type": [
            "array",
            "null"
          ],
          "description": "The segmentation for the answer class in WKT format. Included for contour segmentation tasks only.",
          "items": {
            "type": "string"
          }
        },
        "mask": {
          "type": [
            "string",
            "null"
          ],
          "description": "A pre-signed URL to the segmentation for the answer class in mask (TIFF binary array) format. Included for mask segmentation tasks only."
        },
        "ranges": {
          "type": [
            "array",
            "null"
          ],
          "description": "The integer ranges for the answer class. Included for range tasks only.",
          "items": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "minItems": 2,
            "maxItems": 2
          }
        },
        "entities": {
          "type": [
            "array",
            "null"
          ],
          "description": "The entities for the answer class. Included for NER tasks only.",
          "items": {
            "type": "string"
          }
        },
        "freetexts": {
          "type": [
            "array",
            "null"
          ],
          "description": "An array of freetexts with one entry (array or null) per finding.",
          "items": {
            "type": [
              "array",
              "null"
            ],
            "description": "An array of freetexts for one specific finding. May contain 0, 1, or multiple text entries.",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "ContentMetadata": {
      "type": "object",
      "properties": {
        "content_id": {
          "type": "integer",
          "description": "An identifier for the content."
        },
        "origin": {
          "type": "string",
          "description": "An identifier for the file origin of the content."
        },
        "created_at": {
          "type": "string",
          "description": "Timestamp that content was created."
        },
        "series": {
          "type": [
            "string",
            "null"
          ],
          "description": "An identifier for the series that the content belongs to."
        },
        "series_index": {
          "type": [
            "integer",
            "null"
          ],
          "description": "The index of the content within the series (if any) that it belongs to."
        },
        "dicom_study_uid": {
          "type": [
            "string",
            "null"
          ],
          "description": "The DICOM study UID of the content."
        },
        "dicom_series_uid": {
          "type": [
            "string",
            "null"
          ],
          "description": "The DICOM series UID of the content."
        },
        "dicom_instance_uid": {
          "type": [
            "string",
            "null"
          ],
          "description": "The DICOM instance UID of the content."
        }
      }
    }
  }
}