{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/crosstabs-com/json-schema/crosstabs-com-odds-ratio-response-schema.json",
  "title": "OddsRatioResponse",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/crosstabs-com-openapi.json#/components/schemas/OddsRatioResponse",
  "type": "object",
  "properties": {
    "input": {
      "$ref": "#/$defs/Input"
    },
    "docs": {
      "type": "string",
      "const": "https://www.crosstabs.com/developers"
    },
    "oddsRatio": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "value": {
              "type": [
                "number",
                "null"
              ]
            },
            "valueState": {
              "type": "string",
              "enum": [
                "finite",
                "positive_infinity"
              ]
            },
            "ci95": {
              "type": "array",
              "items": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "minItems": 2,
              "maxItems": 2
            },
            "ci95States": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "finite",
                  "positive_infinity"
                ]
              },
              "minItems": 2,
              "maxItems": 2
            },
            "method": {
              "type": "string",
              "const": "sample odds ratio with Woolf log interval"
            }
          },
          "required": [
            "value",
            "valueState",
            "ci95",
            "ci95States",
            "method"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "fishersExactP": {
      "anyOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        {
          "type": "null"
        }
      ]
    },
    "fishersExactUnavailableReason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        null,
        "not_2x2",
        "invalid_counts",
        "unsafe_integer_counts",
        "non_positive_margins",
        "workload_limit",
        "disabled_by_caller"
      ]
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "input",
    "docs",
    "oddsRatio",
    "fishersExactP",
    "fishersExactUnavailableReason",
    "note"
  ],
  "$defs": {
    "FrequencyMatrix": {
      "type": "array",
      "minItems": 2,
      "maxItems": 12,
      "items": {
        "type": "array",
        "minItems": 2,
        "maxItems": 12,
        "items": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000000000
        }
      },
      "description": "Additional runtime constraints: rectangular rows; grand total ≤ 1000000000000; every row and column sum must be positive. Ordinary JSON Schema cannot enforce these cross-cell sums.",
      "x-grand-total-maximum": 1000000000000
    },
    "Input": {
      "type": "object",
      "properties": {
        "table": {
          "$ref": "#/$defs/FrequencyMatrix"
        },
        "n": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000000000000
        },
        "rows": {
          "type": "integer",
          "minimum": 2,
          "maximum": 12
        },
        "cols": {
          "type": "integer",
          "minimum": 2,
          "maximum": 12
        }
      },
      "required": [
        "table",
        "n",
        "rows",
        "cols"
      ]
    }
  }
}