{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/docupanda/json-schema/docupanda-analysis-schema.json",
  "title": "Analysis",
  "description": "Public-facing representation of DocuPipeAnalysis.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/docupanda-analysis-api-openapi.yml#/components/schemas/Analysis",
  "properties": {
    "analysisId": {
      "type": "string",
      "title": "Analysis ID",
      "description": "Unique identifier of the analysis object."
    },
    "jobId": {
      "type": "string",
      "title": "Job ID",
      "description": "Unique identifier of the job that created the analysis."
    },
    "documentIds": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Document IDs",
      "description": "List of document IDs that were analyzed."
    },
    "filename": {
      "type": "string",
      "title": "Filename",
      "description": "Name of the file that was analyzed, if there is only a single document."
    },
    "dataset": {
      "type": "string",
      "title": "Dataset",
      "description": "Dataset which defines what documents are included in the analysis."
    },
    "schemaId": {
      "type": "string",
      "title": "Schema ID",
      "description": "Unique identifier of the schema used to fetch standardizations for querying."
    },
    "numDocs": {
      "type": "integer",
      "title": "Number of Documents",
      "description": "Number of documents analyzed."
    },
    "pages": {
      "items": {
        "type": "integer"
      },
      "type": "array",
      "title": "Pages",
      "description": "List of page numbers to analyze. If none, all pages are analyzed. Only applies for single document."
    },
    "data": {
      "items": {
        "$ref": "#/$defs/QuestionAnswer"
      },
      "type": "array",
      "title": "Data (Questions and Answers)",
      "description": "List of questions and answers for the analysis, along with confidence and citations."
    },
    "timestamp": {
      "type": "string",
      "title": "Timestamp",
      "description": "Timestamp of the analysis job."
    }
  },
  "type": "object",
  "required": [
    "analysisId",
    "jobId",
    "data"
  ],
  "$defs": {
    "Citation": {
      "properties": {
        "documentId": {
          "type": "string",
          "title": "Document ID",
          "description": "Unique identifier of the document where the citation is found."
        },
        "pages": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "title": "Pages",
          "description": "List of page numbers where the citation is found (zero-indexed)."
        }
      },
      "type": "object",
      "required": [
        "documentId",
        "pages"
      ],
      "title": "Citation"
    },
    "Confidence": {
      "type": "string",
      "enum": [
        "high",
        "medium",
        "low"
      ],
      "title": "Confidence"
    },
    "QuestionAnswer": {
      "properties": {
        "question": {
          "type": "string",
          "title": "Question",
          "description": "The question to be answered."
        },
        "answer": {
          "type": "string",
          "title": "Answer",
          "description": "The answer to the question."
        },
        "confidence": {
          "$ref": "#/$defs/Confidence",
          "description": "The confidence level of the answer."
        },
        "citations": {
          "items": {
            "$ref": "#/$defs/Citation"
          },
          "type": "array",
          "title": "Citations",
          "description": "List of citations for the answer."
        }
      },
      "type": "object",
      "required": [
        "question"
      ],
      "title": "QuestionAnswer"
    }
  }
}