{
  "schemaVersion": 1,
  "slug": "pregnancy-weight-gain-calculator",
  "category": "health",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "ff7be383dc00286489fcfa63d2566b1144232ce445f7b796214bc0ca6dc153af",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/pregnancy-weight-gain-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": "BMI = w ÷ (h ÷ 100)²; G: BMI < 18.5 → 12.5–18; < 25 → 11.5–16; < 30 → 7–11.5; ≥ 30 → 5–9",
    "vars": [
      [
        "BMI",
        "Pre-pregnancy BMI"
      ],
      [
        "w",
        "Pre-pregnancy weight (kg)"
      ],
      [
        "h",
        "Height (cm)"
      ],
      [
        "G",
        "Recommended total gain (kg)"
      ]
    ],
    "note": "IOM ranges for a singleton pregnancy. Target weight at term = w + G."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const out=(()=>{const bmi = preWeight/Math.pow(height/100,2); let lo, hi; if(bmi<18.5){lo=12.5;hi=18;} else if(bmi<25){lo=11.5;hi=16;} else if(bmi<30){lo=7;hi=11.5;} else {lo=5;hi=9;} return { bmi, gainLow: lo, gainHigh: hi, targetLow: preWeight+lo, targetHigh: preWeight+hi };})();if(out.__error)return out;return {...out,gainRange:out.gainLow+' / '+out.gainHigh,targetRange:out.targetLow+' / '+out.targetHigh};",
    "inputs": [
      {
        "name": "height",
        "type": "number",
        "default": 165,
        "min": 120,
        "max": 220,
        "step": 0.5,
        "requiredValue": true
      },
      {
        "name": "preWeight",
        "type": "number",
        "default": 62,
        "min": 30,
        "max": 250,
        "step": 0.5,
        "requiredValue": true
      }
    ],
    "outputs": [
      {
        "name": "gainRange",
        "type": "text",
        "precision": 1,
        "unit": "kg",
        "range": true
      },
      {
        "name": "targetRange",
        "type": "text",
        "precision": 1,
        "unit": "kg",
        "range": true
      },
      {
        "name": "bmi",
        "precision": 1,
        "unit": "",
        "trimTrailingZeros": true
      },
      {
        "name": "gainLow",
        "precision": 1,
        "unit": "kg",
        "trimTrailingZeros": true
      },
      {
        "name": "gainHigh",
        "precision": 1,
        "unit": "kg",
        "trimTrailingZeros": true
      },
      {
        "name": "targetLow",
        "precision": 1,
        "unit": "kg",
        "trimTrailingZeros": true
      },
      {
        "name": "targetHigh",
        "precision": 1,
        "unit": "kg",
        "trimTrailingZeros": true
      }
    ],
    "interpret": [
      {
        "max": 18.5,
        "key": "under"
      },
      {
        "max": 25,
        "key": "normal"
      },
      {
        "max": 30,
        "key": "over"
      },
      {
        "max": 1000000000,
        "key": "obese"
      }
    ]
  }
}
