{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://genomarker.com/schemas/receipt-1.0.0.json",
  "title": "Genomarker Certified Analysis Receipt",
  "description": "Schema 1.x (1.0.0 / 1.1.0 / 1.2.0 / 1.3.0 / 1.4.0 / 1.5.0 / 1.6.0 / 1.7.0 / 1.8.0 / 1.9.0 / 1.10.0 / 1.11.0) — Stable. Minor bumps add optional fields only (1.1.0 adds the optional method.handler_specific keys calibration_metrics / decision_curve_analysis / subgroup_performance, emitted by ml_train; 1.2.0 adds the optional method.handler_specific.data_quality confounder pre-flight block, emitted by diff_exp; 1.3.0 adds the optional method.handler_specific.analysis_classification + method.handler_specific.sap block, emitted by every inferential handler when the project has a locked SAP at submit time; 1.4.0 adds the optional method.handler_specific.reporting_checklists block — TRIPOD+AI / REMARK / STARD-AI auto-emission emitted by every inferential handler with applicable checklists; Phase 4 / 2B.7.8 — plus method.handler_specific.reporting_supplements, the frozen prose snapshot at publish-time; 1.5.0 adds the optional method.handler_specific.repro_score block — Reproducibility Score emission, REPRO-10 / Phase 5 / 2B.7.9; 1.6.0 adds the optional method.handler_specific.ingest_quality block — Robust Ingest Layer, INGEST-01..04 / Phase 1 v3.0, upload-time gene-ID harmonization + Excel repair + PHI screen + colData alignment + TPM rejection with the tiered verdict hard-refuse / block-with-override / warn / ok; 1.7.0 adds the optional method.handler_specific.gate block — Tiered Gate + Signed Record, GATE-01 / Phase 2 v3.0, the composite severity-tiered gate verdict across confounder / colData / PHI / high-unmappable / ML-leakage / SAP-amendment surfaces plus the signed-override attribution when a block-with-override was waived; 1.8.0 fills the previously-reserved integrity.signing slot — RO-Crate / PROV emission, REPRO-12 / Phase 4 v3.0, a detached ES256 JWS over the count-only rigor verdict (verdict_status origin-signed-replay-pending), PHI-free and offline-verifiable, null on legacy receipts; 1.9.0 adds the optional method.handler_specific.methods_parse block — Methods-Diff v1, REPRO-11 / Phase 8 / 2B.7.10, the reproducibility-relevant metadata of the Claude Sonnet 4.6 LLM call that parsed external paper Methods prose into a typed MethodsCandidate, emitted only by the methods_parse handler; 1.10.0 adds the optional method.handler_specific.sc_aggregation block (PHI-safe counts-only pseudobulk reduction, emitted by the sc_pseudobulk handler) + the optional method.handler_specific.mast block (MAST mixed-model method, emitted by the sc_mast handler) — Single-Cell DE, STAT-05 / Phase 9; 1.11.0 adds the optional method.handler_specific.evidence_sources_used block (version-only evidence provenance — bundle_version + per-source {version, license} + bundle sha256, NO gene list; embedded only at export time when a gene-evidence reference is included) — Gene Evidence Card, GENE-EVID-02/03 / Phase 10) and keep this URL; major bump = new URL.",
  "type": "object",
  "required": [
    "schema_version",
    "license",
    "receipt",
    "subject",
    "analysis",
    "input",
    "software",
    "method",
    "result",
    "lineage",
    "integrity"
  ],
  "properties": {
    "schema_version": { "enum": ["1.0.0", "1.1.0", "1.2.0", "1.3.0", "1.4.0", "1.5.0", "1.6.0", "1.7.0", "1.8.0", "1.9.0", "1.10.0", "1.11.0"] },
    "license": { "const": "CC-BY-4.0" },
    "receipt": {
      "type": "object",
      "required": ["id", "issued_at", "url_private", "status"],
      "properties": {
        "id": { "type": "string" },
        "public_token": { "type": ["string", "null"] },
        "issued_at": { "type": "string", "format": "date-time" },
        "url_public": { "type": ["string", "null"], "format": "uri" },
        "url_private": { "type": "string", "format": "uri" },
        "status": { "enum": ["published", "private", "unpublished", "revoked"] },
        "revoked": { "type": ["object", "null"] }
      }
    },
    "subject": {
      "type": "object",
      "required": ["org", "user", "job_type", "job_id"],
      "properties": {
        "org": {
          "type": "object",
          "required": ["id", "name_snapshot"],
          "properties": {
            "id": { "type": "string" },
            "name_snapshot": { "type": "string" }
          }
        },
        "user": {
          "type": "object",
          "required": ["id", "name_snapshot", "auth_method"],
          "properties": {
            "id": { "type": "string" },
            "name_snapshot": { "type": "string" },
            "auth_method": { "enum": ["jwt", "api_key"] }
          }
        },
        "job_type": { "type": "string" },
        "job_id": { "type": "string" }
      }
    },
    "analysis": {
      "type": "object",
      "required": [
        "submitted_params",
        "submitted_at",
        "started_at",
        "finished_at",
        "duration_ms"
      ],
      "properties": {
        "submitted_params": { "type": "object" },
        "submitted_at": { "type": "string", "format": "date-time" },
        "started_at": { "type": "string", "format": "date-time" },
        "finished_at": { "type": "string", "format": "date-time" },
        "duration_ms": { "type": "integer", "minimum": 0 }
      }
    },
    "input": {
      "type": "object",
      "required": ["dataset_fingerprint", "dataset_dimensions", "ref_data"],
      "properties": {
        "dataset_fingerprint": { "type": "string" },
        "dataset_dimensions": {
          "type": "object",
          "required": ["rows", "cols"],
          "properties": {
            "rows": { "type": "integer" },
            "cols": { "type": "integer" }
          }
        },
        "dataset_archive": { "type": ["object", "null"] },
        "ref_data": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["source", "version", "bundle_sha"],
            "properties": {
              "source": { "type": "string" },
              "version": { "type": "string" },
              "bundle_sha": { "type": "string" }
            }
          }
        }
      }
    },
    "software": {
      "type": "object",
      "required": ["image", "app_version", "environment", "determinism"],
      "properties": {
        "image": { "type": "string" },
        "app_version": { "type": "string" },
        "environment": {
          "type": "object",
          "required": ["python", "os", "cpu", "blas", "libs"],
          "properties": {
            "python": { "type": "string" },
            "os": { "type": "string" },
            "cpu": { "type": "string" },
            "blas": { "type": "string" },
            "libs": {
              "type": "object",
              "additionalProperties": { "type": "string" }
            }
          }
        },
        "determinism": { "type": "object" }
      }
    },
    "method": {
      "type": "object",
      "required": [
        "algorithm",
        "algorithm_version",
        "handler_specific",
        "methods_paragraph"
      ],
      "properties": {
        "algorithm": { "type": "string" },
        "algorithm_version": { "type": "string" },
        "handler_specific": { "type": "object" },
        "methods_paragraph": { "type": "string" }
      }
    },
    "result": {
      "type": "object",
      "required": ["result_summary_hash", "pdf_hash"],
      "properties": {
        "result_summary_hash": { "type": "string" },
        "pdf_hash": { "type": "string" }
      }
    },
    "lineage": {
      "type": "object",
      "required": [
        "parent_receipt_id",
        "parent_relation",
        "parent_url",
        "parent_revoked"
      ],
      "properties": {
        "parent_receipt_id": { "type": ["string", "null"] },
        "parent_relation": { "enum": ["rerun_of", "derived_from", null] },
        "parent_url": { "type": ["string", "null"], "format": "uri" },
        "parent_revoked": { "type": "boolean" },
        "drift_summary": { "type": ["object", "null"] }
      }
    },
    "integrity": {
      "type": "object",
      "required": ["canonical_json_hash", "signing"],
      "properties": {
        "canonical_json_hash": { "type": ["string", "null"] },
        "signing": { "type": ["null"] }
      }
    }
  }
}
