{
  "schemaVersion": 1,
  "slug": "smoke-detector-placement-calculator",
  "category": "household",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "e17fddf0ab67ede78b0cfeda1ebaadc6fd7604b02920e08eb9bc87ced666e395",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/smoke-detector-placement-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": "D = b + h + L + k",
    "vars": [
      [
        "b",
        "Bedrooms"
      ],
      [
        "h",
        "Separate sleeping areas"
      ],
      [
        "L",
        "Above-ground home levels"
      ],
      [
        "k",
        "Basement (0 or 1)"
      ],
      [
        "D",
        "Planning baseline alarm count"
      ]
    ],
    "note": "Planning count adds bedrooms, separate sleeping-area exits, home levels and an optional basement. It is a baseline count, not a code assessment; placement depends on local rules and maker instructions."
  },
  "externalEvidence": {
    "reviewedAt": "2026-09-26",
    "sources": [
      {
        "name": "U.S. Fire Administration — Smoke Alarms",
        "url": "https://www.usfa.fema.gov/prevention/home-fires/prepare-for-fire/smoke-alarms/"
      },
      {
        "name": "U.S. Fire Administration — Where to put smoke alarms",
        "url": "https://www.usfa.fema.gov/gallery/pictographs/pictograph01.html"
      }
    ]
  },
  "contract": {
    "compute": "const basement=hasBasement==='yes'?1:0; const count=bedrooms+hallways+levels+basement; return{baselineCount:count};",
    "inputs": [
      {
        "name": "bedrooms",
        "type": "number",
        "default": 3,
        "min": 1,
        "max": 20,
        "step": 1,
        "slider": true
      },
      {
        "name": "levels",
        "type": "number",
        "default": 2,
        "min": 1,
        "max": 5,
        "step": 1,
        "label": "levels"
      },
      {
        "name": "hallways",
        "type": "number",
        "default": 1,
        "min": 1,
        "max": 10,
        "step": 1
      },
      {
        "name": "hasBasement",
        "type": "select",
        "default": "yes",
        "options": [
          {
            "value": "yes"
          },
          {
            "value": "no"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "baselineCount",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
