{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ranomics-com/json-schema/ranomics-com-experiment-schema.json",
  "title": "Experiment",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ranomics-com-openapi.json#/components/schemas/Experiment",
  "properties": {
    "created_at": {
      "format": "date-time",
      "type": "string"
    },
    "experiment_id": {
      "format": "uuid",
      "type": "string"
    },
    "experiment_spec": {
      "$ref": "#/$defs/ExperimentSpec"
    },
    "last_transition_at": {
      "format": "date-time",
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "notes_customer": {
      "type": "string"
    },
    "results_status": {
      "$ref": "#/$defs/ResultsStatusEnum"
    },
    "status": {
      "$ref": "#/$defs/StatusEnum"
    },
    "status_log": {
      "items": {
        "properties": {
          "at": {
            "format": "date-time",
            "type": "string"
          },
          "by": {
            "type": "string"
          },
          "status": {
            "$ref": "#/$defs/StatusEnum"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "webhook_url": {
      "type": "string"
    }
  },
  "required": [
    "experiment_id",
    "status",
    "results_status",
    "experiment_spec"
  ],
  "type": "object",
  "$defs": {
    "ExperimentSpec": {
      "properties": {
        "experiment_type": {
          "enum": [
            "yeast_display",
            "mammalian_display",
            "dms"
          ],
          "type": "string"
        },
        "library_design": {
          "$ref": "#/$defs/LibraryDesign"
        },
        "sequences": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Map of `{user_key: AMINO_STRING}`. Each value is uppercase one-letter amino-acid codes; use `:` to separate chains for multi-chain submissions (Adaptyv-compatible).",
          "type": "object"
        },
        "target": {
          "$ref": "#/$defs/Target"
        }
      },
      "required": [
        "experiment_type",
        "target",
        "sequences"
      ],
      "type": "object"
    },
    "LibraryDesign": {
      "additionalProperties": true,
      "properties": {
        "diversity_estimate": {
          "minimum": 1,
          "type": "integer"
        },
        "mode": {
          "enum": [
            "designed_panel",
            "combinatorial",
            "site_saturation",
            "error_prone",
            "nnk"
          ],
          "type": "string"
        },
        "notes": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "ResultsStatusEnum": {
      "enum": [
        "none",
        "partial",
        "all"
      ],
      "type": "string"
    },
    "StatusEnum": {
      "enum": [
        "Draft",
        "WaitingForConfirmation",
        "QuoteSent",
        "WaitingForMaterials",
        "LibraryConstruction",
        "Sorting",
        "NGS",
        "DataAnalysis",
        "InReview",
        "Done",
        "Cancelled"
      ],
      "type": "string"
    },
    "Target": {
      "description": "Supply EITHER `target_id` (catalogue path) or `custom` (one-off antigen). Mutually exclusive.",
      "properties": {
        "custom": {
          "description": "One-off antigen. Routes through human scoping; cost-estimate returns a placeholder range.",
          "properties": {
            "antigen_sequence": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "notes": {
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object"
        },
        "target_id": {
          "description": "Catalogue target id from `GET /api/v1/targets`. The experiment is constructed against the catalogue entry and skips human scoping.",
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}