{
  "schemaVersion": 1,
  "slug": "diaper-calculator",
  "category": "household",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "19f08d6f8dd333f805dc8e4b96f88a2998ec1278956780504498fccc06d52ac9",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/diaper-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": "N = Σ r(m) × 30.44 ÷ 2",
    "vars": [],
    "note": "Rates are assumed diapers/day by age band. The model sums half-month intervals using 30.44 days/month, estimates the first year and elapsed use, then future use up to the user-selected planning age. Planning assumptions only."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const rate=m=>m<1?11:m<6?9:m<12?7:m<24?6:5; let totalNeeded=0; for(let m=0;m<ageMonths;m+=0.5) totalNeeded+=rate(m)*30.44/2; let yearOne=0; for(let m=0;m<12;m+=0.5) yearOne+=rate(m)*30.44/2; let remaining=0; for(let m=ageMonths;m<targetAgeMonths&&m>=0;m+=0.5) remaining+=rate(m)*30.44/2; return {perDay:rate(ageMonths),totalNeeded:Math.round(totalNeeded),costSoFar:totalNeeded*costPerDiaper,yearOne:Math.round(yearOne),remaining:Math.round(remaining)};",
    "inputs": [
      {
        "name": "ageMonths",
        "type": "number",
        "default": 3,
        "min": 0,
        "max": 36,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "costPerDiaper",
        "type": "number",
        "default": 0.28,
        "min": 0,
        "max": 3,
        "step": 0.01,
        "slider": true
      },
      {
        "name": "targetAgeMonths",
        "type": "number",
        "default": 30,
        "min": 1,
        "max": 60,
        "step": 1
      }
    ],
    "outputs": [
      {
        "name": "perDay",
        "precision": 1,
        "unit": ""
      },
      {
        "name": "totalNeeded",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "costSoFar",
        "precision": 0,
        "unit": "$"
      },
      {
        "name": "yearOne",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "remaining",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
