{
 "about": {
  "method": "cell-counting-volume@1.0.0",
  "recordedOn": "2026-10-18",
  "script": "pipeline/lab-calculators/cell_counting_reference_3.py",
  "scriptSha256": "63211c513f73b6416ad9b86e7f5074bf7ea0a74284999336183b3bcbfaba9a14",
  "source": "Contract 10; CSO memo of 17 October 2026, Section 3 (mandatory cases 1-15)",
  "tolerances": {
   "values": "within 1e-9 relative",
   "refusals": "exact"
  },
  "environment": {
   "image": "local",
   "python": "3.9.6",
   "platform": "macOS-27.2-arm64-arm-64bit"
  },
  "crossCheck": {
   "tool": "fractions",
   "version": "stdlib",
   "ran": true,
   "result": "Exact fraction identities and hand anchors asserted"
  }
 },
 "oracle": {
  "name": "Python fractions and decimal",
  "version": "3.9.6"
 },
 "count": 28,
 "recordedOn": "2026-10-18",
 "cases": [
  {
   "name": "case-01-contract-worked-example",
   "about": "Contract worked example: live-only, 20 cells, 2e-4 mL, dilution 2 -> 2e8 cells/L",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "example",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 2.0,
    "observations": [
     {
      "regionId": "region-1",
      "liveCount": 20,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 0.0002,
       "unit": "mL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 2e-07,
      "fraction": "1/5000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 2.0,
      "fraction": "2",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 20,
      "fraction": "20",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 200000000.0,
      "fraction": "200000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "unavailable-live-only",
      "unit": ""
     }
    ]
   }
  },
  {
   "name": "case-02-unit-equivalence",
   "about": "Unit equivalence: 20 cells split across 0.1 µL and 100 nL -> identical 2e8 cells/L",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "example",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 2.0,
    "observations": [
     {
      "regionId": "region-1",
      "liveCount": 10,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 0.1,
       "unit": "µL"
      }
     },
     {
      "regionId": "region-2",
      "liveCount": 10,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 2e-07,
      "fraction": "1/5000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 2.0,
      "fraction": "2",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 20,
      "fraction": "20",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 200000000.0,
      "fraction": "200000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "unavailable-live-only",
      "unit": ""
     }
    ]
   }
  },
  {
   "name": "case-03-mixed-region-sizes-weighted-pooling",
   "about": "Mixed region sizes: 10 / 1e-4 mL and 100 / 4e-4 mL -> pooled 2.2e5 /mL, unweighted 1.75e5",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "square-small",
      "liveCount": 10,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 0.0001,
       "unit": "mL"
      }
     },
     {
      "regionId": "square-large",
      "liveCount": 100,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 0.0004,
       "unit": "mL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 5e-07,
      "fraction": "1/2000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 110,
      "fraction": "110",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 220000000.0,
      "fraction": "220000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "unavailable-live-only",
      "unit": ""
     }
    ]
   }
  },
  {
   "name": "case-04-paired-90-live-10-dead",
   "about": "Paired 90 live / 10 dead in 100 nL, dilution 1 -> viability 90%, viable 9e8 /L, total 1e9 /L",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-dead",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 90,
      "deadCount": 10,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 1e-07,
      "fraction": "1/10000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 90,
      "fraction": "90",
      "unit": ""
     },
     {
      "key": "sumDeadCount",
      "value": 10,
      "fraction": "10",
      "unit": ""
     },
     {
      "key": "sumTotalCount",
      "value": 100,
      "fraction": "100",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 900000000.0,
      "fraction": "900000000",
      "unit": "cells/L"
     },
     {
      "key": "totalDensity",
      "value": 1000000000.0,
      "fraction": "1000000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "available",
      "unit": ""
     },
     {
      "key": "viabilityPercent",
      "value": 90.0,
      "fraction": "90",
      "unit": "%"
     }
    ]
   }
  },
  {
   "name": "case-05a-all-zero-paired",
   "about": "All zero paired count -> densities 0, viabilityStatus unavailable-zero-total",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-dead",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 0,
      "deadCount": 0,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 1e-07,
      "fraction": "1/10000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 0,
      "fraction": "0",
      "unit": ""
     },
     {
      "key": "sumDeadCount",
      "value": 0,
      "fraction": "0",
      "unit": ""
     },
     {
      "key": "sumTotalCount",
      "value": 0,
      "fraction": "0",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 0.0,
      "fraction": "0",
      "unit": "cells/L"
     },
     {
      "key": "totalDensity",
      "value": 0.0,
      "fraction": "0",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "unavailable-zero-total",
      "unit": ""
     }
    ]
   }
  },
  {
   "name": "case-05b-all-zero-total-only",
   "about": "All zero total-only count -> total density 0, viabilityStatus unavailable-total-only",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "total-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": null,
      "deadCount": null,
      "totalCount": 0,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 1e-07,
      "fraction": "1/10000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumTotalCount",
      "value": 0,
      "fraction": "0",
      "unit": ""
     },
     {
      "key": "totalDensity",
      "value": 0.0,
      "fraction": "0",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "unavailable-total-only",
      "unit": ""
     }
    ]
   }
  },
  {
   "name": "case-06-live-zero-dead-positive",
   "about": "Live 0, dead 25 -> viable 0, total 2.5e8 /L, viability 0%",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-dead",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 0,
      "deadCount": 25,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 1e-07,
      "fraction": "1/10000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 0,
      "fraction": "0",
      "unit": ""
     },
     {
      "key": "sumDeadCount",
      "value": 25,
      "fraction": "25",
      "unit": ""
     },
     {
      "key": "sumTotalCount",
      "value": 25,
      "fraction": "25",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 0.0,
      "fraction": "0",
      "unit": "cells/L"
     },
     {
      "key": "totalDensity",
      "value": 250000000.0,
      "fraction": "250000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "available",
      "unit": ""
     },
     {
      "key": "viabilityPercent",
      "value": 0.0,
      "fraction": "0",
      "unit": "%"
     }
    ]
   }
  },
  {
   "name": "case-07-total-only-mode",
   "about": "Total-only mode with 150 cells in 100 nL -> total density 1.5e9 cells/L",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "total-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": null,
      "deadCount": null,
      "totalCount": 150,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 1e-07,
      "fraction": "1/10000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumTotalCount",
      "value": 150,
      "fraction": "150",
      "unit": ""
     },
     {
      "key": "totalDensity",
      "value": 1500000000.0,
      "fraction": "1500000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "unavailable-total-only",
      "unit": ""
     }
    ]
   }
  },
  {
   "name": "case-08a-missing-dead-count-refusal",
   "about": "Missing dead count in live-dead mode -> counting-missing-count",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-dead",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 40,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-missing-count"
   }
  },
  {
   "name": "case-08b-explicit-dead-zero-calculated",
   "about": "Explicit dead 0 with live 50 in live-dead mode -> viability 100%",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-dead",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 50,
      "deadCount": 0,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 1e-07,
      "fraction": "1/10000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 50,
      "fraction": "50",
      "unit": ""
     },
     {
      "key": "sumDeadCount",
      "value": 0,
      "fraction": "0",
      "unit": ""
     },
     {
      "key": "sumTotalCount",
      "value": 50,
      "fraction": "50",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 500000000.0,
      "fraction": "500000000",
      "unit": "cells/L"
     },
     {
      "key": "totalDensity",
      "value": 500000000.0,
      "fraction": "500000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "available",
      "unit": ""
     },
     {
      "key": "viabilityPercent",
      "value": 100.0,
      "fraction": "100",
      "unit": "%"
     }
    ]
   }
  },
  {
   "name": "case-09a-negative-count-refusal",
   "about": "Negative count -1 -> counting-invalid-count",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-dead",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": -1,
      "deadCount": 10,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-invalid-count"
   }
  },
  {
   "name": "case-09b-fractional-count-refusal",
   "about": "Fractional count 2.5 -> counting-invalid-count",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-dead",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 2.5,
      "deadCount": 10,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-invalid-count"
   }
  },
  {
   "name": "case-09c-max-safe-integer-accepted",
   "about": "Count at Number.MAX_SAFE_INTEGER (9007199254740991) accepted",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 9007199254740991,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 1.0,
       "unit": "mL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 0.001,
      "fraction": "1/1000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 9007199254740991,
      "fraction": "9007199254740991",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 9.007199254740991e+18,
      "fraction": "9007199254740991000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "unavailable-live-only",
      "unit": ""
     }
    ]
   }
  },
  {
   "name": "case-09d-unsafe-count-refusal",
   "about": "Count at 2^53 (9007199254740992) -> counting-unsafe-count",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 9007199254740992,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 1.0,
       "unit": "mL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-unsafe-count"
   }
  },
  {
   "name": "case-09e-unsafe-sum-refusal",
   "about": "Two rows of MAX_SAFE_INTEGER -> sum exceeds 2^53 - 1 -> counting-unsafe-count",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 9007199254740991,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 1.0,
       "unit": "mL"
      }
     },
     {
      "regionId": "r2",
      "liveCount": 9007199254740991,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 1.0,
       "unit": "mL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-unsafe-count"
   }
  },
  {
   "name": "case-10a-zero-volume-refusal",
   "about": "Region volume 0 -> counting-non-positive-volume",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 10,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-non-positive-volume"
   }
  },
  {
   "name": "case-10b-negative-volume-refusal",
   "about": "Negative region volume -100 -> counting-non-positive-volume",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 10,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": -100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-non-positive-volume"
   }
  },
  {
   "name": "case-10c-null-volume-refusal",
   "about": "Null volume value -> counting-missing-volume",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 10,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": null,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-missing-volume"
   }
  },
  {
   "name": "case-10d-non-volume-unit-refusal",
   "about": "Non-volume unit cm² -> counting-non-positive-volume",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 10,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 1.0,
       "unit": "cm²"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-non-positive-volume"
   }
  },
  {
   "name": "case-11a-missing-dilution-refusal",
   "about": "Dilution null -> counting-missing-dilution",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": null,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 10,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-missing-dilution"
   }
  },
  {
   "name": "case-11b-dilution-below-one-refusal",
   "about": "Dilution 0.5 < 1 -> counting-dilution-below-one",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 0.5,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 10,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-dilution-below-one"
   }
  },
  {
   "name": "case-11c-dilution-one-undiluted",
   "about": "Dilution 1 (explicit undiluted factor) -> exact 1x applied",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 50,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 1e-07,
      "fraction": "1/10000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 50,
      "fraction": "50",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 500000000.0,
      "fraction": "500000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "unavailable-live-only",
      "unit": ""
     }
    ]
   }
  },
  {
   "name": "case-11d-dilution-two-doubled",
   "about": "Dilution 2 -> exact 2x applied",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 2.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 50,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 1e-07,
      "fraction": "1/10000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 2.0,
      "fraction": "2",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 50,
      "fraction": "50",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 1000000000.0,
      "fraction": "1000000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "unavailable-live-only",
      "unit": ""
     }
    ]
   }
  },
  {
   "name": "case-12a-zero-regions-refusal",
   "about": "0 regions -> counting-no-observations",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": []
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-no-observations"
   }
  },
  {
   "name": "case-12b-too-many-regions-refusal",
   "about": "65 regions (over 64 cap) -> counting-too-many-observations",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r0",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r1",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r2",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r3",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r4",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r5",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r6",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r7",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r8",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r9",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r10",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r11",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r12",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r13",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r14",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r15",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r16",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r17",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r18",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r19",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r20",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r21",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r22",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r23",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r24",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r25",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r26",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r27",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r28",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r29",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r30",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r31",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r32",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r33",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r34",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r35",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r36",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r37",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r38",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r39",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r40",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r41",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r42",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r43",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r44",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r45",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r46",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r47",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r48",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r49",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r50",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r51",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r52",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r53",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r54",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r55",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r56",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r57",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r58",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r59",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r60",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r61",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r62",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r63",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     },
     {
      "regionId": "r64",
      "liveCount": 5,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 10.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-too-many-observations"
   }
  },
  {
   "name": "case-12c-mixed-count-modes-refusal",
   "about": "Live-dead mode carrying totalCount -> counting-mixed-modes",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-dead",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 10,
      "deadCount": 2,
      "totalCount": 12,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "counting-mixed-modes"
   }
  },
  {
   "name": "case-13-numeric-range-refusal",
   "about": "Extreme finite inputs (dilution 1e300, volume 1e-300 L) produce overflow -> numeric-range",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-only",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1e+300,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 100,
      "deadCount": null,
      "totalCount": null,
      "volume": {
       "value": 1e-300,
       "unit": "L"
      }
     }
    ]
   },
   "expected": {
    "expect": "refused",
    "problem": "numeric-range"
   }
  },
  {
   "name": "case-14-bridge-equality",
   "about": "Bridge: viable density from case 4 (9e8 /L = 9e5 /mL) seeded into cells equals manual entry to 1e-9",
   "input": {
    "v": 1,
    "kind": "cell-counting",
    "sampleLabel": "Test sample",
    "countOrigin": "observation",
    "observationTime": "2026-10-17T12:00:00Z",
    "observerSource": "Hemocytometer count",
    "countMode": "live-dead",
    "chamberGrid": "Neubauer improved",
    "geometryNote": "0.1 mm depth",
    "dilutionFactor": 1.0,
    "observations": [
     {
      "regionId": "r1",
      "liveCount": 90,
      "deadCount": 10,
      "totalCount": null,
      "volume": {
       "value": 100.0,
       "unit": "nL"
      }
     }
    ]
   },
   "expected": {
    "expect": "ok",
    "rows": [
     {
      "key": "totalCountedVolume",
      "value": 1e-07,
      "fraction": "1/10000000",
      "unit": "L"
     },
     {
      "key": "dilutionFactor",
      "value": 1.0,
      "fraction": "1",
      "unit": ""
     },
     {
      "key": "sumLiveCount",
      "value": 90,
      "fraction": "90",
      "unit": ""
     },
     {
      "key": "sumDeadCount",
      "value": 10,
      "fraction": "10",
      "unit": ""
     },
     {
      "key": "sumTotalCount",
      "value": 100,
      "fraction": "100",
      "unit": ""
     },
     {
      "key": "viableDensity",
      "value": 900000000.0,
      "fraction": "900000000",
      "unit": "cells/L"
     },
     {
      "key": "totalDensity",
      "value": 1000000000.0,
      "fraction": "1000000000",
      "unit": "cells/L"
     },
     {
      "key": "viabilityStatus",
      "value": "available",
      "unit": ""
     },
     {
      "key": "viabilityPercent",
      "value": 90.0,
      "fraction": "90",
      "unit": "%"
     }
    ],
    "bridge": {
     "densityCellsPerMl": 900000.0,
     "densityBasis": "viable",
     "countingDilution": "already-applied",
     "densityUnit": "cells/mL"
    }
   }
  }
 ],
 "receiptIntegrityCases": [
  {
   "name": "case-15a-viable-row-in-total-only",
   "about": "Viable row in total-only receipt fails receipt check",
   "mutation": "add-row",
   "row": {
    "key": "viableDensity",
    "value": 100000.0,
    "unit": "cells/L"
   },
   "baseCase": "case-07-total-only-mode"
  },
  {
   "name": "case-15b-viability-row-in-live-only",
   "about": "Viability row in live-only receipt fails receipt check",
   "mutation": "add-row",
   "row": {
    "key": "viabilityPercent",
    "value": 95.0,
    "unit": "%"
   },
   "baseCase": "case-01-contract-worked-example"
  },
  {
   "name": "case-15c-numeric-viability-with-zero-total",
   "about": "Numeric viability with zero total count fails receipt check",
   "mutation": "add-row",
   "row": {
    "key": "viabilityPercent",
    "value": 0.0,
    "unit": "%"
   },
   "baseCase": "case-05a-all-zero-paired"
  },
  {
   "name": "case-15d-extraneous-row",
   "about": "Extraneous row fails receipt check",
   "mutation": "add-row",
   "row": {
    "key": "inventedRow",
    "value": 123.0,
    "unit": ""
   },
   "baseCase": "case-04-paired-90-live-10-dead"
  },
  {
   "name": "case-15e-duplicate-key",
   "about": "Duplicate key fails receipt check",
   "mutation": "duplicate-key",
   "baseCase": "case-04-paired-90-live-10-dead"
  },
  {
   "name": "case-15f-wrong-unit",
   "about": "Wrong unit on receipt row fails receipt check",
   "mutation": "wrong-unit",
   "wrongUnit": "kg",
   "baseCase": "case-04-paired-90-live-10-dead"
  }
 ]
}
