{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/med-reveal-com/json-schema/med-reveal-com-benchmark-request-schema.json",
  "title": "BenchmarkRequest",
  "description": "Request for market benchmarking.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/med-reveal-com-openapi.json#/components/schemas/BenchmarkRequest",
  "properties": {
    "filters": {
      "$ref": "#/$defs/BenchmarkFilters"
    },
    "metrics": {
      "anyOf": [
        {
          "$ref": "#/$defs/BenchmarkMetrics"
        },
        {
          "type": "null"
        }
      ],
      "description": "Metrics configuration"
    },
    "groupBy": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Groupby",
      "description": "Fields to group by: 'payer', 'billing_code', 'state'",
      "default": [
        "payer",
        "billing_code"
      ]
    }
  },
  "type": "object",
  "required": [
    "filters"
  ],
  "$defs": {
    "BenchmarkFilters": {
      "properties": {
        "states": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "minItems": 1,
          "title": "States",
          "description": "List of state codes (e.g., ['MA', 'TX'])"
        },
        "payers": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "minItems": 1,
          "title": "Payers",
          "description": "List of payer codes: uhc, cigna, aetna, bcbs"
        },
        "billingCodeAndTypes": {
          "items": {
            "$ref": "#/$defs/BillingCodeWithType"
          },
          "type": "array",
          "minItems": 1,
          "title": "Billingcodeandtypes",
          "description": "List of billing codes with types"
        },
        "taxonomyCodes": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Taxonomycodes",
          "description": "List of taxonomy codes"
        },
        "serviceCodes": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Servicecodes",
          "description": "List of service codes"
        },
        "billingCodeModifiers": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Billingcodemodifiers",
          "description": "List of billing code modifiers"
        },
        "negotiatedTypes": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Negotiatedtypes",
          "description": "Filter by negotiated types (e.g., 'negotiated', 'fee schedule')"
        },
        "billingClasses": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Billingclasses",
          "description": "Filter by billing classes (e.g., 'professional')"
        }
      },
      "type": "object",
      "required": [
        "states",
        "payers",
        "billingCodeAndTypes"
      ],
      "title": "BenchmarkFilters",
      "description": "Filters for benchmarking query."
    },
    "BenchmarkMetrics": {
      "properties": {
        "aggregations": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Aggregations",
          "description": "List of aggregations to compute",
          "default": [
            "mean",
            "median",
            "percentile_25",
            "percentile_50",
            "percentile_75",
            "percentile_90",
            "percentile_95"
          ]
        }
      },
      "type": "object",
      "title": "BenchmarkMetrics",
      "description": "Metrics configuration for benchmarking."
    },
    "BillingCodeWithType": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code",
          "description": "Billing code (e.g., '99213')"
        },
        "type": {
          "type": "string",
          "title": "Type",
          "description": "Code type: 'CPT' or 'HCPCS'"
        }
      },
      "type": "object",
      "required": [
        "code",
        "type"
      ],
      "title": "BillingCodeWithType",
      "description": "Billing code with its type (CPT or HCPCS)."
    }
  }
}