{
  "schemaVersion": 1,
  "slug": "water-footprint-calculator",
  "category": "household",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "60ee3d64afd44f33d50adffbb61e6bbd0e2c6cda4f13cc47255ec736d58ad60f",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/water-footprint-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": "G = m_s × q_s + n_f × 1.28 + m_t × 2.2 + n_d ÷ 7 × 4 + n_l ÷ 7 × 15",
    "vars": [
      [
        "m_s",
        "Shower minutes/day"
      ],
      [
        "q_s",
        "Shower flow (gal/min)"
      ],
      [
        "n_f",
        "Toilet flushes/day"
      ],
      [
        "m_t",
        "Running-tap minutes/day"
      ],
      [
        "n_d",
        "Dishwasher loads/week"
      ],
      [
        "n_l",
        "Laundry loads/week"
      ]
    ],
    "note": "Direct-use model only: shower m×flow + flushes×1.28 + tap min×2.2 + dishwasher loads/week×4/7 + laundry loads/week×15/7. All volumes are US gallons; zero total means no largest category."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const shower=showerMinutes*showerFlow,toilet=flushes*1.28,taps=tapMinutes*2.2,dw=dishwasherLoads/7*4,lw=laundryLoads/7*15,daily=shower+toilet+taps+dw+lw,parts=[['Showers',shower],['Toilet use',toilet],['Tap use',taps],['Dishwasher',dw],['Laundry',lw]];parts.sort((a,b)=>b[1]-a[1]);return {dailyGallons:daily,weeklyGallons:daily*7,yearlyGallons:daily*365,largestModeledUse:daily>0?parts[0][0]:null};",
    "inputs": [
      {
        "name": "showerMinutes",
        "type": "number",
        "default": 10,
        "min": 0,
        "max": 120,
        "step": 1,
        "slider": true
      },
      {
        "name": "showerFlow",
        "type": "number",
        "default": 2,
        "min": 0.5,
        "max": 10,
        "step": 0.1,
        "slider": true
      },
      {
        "name": "flushes",
        "type": "number",
        "default": 5,
        "min": 0,
        "max": 40,
        "step": 1,
        "slider": true
      },
      {
        "name": "tapMinutes",
        "type": "number",
        "default": 6,
        "min": 0,
        "max": 120,
        "step": 1,
        "slider": true
      },
      {
        "name": "dishwasherLoads",
        "type": "number",
        "default": 4,
        "min": 0,
        "max": 30,
        "step": 1,
        "slider": true
      },
      {
        "name": "laundryLoads",
        "type": "number",
        "default": 4,
        "min": 0,
        "max": 40,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "dailyGallons",
        "precision": 1,
        "unit": "gal"
      },
      {
        "name": "weeklyGallons",
        "precision": 0,
        "unit": "gal"
      },
      {
        "name": "yearlyGallons",
        "precision": 0,
        "unit": "gal"
      },
      {
        "name": "largestModeledUse",
        "precision": 0,
        "unit": "",
        "type": "text",
        "optional": true
      }
    ],
    "interpret": null
  }
}
