BMITDEE

Developer documentation

APIs with explicit formulas, versions and limitations

Install the complete package or import the browser modules directly. Each result is structured for reproducibility rather than returning an unexplained number.

terminal
npm install @bmitdee/core
npm install @bmitdee/adaptive
npm install @bmitdee/elements

npm run check
# validation + 16 automated tests

Quick start

Installation and browser imports

Package manager

npm install @bmitdee/core

Direct browser module

import { calculateTDEE } from "https://www.bmitdee.com/developers/sdk/core.js";
Direct modules are provided for demonstrations and small integrations. For production dependency management, publish and install the GitHub/npm package with a pinned version.

Stable package · v1.0.0

@bmitdee/core

Dependency-free deterministic calculations. Functions validate units and supported ranges, and return formula metadata, assumptions and warnings.

FunctionPrimary inputOutput
calculateBMIweightKg, heightCmBMI, category, metadata
calculateBMRsex, age, weight, height, optional body fat/formulaBMR and formula details
calculateTDEEBMR inputs + activity multiplierTDEE, BMR, assumptions
compareTDEEFormulasTDEE inputsFormula results and spread
calculateMacroscalories + preset/splitProtein, fat and carbohydrate grams
calculateHealthyWeightRangeheightCmAdult BMI-based kg/lb reference
calculateCalorieDeficitTDEE + deficitTarget, applied deficit, floor status
convertWeight / convertHeightvalue, from, toConverted numeric value

Signature example

calculateTDEE(input: TDEEInput): TDEEResult

Result contract

{
  "value": 2731.88,
  "unit": "kcal/day",
  "package": "@bmitdee/core",
  "packageVersion": "1.0.0",
  "formula": "mifflin-st-jeor",
  "formulaVersion": "1.0.0",
  "assumptions": [...],
  "warnings": [...]
}

Formula interpretation and citations remain available on Formula Sources.

Experimental package · v0.1.0

@bmitdee/adaptive

The engine estimates a working TDEE from longitudinal weight and calorie records. It is not direct calorimetry.

analyzeAdaptiveTDEE(entries, { formulaTdee, windowDays, bootstrapIterations })

Processing sequence

  1. Validate ISO dates, weights and calorie records.
  2. Deduplicate by date and select a 14-, 21-, 28-, 42-day or full-history window.
  3. Fit weight against calendar time.
  4. Screen large robust residual outliers.
  5. Calculate calorie/weight coverage and weekly weight trend.
  6. Infer TDEE using average intake and short-term weight trend.
  7. Produce a deterministic residual-bootstrap interval.
  8. Return quality score, exclusions, method metadata and warnings.
The 7,700 kcal/kg convention is a simplified short-term calibration assumption. Weight changes include water, glycogen, gastrointestinal contents, fat and lean tissue. Logging error directly affects the result.

Synthetic scenarios

generateSyntheticScenario() creates privacy-safe histories for tests, screenshots and demonstrations.

Experimental package · v0.1.0

@bmitdee/elements

Standard Custom Elements with Shadow DOM styles and local calculations.

<script type="module" src="/developers/sdk/elements.js"></script>
<bmitdee-tdee-calculator></bmitdee-tdee-calculator>

Available elements:

  • <bmitdee-tdee-calculator>
  • <bmitdee-bmr-calculator>
  • <bmitdee-bmi-calculator>
  • <bmitdee-macro-calculator>
  • <bmitdee-healthy-weight>
  • <bmitdee-adaptive-summary>

Result event

element.addEventListener("bmitdee-result", event => {
  console.log(event.detail);
});

Theming

bmitdee-tdee-calculator {
  --bmitdee-primary: #0f766e;
  --bmitdee-radius: 18px;
  --bmitdee-surface: #ffffff;
}
Open the live component gallery.

Experimental package · v0.1.0

@bmitdee/cli

bmitdee tdee input.json
bmitdee adaptive history.json
cat input.json | bmitdee bmi

Commands: bmi, bmr, tdee, macros, healthy-weight, deficit, compare, adaptive, and synthetic.

Reproducibility

Website, package and formula versions are separate

  • BMITDEE website release: V3.4.0
  • Core package: 1.0.0
  • Adaptive package: 0.1.0
  • Formula versions are included in each result.

A numeric behavior change requires a changelog entry and updated test vectors.

Boundaries

Privacy, intended use and safe integration

  • The SDK modules make no network requests.
  • Web Components do not transmit user inputs.
  • Host applications control any storage or analytics.
  • Do not send measurements, calorie histories or health notes to BMITDEE analytics.
  • Outputs are educational estimates, not diagnosis or treatment.
  • Do not expose production credentials or user records in GitHub issues.

Browser modules

Direct module files

/developers/sdk/core.jsDownload
/developers/sdk/adaptive.jsDownload
/developers/sdk/elements.jsDownload
Complete sourceDownload ZIP