{
  "$id": "https://schemas.mapi.dev/v1/api-ScorecardItem.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "examples": [
    {
      "code": "RHAT_OK",
      "message_plain": "All chains got the same answer.",
      "metric": "r_hat_max",
      "status": "pass",
      "threshold": 1.01,
      "title": "Chains agree",
      "value": 1.004
    },
    {
      "category": "holdout",
      "check": "holdout.mape",
      "code": "HOLDOUT_MAPE",
      "docs_anchor": "check-holdout-mape",
      "message_plain": "The forecast error on the holdout periods was 14%.",
      "metric": "mape",
      "status": "warn",
      "suggested_action": "Look for gaps or one-time events in the last weeks of data.",
      "threshold": 0.1,
      "title": "Holdout error",
      "value": 0.14
    }
  ],
  "properties": {
    "category": {
      "anyOf": [
        {
          "enum": [
            "convergence",
            "holdout",
            "plausibility",
            "data"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "M3: the check's category",
      "title": "Category"
    },
    "check": {
      "anyOf": [
        {
          "pattern": "^[a-z]+\\.[a-z0-9_]{1,63}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "M3: the stable check id (SCORECARD_CHECKS), e.g. holdout.mape",
      "title": "Check"
    },
    "code": {
      "pattern": "^[A-Z][A-Z0-9_]{1,63}$",
      "title": "Code",
      "type": "string"
    },
    "docs_anchor": {
      "anyOf": [
        {
          "pattern": "^[a-z0-9][a-z0-9-]{0,99}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "M3: anchor on the scorecard docs page that explains the check",
      "title": "Docs Anchor"
    },
    "message_expert": {
      "anyOf": [
        {
          "maxLength": 2000,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Message Expert"
    },
    "message_plain": {
      "maxLength": 2000,
      "title": "Message Plain",
      "type": "string"
    },
    "metric": {
      "anyOf": [
        {
          "pattern": "^[a-z][a-z0-9_]{0,63}$",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Metric"
    },
    "status": {
      "enum": [
        "pass",
        "warn",
        "fail"
      ],
      "title": "Status",
      "type": "string"
    },
    "suggested_action": {
      "anyOf": [
        {
          "maxLength": 2000,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Suggested Action"
    },
    "threshold": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Threshold"
    },
    "title": {
      "maxLength": 200,
      "title": "Title",
      "type": "string"
    },
    "value": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Value"
    }
  },
  "required": [
    "code",
    "status",
    "title",
    "message_plain"
  ],
  "title": "ScorecardItem",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
