{
  "schemaVersion": 1,
  "slug": "dog-chocolate-toxicity-calculator",
  "category": "pets",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "695b6f9d8554592063108ad151421fa046b275ef30d0ed79b0d55af7efbd83ba",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/dog-chocolate-toxicity-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "D = A × 28.3495 × c ÷ (0.45359237 × W)",
    "vars": [
      [
        "A",
        "chocolate eaten (oz)"
      ],
      [
        "c",
        "total methylxanthines (mg/g)"
      ],
      [
        "W",
        "dog weight (lb)"
      ],
      [
        "D",
        "estimated dose (mg/kg)"
      ]
    ],
    "note": "Uses average total methylxanthine concentrations from Merck Veterinary Manual (white 0.04, milk 2.3, dark 5.45, baking 15.5, cocoa 28.5 mg/g). Products vary; a low estimate does not rule out poisoning. Contact a veterinarian or animal poison service promptly."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "Merck Veterinary Manual — Average methylxanthine concentrations",
        "url": "https://www.merckvetmanual.com/toxicology/food-hazards/chocolate-toxicosis-in-animals"
      }
    ],
    "referenceRole": "definition",
    "implementationHash": "695b6f9d8554592063108ad151421fa046b275ef30d0ed79b0d55af7efbd83ba",
    "basis": "D = A × 28.3495 × c ÷ (0.45359237 × W)",
    "limitations": "The references explain definitions and methods; any extra preset must be checked against the assumptions on this page."
  },
  "contract": {
    "compute": "const T={white:0.04,milk:2.3,semiSweet:5.45,dark:5.45,bittersweet:5.45,baking:15.5,cocoa:28.5}; const perGram=T[chocolateType]??2.3; const weightKg=weight*0.45359237; const methylxanthines=amount*28.3495*perGram; const dosePerKg=weightKg>0?methylxanthines/weightKg:0; let riskLevel,action; if(dosePerKg<20){riskLevel='Below model alert threshold — toxicity still possible';action='Contact a veterinarian or animal poison service promptly';}else if(dosePerKg<40){riskLevel='Moderate — call your vet';action='Contact your vet or a pet poison helpline for advice';}else if(dosePerKg<60){riskLevel='Severe — treat as an emergency';action='Go to an emergency vet now, do not wait for symptoms';}else{riskLevel='Critical — seizures possible';action='Emergency veterinary care immediately';} return {methylxanthines,dosePerKg,riskLevel,action};",
    "inputs": [
      {
        "name": "weight",
        "type": "number",
        "default": 30,
        "min": 1,
        "max": 300,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "chocolateType",
        "type": "select",
        "default": "milk",
        "options": [
          {
            "value": "white"
          },
          {
            "value": "milk"
          },
          {
            "value": "semiSweet"
          },
          {
            "value": "dark"
          },
          {
            "value": "bittersweet"
          },
          {
            "value": "baking"
          },
          {
            "value": "cocoa"
          }
        ]
      },
      {
        "name": "amount",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 200,
        "step": 0.1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "action",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "riskLevel",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "dosePerKg",
        "precision": 2,
        "unit": "mg/kg"
      },
      {
        "name": "methylxanthines",
        "precision": 1,
        "unit": "mg"
      }
    ],
    "interpret": null
  }
}
