{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://seanome.github.io/protein-function-annotation-leaderboard/claims/schema.json",
 "title": "claims.yaml",
 "description": "Claims about one tool, each with the test that would kill it. Status is computed from the test by scripts/claims.py, never written by hand.",
 "type": "object",
 "required": ["tool", "title", "updated", "claims"],
 "additionalProperties": false,
 "properties": {
  "tool": {"type": "string", "description": "Tool id as in results.parquet."},
  "title": {"type": "string"},
  "updated": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$", "description": "Date the file was last edited, YYYY-MM-DD, quoted."},
  "claims": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/claim"}}
 },
 "$defs": {
  "claim": {
   "type": "object",
   "required": ["id", "claim", "kill", "test"],
   "additionalProperties": false,
   "properties": {
    "id": {"type": "string", "pattern": "^[a-z0-9-]+$"},
    "claim": {"type": "string", "description": "The claim, as a reader would say it."},
    "kill": {"type": "string", "description": "The result that would retire the claim."},
    "scope": {"type": "string", "description": "Data, settings and truth set the test runs on."},
    "test": {"$ref": "#/$defs/test"},
    "context": {"type": "array", "items": {"type": "object", "required": ["label", "test"],
      "additionalProperties": false, "properties": {"label": {"type": "string"}, "test": {"$ref": "#/$defs/test"}}}},
    "evidence": {"type": "object", "required": ["label", "href"], "additionalProperties": false,
      "properties": {"label": {"type": "string"}, "href": {"type": "string"}}}
   }
  },
  "test": {
   "type": "object",
   "required": ["kind"],
   "additionalProperties": false,
   "properties": {
    "kind": {"enum": ["table", "table_count_passing", "table_bins", "table_max", "record", "record_compare", "not_run"],
     "description": "table*: recomputed from results.parquet. record*: quoted from data/experiments.json and checked against it. not_run: no test yet."},
    "reason": {"type": "string"},
    "row": {"type": "string"}, "name": {"type": "string"}, "quote": {"type": "string"},
    "ours": {"type": "object"}, "theirs": {"type": "object"}, "kill_if": {"type": "object"},
    "total": {"type": "object", "required": ["field", "quote"], "additionalProperties": false,
     "properties": {"field": {"type": "string"}, "quote": {"type": "string"}},
     "description": "record_compare: a denominator quoted from a field of the same inventory record; the field must contain the quote."},
    "verdict": {"type": "string",
     "description": "Wording of the verdict line, a Python format string filled from the resolved test. Without it the line is the test's own text."},
    "experiment": {"type": "string"}, "metric": {"type": "string"}, "tool": {"type": "string"},
    "truth_source": {"type": "string"}, "dedup_or_raw": {"enum": ["raw", "dedup"]},
    "stratum_axis": {"type": "string"}, "stratum_bin": {"type": "string"},
    "stratum_bins": {"type": "array", "items": {"type": "string"}, "minItems": 1},
    "setting": {"type": "string"}, "setting_prefix": {"type": "string"},
    "against": {"type": "object", "required": ["tool", "setting"], "additionalProperties": false,
     "properties": {"tool": {"type": "string"}, "setting": {"type": "string"}}},
    "targets": {"type": "array", "items": {"type": "string"}, "minItems": 1},
    "min_instances": {"type": "integer", "minimum": 1}
   },
   "allOf": [
    {"if": {"properties": {"kind": {"const": "not_run"}}}, "then": {"required": ["reason"]}},
    {"if": {"properties": {"kind": {"const": "record"}}}, "then": {"required": ["row", "name", "quote"]}},
    {"if": {"properties": {"kind": {"const": "record_compare"}}}, "then": {"required": ["row", "ours", "theirs", "kill_if"]}},
    {"if": {"properties": {"kind": {"enum": ["table", "table_bins", "table_count_passing"]}}}, "then": {"required": ["experiment", "metric", "tool", "kill_if"]}}
   ]
  }
 }
}
