{
  "schemaVersion": 1,
  "slug": "grocery-budget-calculator",
  "category": "shopping",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "5e7bc3b10dc1599f90ec8829905d05b4bfb693ba18835e560e406a509305f108",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/grocery-budget-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": "T = b×d×(A + 0.7C) + 4.345×(u + k)",
    "vars": [
      [
        "b",
        "Monthly food cost per adult, $"
      ],
      [
        "d",
        "Diet adjustment factor"
      ],
      [
        "A",
        "Number of adults"
      ],
      [
        "C",
        "Number of children"
      ],
      [
        "u",
        "Weekly restaurant spend, $"
      ],
      [
        "k",
        "Weekly coffee and snacks spend, $"
      ]
    ],
    "note": "b lookup: thrifty 230, low-cost 275, moderate 340, liberal 430; d: omnivore 1.00, vegetarian 0.92, vegan 0.95, keto 1.25. Children count 70%; 4.345 converts weekly spend to monthly."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "USDA — Official food-plan cost reports",
        "url": "https://www.fns.usda.gov/cnpp/usda-food-plans-cost-food-monthly-reports"
      }
    ],
    "referenceRole": "input",
    "implementationHash": "5e7bc3b10dc1599f90ec8829905d05b4bfb693ba18835e560e406a509305f108",
    "basis": "T = b×d×(A + 0.7C) + 4.345×(u + k)",
    "limitations": "Use the cited guidance and your own measurements, bills or product specifications to choose inputs. Sample defaults are not current local data."
  },
  "contract": {
    "compute": "const P = { thrifty:230, low:275, moderate:340, liberal:430 }; const D = { omnivore:1, vegetarian:0.92, vegan:0.95, keto:1.25 }; const base = P[mealPlan] || 340; const d = D[diet] || 1; const adultCost = base*d*adults; const childCost = base*0.7*d*children; const groceries = adultCost+childCost; const eatingOut = mealsOutPerWeek*4.345*costPerMealOut; const snacks = coffeeSnacksPerWeek*4.345; const total = groceries+eatingOut+snacks; return { adultCost, childCost, groceries, eatingOut, total, perPerson: adults+children > 0 ? total/(adults+children) : 0, savingIfHomeCooked: eatingOut*0.6 };",
    "inputs": [
      {
        "name": "adults",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 20,
        "step": 1,
        "slider": true
      },
      {
        "name": "children",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 20,
        "step": 1,
        "slider": true
      },
      {
        "name": "mealPlan",
        "type": "select",
        "default": "moderate",
        "options": [
          {
            "value": "thrifty"
          },
          {
            "value": "low"
          },
          {
            "value": "moderate"
          },
          {
            "value": "liberal"
          }
        ]
      },
      {
        "name": "diet",
        "type": "select",
        "default": "omnivore",
        "options": [
          {
            "value": "omnivore"
          },
          {
            "value": "vegetarian"
          },
          {
            "value": "vegan"
          },
          {
            "value": "keto"
          }
        ]
      },
      {
        "name": "mealsOutPerWeek",
        "type": "number",
        "default": 3,
        "min": 0,
        "max": 42,
        "step": 1,
        "slider": true
      },
      {
        "name": "costPerMealOut",
        "type": "number",
        "default": 18,
        "min": 0,
        "max": 500,
        "step": 1,
        "slider": true
      },
      {
        "name": "coffeeSnacksPerWeek",
        "type": "number",
        "default": 25,
        "min": 0,
        "max": 1000,
        "step": 5,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "adultCost",
        "precision": 0,
        "unit": "$/month"
      },
      {
        "name": "childCost",
        "precision": 0,
        "unit": "$/month"
      },
      {
        "name": "groceries",
        "precision": 0,
        "unit": "$"
      },
      {
        "name": "eatingOut",
        "precision": 0,
        "unit": "$"
      },
      {
        "name": "total",
        "precision": 0,
        "unit": "$"
      },
      {
        "name": "perPerson",
        "precision": 0,
        "unit": "$"
      },
      {
        "name": "savingIfHomeCooked",
        "precision": 0,
        "unit": "$"
      }
    ],
    "interpret": null
  }
}
