{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/omnirx-org/json-schema/omnirx-org-condition-hub-schema.json",
  "title": "ConditionHub",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/omnirx-org-openapi.yml#/components/schemas/ConditionHub",
  "type": "object",
  "required": [
    "id",
    "name",
    "bodySystem",
    "edition",
    "merkleRoot",
    "counts",
    "funds",
    "drugsWhoseLabelNamesThisCondition",
    "licence"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "bodySystem": {
      "type": "string"
    },
    "edition": {
      "type": "string"
    },
    "merkleRoot": {
      "type": "string"
    },
    "licence": {
      "type": "string"
    },
    "counts": {
      "type": "object"
    },
    "funds": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "fund",
          "organization",
          "status",
          "readOn",
          "source"
        ],
        "properties": {
          "fund": {
            "type": "string"
          },
          "organization": {
            "type": "string"
          },
          "status": {
            "enum": [
              "open",
              "closed",
              "limited",
              "waitlist"
            ]
          },
          "readOn": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        }
      }
    },
    "drugsWhoseLabelNamesThisCondition": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "ingredient",
          "labelSentence",
          "labelSource",
          "manufacturerPrograms"
        ],
        "properties": {
          "ingredient": {
            "type": "string"
          },
          "labelSentence": {
            "type": "string"
          },
          "labelSource": {
            "type": "string"
          },
          "manufacturerPrograms": {
            "type": "array",
            "items": {
              "$ref": "#/$defs/LadderProgram"
            }
          }
        }
      }
    }
  },
  "$defs": {
    "LadderProgram": {
      "type": "object",
      "required": [
        "name",
        "url",
        "programPageIsExternal",
        "inCurrentList"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "pattern": "^https?://"
        },
        "programPageIsExternal": {
          "type": "boolean"
        },
        "inCurrentList": {
          "type": "boolean",
          "description": "false when the program's page printed this drug in an earlier list and not in its current one"
        },
        "note": {
          "type": [
            "string",
            "null"
          ]
        },
        "listKind": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": [
            "string",
            "null"
          ]
        },
        "statusRead": {
          "type": [
            "string",
            "null"
          ]
        },
        "fact_id": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[0-9a-f]{24}$",
          "description": "receipt: resolves at /fact/<id>.json when present"
        }
      }
    }
  }
}