{
  "schemaVersion": 1,
  "slug": "alcohol-calories-calculator",
  "category": "health",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "0aa1e5f3ee7f25432afbb847416d979afe810622687750b673253cc3680f4da2",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/alcohol-calories-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": "kcal = V × (ABV ÷ 100) × 0.789 × n × 7",
    "vars": [
      [
        "kcal",
        "total calories"
      ],
      [
        "V",
        "volume per drink (ml)"
      ],
      [
        "ABV",
        "strength (%)"
      ],
      [
        "n",
        "number of drinks"
      ]
    ],
    "note": "Ethanol density 0.789 g/ml and 7 kcal/g; one standard drink = 14 g of ethanol."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const gramsPerDrink = volume*(abv/100)*0.789; const grams = gramsPerDrink*quantity; const cal = grams*7; return { calories: cal, grams, standardDrinks: grams/14, caloriesPerDrink: gramsPerDrink*7 };",
    "inputs": [
      {
        "name": "volume",
        "type": "number",
        "default": 500,
        "min": 0,
        "max": 5000,
        "step": 10,
        "slider": true
      },
      {
        "name": "abv",
        "type": "number",
        "default": 5,
        "min": 0,
        "max": 100,
        "step": 0.1,
        "slider": true
      },
      {
        "name": "quantity",
        "type": "number",
        "default": 1,
        "min": 0,
        "max": 100,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "calories",
        "precision": 0,
        "unit": "kcal"
      },
      {
        "name": "grams",
        "precision": 1,
        "unit": "g"
      },
      {
        "name": "standardDrinks",
        "precision": 2,
        "unit": "drinks"
      },
      {
        "name": "caloriesPerDrink",
        "precision": 0,
        "unit": "kcal"
      }
    ],
    "interpret": null
  }
}
