{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/healthtensor/json-schema/healthtensor-analyze-patient-request-schema.json",
  "title": "AnalyzePatientRequest",
  "description": "Request body for the /outpatient/analyze-patient endpoint.",
  "x-generated": "2026-12-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/healthtensor-openapi.json#/components/schemas/AnalyzePatientRequest",
  "properties": {
    "customer_regard_id": {
      "type": "string",
      "title": "Customer Regard Id",
      "description": "Regard customer identifier for routing"
    },
    "regard_patient_id": {
      "type": "string",
      "title": "Regard Patient Id",
      "description": "Regard patient ID (UUID) to analyze"
    },
    "reference_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reference Date",
      "description": "Date the system treats as 'today' for the note lookback window. Defaults to the current date when not provided."
    },
    "lookback_days": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 3650.0,
          "minimum": 1.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Lookback Days",
      "description": "Number of days to look back from reference_date for notes. Defaults to 730 (approximately 2 years) when not provided."
    },
    "icd10_system_prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Icd10 System Prompt",
      "description": "Optional override for the ICD-10 identification system prompt. Uses the default when not provided."
    },
    "reconciliation_system_prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reconciliation System Prompt",
      "description": "Optional override for the cross-note reconciliation system prompt. Uses the default when not provided."
    },
    "force": {
      "type": "boolean",
      "title": "Force",
      "description": "When true, re-analyze all notes even if previous results exist. Ignores cached note findings and runs the full LLM pipeline on every note.",
      "default": false
    },
    "mode": {
      "type": "string",
      "enum": [
        "full",
        "reconcile_only"
      ],
      "title": "Mode",
      "description": "Pipeline mode. 'full' (default) runs extraction on new notes, then reconciliation and cleanup. 'reconcile_only' reuses the patient's existing note findings verbatim (no extraction) and re-runs only reconciliation, cleanup, and HCC mapping — for measuring post-extraction changes against a frozen extraction input. Fails if the patient has no existing findings.",
      "default": "full"
    },
    "use_new_analysis_pipeline": {
      "type": "boolean",
      "title": "Use New Analysis Pipeline",
      "description": "When true, run the two-call split reconciler (group+state, then select) instead of the single monolithic reconciliation call.",
      "default": false
    },
    "explain_drops": {
      "type": "boolean",
      "title": "Explain Drops",
      "description": "When true, the reconciler also returns each input code it did not carry into output, with a one-line reason.",
      "default": false
    }
  },
  "type": "object",
  "required": [
    "customer_regard_id",
    "regard_patient_id"
  ]
}