{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/healthtensor/json-schema/healthtensor-analysis-run-status-response-schema.json",
  "title": "AnalysisRunStatusResponse",
  "description": "Response body for the /outpatient/analysis-runs/{run_id} endpoint.",
  "x-generated": "2026-12-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/healthtensor-openapi.json#/components/schemas/AnalysisRunStatusResponse",
  "properties": {
    "run_id": {
      "type": "string",
      "format": "uuid",
      "title": "Run Id",
      "description": "Analysis run ID"
    },
    "regard_patient_id": {
      "type": "string",
      "title": "Regard Patient Id",
      "description": "Regard patient ID the run analyzes"
    },
    "status": {
      "$ref": "#/$defs/AnalysisJobStatus",
      "description": "'running' until the run finishes. 'succeeded' when findings were stored, 'skipped' when every note had already been analyzed, 'failed' when the run failed, and 'timed_out' when it exceeded the run limit. Findings from earlier runs are left in place when a run fails or times out."
    },
    "started_at": {
      "type": "string",
      "format": "date-time",
      "title": "Started At",
      "description": "When the run started"
    },
    "finished_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Finished At",
      "description": "When the run finished, or null while it is running"
    },
    "error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error",
      "description": "Why the run failed or timed out, or null"
    }
  },
  "type": "object",
  "required": [
    "run_id",
    "regard_patient_id",
    "status",
    "started_at",
    "finished_at",
    "error"
  ],
  "$defs": {
    "AnalysisJobStatus": {
      "type": "string",
      "enum": [
        "running",
        "succeeded",
        "skipped",
        "failed",
        "timed_out"
      ],
      "title": "AnalysisJobStatus",
      "description": "Lifecycle status of an asynchronous patient analysis job."
    }
  }
}