{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://diditwork.org/schema/impact_claim.schema.json",
  "title": "Open Impact Claim Standard v0 (impact-claim/v0)",
  "description": "One structured, cited impact claim that an organization or evaluator publishes about a program. Spec: docs/standard/impact-claim-v0.md. Semantic rules the schema cannot express (citation-domain match for named evaluators, uncertainty bounds, future dates, injection) are enforced by scripts/validate_impact_claim.py. License of the spec is a pending decision (proposed CC BY 4.0).",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "standard",
    "claim_id",
    "as_of",
    "org",
    "intervention",
    "metric",
    "claim_type",
    "source",
    "honesty"
  ],
  "properties": {
    "standard": {
      "const": "impact-claim/v0"
    },
    "claim_id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
    },
    "as_of": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "org": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "website": {
          "type": "string",
          "pattern": "^https://"
        },
        "identifiers": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "scheme",
              "value"
            ],
            "properties": {
              "scheme": {
                "enum": [
                  "us_ein",
                  "uk_charity_number",
                  "bw_org_id",
                  "other"
                ]
              },
              "value": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              }
            }
          }
        }
      }
    },
    "intervention": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "bw_intervention_id": {
          "type": "string",
          "pattern": "^int_[a-z0-9_]+$"
        },
        "geography": {
          "type": "string",
          "maxLength": 200
        }
      }
    },
    "metric": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "label",
        "unit",
        "value"
      ],
      "properties": {
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "unit": {
          "type": "string",
          "pattern": "^(custom:)?[A-Za-z0-9_]{1,80}$"
        },
        "value": {
          "type": [
            "number",
            "null"
          ]
        },
        "period": {
          "type": "string",
          "maxLength": 120
        }
      }
    },
    "claim_type": {
      "enum": [
        "modeled_estimate",
        "measured_output",
        "measured_outcome"
      ]
    },
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "citations"
      ],
      "properties": {
        "kind": {
          "enum": [
            "independent_evaluator",
            "peer_reviewed",
            "self_reported"
          ]
        },
        "evaluator": {
          "type": "string",
          "maxLength": 200
        },
        "citations": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "url",
              "accessed_on"
            ],
            "properties": {
              "url": {
                "type": "string",
                "pattern": "^https://",
                "maxLength": 500
              },
              "accessed_on": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "title": {
                "type": "string",
                "maxLength": 300
              }
            }
          }
        }
      }
    },
    "uncertainty": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "low": {
          "type": "number"
        },
        "high": {
          "type": "number"
        },
        "interval": {
          "type": "string",
          "maxLength": 40
        },
        "confidence": {
          "enum": [
            "low",
            "medium",
            "high"
          ]
        },
        "notes": {
          "type": "string",
          "maxLength": 500
        }
      }
    },
    "honesty": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "modeled",
        "guaranteed"
      ],
      "properties": {
        "modeled": {
          "type": "boolean"
        },
        "guaranteed": {
          "const": false
        }
      }
    },
    "follow_up": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "check_after"
      ],
      "properties": {
        "check_after": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "method": {
          "type": "string",
          "maxLength": 300
        }
      }
    },
    "notes": {
      "type": "string",
      "maxLength": 1000
    }
  }
}
