{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/amigo/main/json-schema/amigo-patient-topology-response-schema.json",
  "title": "PatientTopologyResponse",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amigo-m42-api-openapi.yml#/components/schemas/PatientTopologyResponse",
  "properties": {
    "workspace_id": {
      "type": "string",
      "format": "uuid",
      "title": "Workspace Id"
    },
    "count": {
      "type": "integer",
      "title": "Count"
    },
    "items": {
      "items": {
        "$ref": "#/$defs/PatientTopologyRow"
      },
      "type": "array",
      "title": "Items"
    }
  },
  "type": "object",
  "required": [
    "workspace_id",
    "count",
    "items"
  ],
  "$defs": {
    "PatientTopologyRow": {
      "properties": {
        "workspace_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "string",
              "const": "labs"
            }
          ],
          "title": "Workspace Id"
        },
        "patient_id": {
          "type": "string",
          "title": "Patient Id"
        },
        "umap_x": {
          "type": "number",
          "title": "Umap X"
        },
        "umap_y": {
          "type": "number",
          "title": "Umap Y"
        },
        "pca_x": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pca X"
        },
        "pca_y": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pca Y"
        },
        "pca_z": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pca Z"
        },
        "cluster_name": {
          "type": "string",
          "title": "Cluster Name"
        },
        "age_bucket": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Age Bucket"
        },
        "gender": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Gender"
        },
        "nationality": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Nationality"
        },
        "district": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "District"
        },
        "charlson_cci": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Charlson Cci"
        },
        "bmi_latest": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bmi Latest"
        },
        "hba1c_latest": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Hba1C Latest"
        },
        "risk_tier": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Risk Tier"
        },
        "y_hat_t2d_1yr": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Y Hat T2D 1Yr"
        },
        "y_hat_htn_1yr": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Y Hat Htn 1Yr"
        },
        "y_hat_chf_90d": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Y Hat Chf 90D"
        },
        "y_hat_asthma_12mo": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Y Hat Asthma 12Mo"
        },
        "y_hat_ckd_1yr": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Y Hat Ckd 1Yr"
        },
        "y_hat_copd_12mo": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Y Hat Copd 12Mo"
        },
        "y_hat_composite": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Y Hat Composite"
        },
        "emergence_month": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Emergence Month"
        }
      },
      "type": "object",
      "required": [
        "workspace_id",
        "patient_id",
        "umap_x",
        "umap_y",
        "cluster_name"
      ],
      "title": "PatientTopologyRow"
    }
  }
}