{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "OCx25 dataset audit",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "summary",
    "counts",
    "replicate_reproducibility",
    "findings",
    "recommended_exclusions",
    "reproduction"
  ],
  "properties": {
    "summary": {
      "type": "string",
      "minLength": 200
    },
    "counts": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "rows",
        "samples",
        "target_compositions",
        "element_systems",
        "samples_without_xrf"
      ],
      "properties": {
        "rows": {
          "type": "integer"
        },
        "samples": {
          "type": "integer"
        },
        "target_compositions": {
          "type": "integer"
        },
        "element_systems": {
          "type": "integer"
        },
        "samples_without_xrf": {
          "type": "integer"
        }
      }
    },
    "replicate_reproducibility": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "reaction",
          "quantity",
          "n_groups",
          "median_sd",
          "notes"
        ],
        "properties": {
          "source": {
            "enum": [
              "vsp",
              "uoft",
              "all"
            ]
          },
          "reaction": {
            "enum": [
              "HER",
              "CO2RR"
            ]
          },
          "quantity": {
            "type": "string"
          },
          "n_groups": {
            "type": "integer"
          },
          "median_sd": {
            "type": "number"
          },
          "notes": {
            "type": "string"
          }
        }
      }
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "severity",
          "category",
          "sample_ids",
          "description",
          "evidence",
          "suggested_action"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^F[0-9]{3}$"
          },
          "severity": {
            "enum": [
              "blocking",
              "major",
              "minor",
              "note"
            ]
          },
          "category": {
            "enum": [
              "duplicate",
              "inconsistent_value",
              "outlier",
              "missing_data",
              "composition_mismatch",
              "batch_effect",
              "unit_or_sign",
              "documentation",
              "other"
            ]
          },
          "sample_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": "string",
            "minLength": 1
          },
          "evidence": {
            "type": "string",
            "minLength": 1
          },
          "suggested_action": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "recommended_exclusions": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "sample_id",
          "reason",
          "finding_id"
        ],
        "properties": {
          "sample_id": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "finding_id": {
            "type": "string"
          }
        }
      }
    },
    "reproduction": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "command",
        "environment"
      ],
      "properties": {
        "command": {
          "type": "string"
        },
        "environment": {
          "type": "string"
        }
      }
    }
  }
}
