{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://ordiva.actum360.com/data/schema/evidence-cards.v1.schema.json",
 "title": "Ordiva evidence cards, export v1",
 "description": "Pre-registered evidence cards: claim, mechanism, cohort, examples, counterexample, outcome subject and period, uncertainty, missing fact, coaching question. Descriptive, among the selected successful launches; not a success probability.",
 "type": "object",
 "properties": {
  "export_version": {
   "const": "1"
  },
  "schema": {
   "type": "string"
  },
  "method_version": {
   "type": [
    "string",
    "null"
   ]
  },
  "generated_at": {
   "type": [
    "string",
    "null"
   ]
  },
  "site": {
   "type": [
    "string",
    "null"
   ]
  },
  "label": {
   "type": "string"
  },
  "threshold": {
   "type": "number"
  },
  "statistics": {
   "type": "string"
  },
  "cards": {
   "type": "array",
   "items": {
    "$ref": "#/$defs/card"
   }
  },
  "research_priorities": {
   "type": "array",
   "items": {
    "$ref": "#/$defs/priority"
   }
  },
  "research_priorities_question": {
   "type": "string"
  }
 },
 "required": [
  "export_version",
  "method_version",
  "generated_at",
  "label",
  "threshold",
  "cards",
  "research_priorities"
 ],
 "additionalProperties": false,
 "$defs": {
  "brief": {
   "type": "object",
   "properties": {
    "id": {
     "type": "string"
    },
    "product": {
     "type": "string"
    },
    "year": {
     "type": "integer"
    },
    "score": {
     "type": [
      "number",
      "null"
     ]
    },
    "href": {
     "type": "string"
    }
   },
   "required": [
    "id",
    "product",
    "year",
    "score",
    "href"
   ],
   "additionalProperties": false
  },
  "group": {
   "type": "object",
   "properties": {
    "key": {
     "type": "string"
    },
    "tag": {
     "type": "string"
    },
    "label": {
     "type": "string"
    },
    "n": {
     "type": "integer"
    },
    "top": {
     "type": "integer"
    },
    "rate": {
     "type": [
      "number",
      "null"
     ],
     "minimum": 0,
     "maximum": 1
    },
    "ci95": {
     "anyOf": [
      {
       "type": "null"
      },
      {
       "type": "array",
       "items": {
        "type": "number"
       },
       "minItems": 2,
       "maxItems": 2
      }
     ]
    },
    "median": {
     "type": [
      "number",
      "null"
     ]
    }
   },
   "required": [
    "n",
    "top",
    "rate",
    "ci95",
    "median"
   ],
   "additionalProperties": false
  },
  "sensitivity": {
   "type": "object",
   "properties": {
    "check": {
     "type": "string"
    },
    "label": {
     "type": "string"
    },
    "top_tagged": {
     "type": "integer"
    },
    "n_tagged": {
     "type": "integer"
    },
    "top_comparison": {
     "type": "integer"
    },
    "n_comparison": {
     "type": "integer"
    },
    "rate_tagged": {
     "type": [
      "number",
      "null"
     ],
     "minimum": 0,
     "maximum": 1
    },
    "rate_comparison": {
     "type": [
      "number",
      "null"
     ],
     "minimum": 0,
     "maximum": 1
    },
    "holds": {
     "type": [
      "boolean",
      "null"
     ]
    }
   },
   "required": [
    "check",
    "label",
    "top_tagged",
    "n_tagged",
    "top_comparison",
    "n_comparison",
    "rate_tagged",
    "rate_comparison",
    "holds"
   ],
   "additionalProperties": false
  },
  "stratified": {
   "type": "object",
   "properties": {
    "strata": {
     "type": "string"
    },
    "odds_ratio": {
     "type": [
      "number",
      "null"
     ]
    },
    "ci95": {
     "anyOf": [
      {
       "type": "null"
      },
      {
       "type": "array",
       "items": {
        "type": "number"
       },
       "minItems": 2,
       "maxItems": 2
      }
     ]
    },
    "chi2": {
     "type": [
      "number",
      "null"
     ]
    },
    "p": {
     "type": [
      "number",
      "null"
     ],
     "minimum": 0,
     "maximum": 1
    },
    "strata_used": {
     "type": "integer"
    }
   },
   "required": [
    "strata",
    "odds_ratio",
    "ci95",
    "chi2",
    "p",
    "strata_used"
   ],
   "additionalProperties": false
  },
  "coded": {
   "type": "object",
   "properties": {
    "status": {
     "type": "string"
    },
    "text": {
     "type": "string"
    },
    "groups": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/group"
     }
    },
    "before": {
     "$ref": "#/$defs/group"
    },
    "after": {
     "$ref": "#/$defs/group"
    }
   },
   "required": [
    "status",
    "text"
   ],
   "additionalProperties": {
    "type": [
     "integer",
     "string"
    ]
   }
  },
  "card": {
   "type": "object",
   "properties": {
    "id": {
     "type": "string",
     "pattern": "^ec\\.[a-z0-9-]+\\.v[0-9]+$"
    },
    "slug": {
     "type": "string"
    },
    "version": {
     "type": "integer",
     "minimum": 1
    },
    "kind": {
     "enum": [
      "play",
      "bundle"
     ]
    },
    "title": {
     "type": "string"
    },
    "tags": {
     "type": "array",
     "items": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    },
    "side_names": {
     "type": "array",
     "items": {
      "type": "string"
     }
    },
    "claim": {
     "type": "string"
    },
    "mechanism": {
     "type": "string"
    },
    "cohort": {
     "type": "object",
     "properties": {
      "n_tagged": {
       "type": "integer"
      },
      "top_tagged": {
       "type": "integer"
      },
      "rate_tagged": {
       "type": [
        "number",
        "null"
       ],
       "minimum": 0,
       "maximum": 1
      },
      "n_comparison": {
       "type": "integer"
      },
      "top_comparison": {
       "type": "integer"
      },
      "rate_comparison": {
       "type": [
        "number",
        "null"
       ],
       "minimum": 0,
       "maximum": 1
      },
      "median_tagged": {
       "type": [
        "number",
        "null"
       ]
      },
      "median_comparison": {
       "type": [
        "number",
        "null"
       ]
      },
      "comparison": {
       "type": "string"
      },
      "groups": {
       "type": "array",
       "items": {
        "$ref": "#/$defs/group"
       }
      },
      "tagged_ids": {
       "type": "array",
       "items": {
        "type": "string"
       }
      }
     },
     "required": [
      "n_tagged",
      "top_tagged",
      "rate_tagged",
      "n_comparison",
      "top_comparison",
      "rate_comparison",
      "median_tagged",
      "median_comparison",
      "comparison",
      "groups",
      "tagged_ids"
     ],
     "additionalProperties": false
    },
    "examples": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/brief"
     }
    },
    "counterexample": {
     "anyOf": [
      {
       "type": "null"
      },
      {
       "$ref": "#/$defs/brief"
      }
     ]
    },
    "outcome": {
     "type": "object",
     "properties": {
      "subject": {
       "type": "string"
      },
      "threshold": {
       "type": "number"
      },
      "eras": {
       "type": "array",
       "items": {
        "type": "string"
       }
      },
      "era_labels": {
       "type": "array",
       "items": {
        "type": "string"
       }
      },
      "years": {
       "anyOf": [
        {
         "type": "null"
        },
        {
         "type": "array",
         "items": {
          "type": "integer"
         }
        }
       ]
      }
     },
     "required": [
      "subject",
      "threshold",
      "eras",
      "era_labels",
      "years"
     ],
     "additionalProperties": false
    },
    "uncertainty": {
     "type": "object",
     "properties": {
      "rate_tagged_ci95": {
       "anyOf": [
        {
         "type": "null"
        },
        {
         "type": "array",
         "items": {
          "type": "number"
         },
         "minItems": 2,
         "maxItems": 2
        }
       ]
      },
      "rate_comparison_ci95": {
       "anyOf": [
        {
         "type": "null"
        },
        {
         "type": "array",
         "items": {
          "type": "number"
         },
         "minItems": 2,
         "maxItems": 2
        }
       ]
      },
      "stratified": {
       "$ref": "#/$defs/stratified"
      },
      "q": {
       "type": [
        "number",
        "null"
       ],
       "minimum": 0,
       "maximum": 1
      },
      "sensitivity": {
       "type": "array",
       "items": {
        "$ref": "#/$defs/sensitivity"
       }
      }
     },
     "required": [
      "rate_tagged_ci95",
      "rate_comparison_ci95",
      "stratified",
      "q",
      "sensitivity"
     ],
     "additionalProperties": false
    },
    "missing_fact": {
     "type": "string"
    },
    "notes": {
     "type": "string"
    },
    "coaching_question": {
     "type": "string"
    },
    "coaching_source": {
     "type": "string"
    },
    "method_version": {
     "type": [
      "string",
      "null"
     ]
    },
    "label": {
     "type": "string"
    },
    "sources": {
     "type": "object",
     "properties": {
      "launches": {
       "type": "array",
       "items": {
        "type": "string"
       }
      },
      "method": {
       "type": "string"
      }
     },
     "required": [
      "launches",
      "method"
     ],
     "additionalProperties": false
    },
    "rollout_timing": {
     "$ref": "#/$defs/coded"
    },
    "licensing_direction": {
     "$ref": "#/$defs/coded"
    },
    "subtags": {
     "$ref": "#/$defs/coded"
    },
    "emerging": {
     "type": "array",
     "items": {
      "type": "object",
      "properties": {
       "id": {
        "type": "string"
       },
       "product": {
        "type": "string"
       },
       "year": {
        "type": "integer"
       },
       "href": {
        "type": "string"
       }
      },
      "required": [
       "id",
       "product",
       "year",
       "href"
      ],
      "additionalProperties": false
     }
    }
   },
   "required": [
    "id",
    "version",
    "kind",
    "claim",
    "mechanism",
    "cohort",
    "examples",
    "counterexample",
    "outcome",
    "uncertainty",
    "missing_fact",
    "coaching_question",
    "method_version",
    "label",
    "sources"
   ],
   "additionalProperties": false
  },
  "priority": {
   "type": "object",
   "properties": {
    "play": {
     "type": "string"
    },
    "label": {
     "type": "string"
    },
    "n_scored": {
     "type": "integer"
    },
    "median": {
     "type": "number"
    },
    "n_top": {
     "type": "integer"
    },
    "n_emerging": {
     "type": "integer"
    },
    "n_unscored": {
     "type": "integer"
    },
    "launches": {
     "type": "array",
     "items": {
      "$ref": "#/$defs/brief"
     }
    }
   },
   "required": [
    "play",
    "label",
    "n_scored",
    "median",
    "n_top",
    "n_emerging",
    "n_unscored",
    "launches"
   ],
   "additionalProperties": false
  }
 }
}