{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/backworkhealth-com/json-schema/backworkhealth-com-claim-validation-result-schema.json",
  "title": "ClaimValidationResult",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/backworkhealth-com-v1-openapi.json#/components/schemas/ClaimValidationResult",
  "type": "object",
  "properties": {
    "payer": {
      "type": [
        "string",
        "null"
      ]
    },
    "plan_type": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "commercial",
            "medicare_advantage",
            "medicaid",
            "traditional_medicare",
            "exchange"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "line_of_business": {
      "type": [
        "string",
        "null"
      ]
    },
    "state": {
      "type": [
        "string",
        "null"
      ]
    },
    "date_of_service": {
      "description": "YYYY-MM-DD date of service, when supplied",
      "type": [
        "string",
        "null"
      ]
    },
    "site_of_service": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "office",
            "outpatient_hospital",
            "asc",
            "inpatient",
            "home",
            "telehealth"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "provider_specialty": {
      "type": [
        "string",
        "null"
      ]
    },
    "modifiers": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "overall_risk": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high"
      ]
    },
    "coverage_status": {
      "type": "string",
      "enum": [
        "covered",
        "conditional",
        "not_covered",
        "unknown"
      ]
    },
    "prior_auth_required": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "denial_risk": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high"
      ]
    },
    "confidence": {
      "type": "string",
      "enum": [
        "high",
        "medium",
        "low"
      ]
    },
    "documentation_requirements": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "policy_sources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ClaimValidationPolicySource"
      },
      "description": "All source references used by validation, including policy sources and other rule/data sources."
    },
    "effective_date": {
      "type": [
        "string",
        "null"
      ]
    },
    "last_verified_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "requires_manual_review": {
      "type": "boolean"
    },
    "known_gaps": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "issues": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Aggregate issues that should be resolved before authorization or claim submission."
    },
    "matched_policies": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ClaimValidationPolicySource"
      },
      "description": "Policy-only evidence rows matched to the validated procedure codes."
    },
    "codes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ClaimValidationCodeResult"
      }
    },
    "mac": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "jurisdiction": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "jurisdiction"
      ]
    }
  },
  "required": [
    "payer",
    "plan_type",
    "line_of_business",
    "state",
    "date_of_service",
    "site_of_service",
    "provider_specialty",
    "modifiers",
    "overall_risk",
    "coverage_status",
    "prior_auth_required",
    "denial_risk",
    "confidence",
    "documentation_requirements",
    "policy_sources",
    "effective_date",
    "last_verified_at",
    "requires_manual_review",
    "known_gaps",
    "issues",
    "matched_policies",
    "codes"
  ],
  "$defs": {
    "ClaimValidationCodeResult": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "code_type": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "coverage_status": {
          "type": "string",
          "enum": [
            "covered",
            "conditional",
            "not_covered",
            "unknown"
          ]
        },
        "prior_auth_required": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "pa_required": {
          "description": "Alias of `prior_auth_required`",
          "type": [
            "boolean",
            "null"
          ]
        },
        "denial_risk": {
          "type": "string",
          "enum": [
            "low",
            "medium",
            "high"
          ]
        },
        "confidence": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "documentation_requirements": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "policy_sources": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ClaimValidationPolicySource"
          }
        },
        "effective_date": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_verified_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "requires_manual_review": {
          "type": "boolean"
        },
        "known_gaps": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "policy_count": {
          "type": "integer"
        }
      },
      "required": [
        "code",
        "code_type",
        "description",
        "coverage_status",
        "prior_auth_required",
        "pa_required",
        "denial_risk",
        "confidence",
        "documentation_requirements",
        "policy_sources",
        "effective_date",
        "last_verified_at",
        "requires_manual_review",
        "known_gaps",
        "issues",
        "policy_count"
      ]
    },
    "ClaimValidationPolicySource": {
      "type": "object",
      "properties": {
        "source_id": {
          "type": "string"
        },
        "policy_id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "policy_type": {
          "type": "string"
        },
        "jurisdiction": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "effective_date": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_verified_at": {
          "description": "ISO 8601 timestamp of the last source verification",
          "type": [
            "string",
            "null"
          ]
        },
        "public_url": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ],
          "description": "Backwork's public page for this policy, or null when it has none. Active Medicare LCDs, Articles and NCDs: `https://backworkhealth.com/policy/{policy_id}`. Active commercial policies: `https://backworkhealth.com/policy/payer/{payer_slug}/{policy_id}`. A retired commercial policy points to its active successor's page when one is known."
        },
        "source_check": {
          "anyOf": [
            {
              "$ref": "#/$defs/SourceCheck"
            },
            {
              "type": "null"
            }
          ],
          "description": "Source provenance for this policy; null only when the policy is no longer on record."
        }
      },
      "required": [
        "source_id",
        "policy_id",
        "title",
        "policy_type",
        "jurisdiction",
        "source_url",
        "effective_date",
        "last_verified_at",
        "public_url",
        "source_check"
      ]
    },
    "SourceAccuracy": {
      "type": "object",
      "properties": {
        "field": {
          "type": "string",
          "enum": [
            "overall",
            "title",
            "effective_date",
            "codes",
            "link"
          ],
          "description": "What the audit measured: `overall` for the policy record as a whole, or one field of it (`title`, `effective_date`, `codes`, `link`)."
        },
        "sampled_at": {
          "type": "string",
          "format": "date-time",
          "description": "When the audit drew its sample."
        },
        "sample_size": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "description": "How many of this source's policy records the audit sampled."
        },
        "accuracy": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Share of the sampled records whose `field` matched the source document, from 0 to 1: the records that matched divided by `sample_size`."
        },
        "ci_low": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Lower bound of the 95% Wilson score confidence interval for `accuracy`."
        },
        "ci_high": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "Upper bound of the 95% Wilson score confidence interval for `accuracy`."
        },
        "method": {
          "type": "string",
          "description": "How the audit decided whether a sampled record matched its source, as Backwork names the method."
        }
      },
      "required": [
        "field",
        "sampled_at",
        "sample_size",
        "accuracy",
        "ci_low",
        "ci_high",
        "method"
      ],
      "description": "The most recent audit of one field for the policy's source. It measures a sample of the source's policy records, not this policy alone."
    },
    "SourceCheck": {
      "type": "object",
      "properties": {
        "source_url": {
          "type": "string",
          "description": "The URL Backwork fetches this policy from."
        },
        "last_fetched_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "description": "When Backwork last fetched the policy from `source_url`; null when no fetch time is recorded. The payer may have changed the document since."
        },
        "content_sha256": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            {
              "type": "null"
            }
          ],
          "description": "SHA-256 of the content Backwork fetched, as 64 lowercase hex characters; null when the loader did not record one. Compare it across responses to see whether the fetched content changed."
        },
        "source_accuracy": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/SourceAccuracy"
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "The latest audit for each field Backwork has audited for this policy's source, `overall` first. null when the policy has no recorded source or its source has no audit yet."
        }
      },
      "required": [
        "source_url",
        "last_fetched_at",
        "content_sha256",
        "source_accuracy"
      ],
      "description": "Where and when Backwork last fetched this policy, a hash of the fetched content, and the sampled accuracy that audits measured for its source."
    }
  }
}