const ACTIVITY_FACTORS = { sedentary: 1.2, lightly_active: 1.375, moderately_active: 1.55, very_active: 1.725, extra_active: 1.9 }; module.exports = { slug: "tdee-from-bmr-and-activity", title: "Total daily energy expenditure from BMR and activity", deck_category: "health", description: "Multiplies a basal metabolic rate by a cited activity factor to estimate total daily energy expenditure.", inputs: [ { name: "bmr", type: "number", unit: "kcal/day", required: true, description: "Basal metabolic rate", min: 0 }, { name: "activity_level", type: "string", required: true, description: "Activity level category", enum: ["sedentary", "lightly_active", "moderately_active", "very_active", "extra_active"] } ], outputs: [ { name: "tdee", unit: "kcal/day", description: "Estimated total daily energy expenditure" } ], steps: [ "Look up the activity factor for the given activity_level from the cited table.", "tdee = bmr * activity_factor, rounded to the nearest whole kcal/day." ], constants: [ { name: "sedentary", value: 1.2, unit: "multiplier", source: 0 }, { name: "lightly_active", value: 1.375, unit: "multiplier", source: 0 }, { name: "moderately_active", value: 1.55, unit: "multiplier", source: 0 }, { name: "very_active", value: 1.725, unit: "multiplier", source: 0 }, { name: "extra_active", value: 1.9, unit: "multiplier", source: 0 } ], sources: [ { kind: "edition_page", value: "ACSM's Guidelines for Exercise Testing and Prescription, 11th edition, chapter on energy expenditure estimation", title: "Physical activity factor (PAL) table for estimating total energy expenditure from resting/basal metabolic rate", publisher: "American College of Sports Medicine / Wolters Kluwer", retrieved_utc: "2026-09-30T19:10:00Z", note: "Standard sedentary-through-extra-active multiplier table used to scale BMR to TDEE." } ], disclaimer: "General formula only. Not medical advice. Dosing decisions belong to a licensed clinician and the product's label.", questionText(inputs) { return `What is the total daily energy expenditure for a BMR of ${inputs.bmr} kcal/day at a ${inputs.activity_level.replace(/_/g, " ")} activity level?`; }, run(inputs) { const { bmr, activity_level } = inputs; if (typeof bmr !== "number" || bmr <= 0) throw new Error("bmr must be a positive number"); const factor = ACTIVITY_FACTORS[activity_level]; if (factor === undefined) throw new Error("activity_level must be one of: " + Object.keys(ACTIVITY_FACTORS).join(", ")); const tdee = Math.round(bmr * factor); return { answer: `${tdee} kcal/day`, values: { tdee, activity_factor: factor } }; }, examples: [ { name: "worked example", inputs: { bmr: 1780, activity_level: "moderately_active" }, expected: { answer: "2759 kcal/day" }, check: "1780 * 1.55 = 2759.0 exactly, rounds to 2759." }, { name: "test vector: sedentary", inputs: { bmr: 1400, activity_level: "sedentary" }, expected: { answer: "1680 kcal/day" }, check: "1400 * 1.2 = 1680.0 exactly, rounds to 1680." } ] };