anthro

WHO 2006 Child Growth Standards. Computes z-scores and nutritional classifications for 6 indicators from child measurements.

Day-indexed WHO igrowup Month-indexed WHO
Age in days computed from this date Enter a valid date (DD/MM/YYYY)
Defaults to today

38 -- 150 cm Must be 38 -- 150 cm
0.9 -- 58 kg Must be 0.9 -- 58 kg
6 -- 30 cm Must be 6 -- 30 cm

1 LMS row per day (0 -- 1826 d). Use when date of birth is known.
Results will appear here

WHO LMS Tables

LMS parameters (Box-Cox power L, median M, coefficient of variation S) used for z-score computation. Source: WHO Multicentre Growth Reference Study Group (2006).

1 row per day (0 -- 1826 d)

Select an indicator above.

Documentation

API reference, usage examples, and technical details for the anthro library.

Browser / CDN

Load two scripts. No build step required. Tables are fetched once and cached by the browser.

<script src="https://flame-cai.github.io/anthro/anthro.bundle.js"></script>
<script src="https://flame-cai.github.io/anthro/api.js"></script>
<script>
  await AnthroAPI.ready()

  const r = AnthroAPI.compute({
    mode:      'day',
    sex:       'female',
    dob:       '2024-01-15',
    weight_kg: 7.0,
    height_cm: 64.0,
    muac_mm:   136,
  })

  r.lhfa            // 'Moderately stunted'
  r.z_lhfa          // -2.7901
  r.wfa             // 'Normal'
  r.muac_threshold  // 'Normal'
  r.bmi_val         // 17.0898
</script>

npm

npm install @flame-cai/anthro
const { createAnthro } = require('@flame-cai/anthro')
const fs    = require('fs')
const names = ['wfa', 'lhfa', 'bmi', 'acfa', 'wfl', 'wfh']
const load  = (p, n) => JSON.parse(fs.readFileSync(
  require.resolve(`@flame-cai/anthro/data/${p}_${n}.json`)))

const anthro = createAnthro(
  Object.fromEntries(names.map(n => [n, load('day',   n)])),
  Object.fromEntries(names.map(n => [n, load('month', n)]))
)

const result = anthro.compute({
  mode: 'day', sex: 2, dob: '2024-01-15',
  weight_kg: 7, height_cm: 64, muac_mm: 136,
})

Python / PyPI

pip install anthro
from anthro import compute, batch

result = compute({
    'sex':       'female',
    'dob':       '2024-01-15',
    'measured':  '2025-01-15',
    'weight_kg': 7.0,
    'height_cm': 64.0,
    'muac_mm':   136,
})

result['lhfa']            # 'Moderately stunted'
result['z_lhfa']          # -2.7901
result['wfa']             # 'Normal'
result['muac_threshold']  # 'Normal'

Full Python API reference: python/README.md

Clone directly

Use src/anthro.js and data/ directly without npm. Works in Node.js and any bundler (webpack, Vite, Metro).

git clone https://github.com/flame-cai/anthro.git
const { createAnthro } = require('./anthro/src/anthro.js')
const names  = ['wfa', 'lhfa', 'bmi', 'acfa', 'wfl', 'wfh']
const anthro = createAnthro(
  Object.fromEntries(names.map(n => [n, require(`./anthro/data/day_${n}.json`)])),
  Object.fromEntries(names.map(n => [n, require(`./anthro/data/month_${n}.json`)]))
)

React Native (Android & iOS)

The library has no platform-specific dependencies. Metro handles JSON require() natively.

Via npm

import { createAnthro } from '@flame-cai/anthro'

const names  = ['wfa', 'lhfa', 'bmi', 'acfa', 'wfl', 'wfh']
const anthro = createAnthro(
  Object.fromEntries(names.map(n => [n, require(`@flame-cai/anthro/data/day_${n}.json`)])),
  Object.fromEntries(names.map(n => [n, require(`@flame-cai/anthro/data/month_${n}.json`)]))
)

export function assess(child) {
  return anthro.compute({
    mode: 'day', sex: child.sex,
    dob:       child.dateOfBirth,
    weight_kg: child.weightKg,
    height_cm: child.heightCm,
    muac_mm:   child.muacMm,
  })
}

By copying files

Copy src/anthro.js and the entire data/ folder into your project.

Create the instance once at module level, not inside a component render function. The constructor builds O(1) lookup maps (~50 ms on a mid-range device).

Missing inputs

When a measurement is absent the affected indicator returns a descriptive string. All other indicators are still computed.

anthro.compute({ sex: 'F', dob: '2024-01-15', height_cm: 64 })

r.lhfa            // 'Moderately stunted'  -- computed normally
r.wfa             // 'Missing weight to compute'
r.muac_threshold  // 'Missing muac to compute'

Input reference

ParameterTypeDescriptionRequired
modestring'day' (default) or 'month'No
sexstring|number'male' 'female' 'm' 'f' 'M' 'F' 1 2Yes
dobDate|stringDate of birth (ISO 8601). Preferred -- gives exact age in days.One of
age_daysnumberExact age in complete days.
age_monthsnumberCompleted months, converted via x30.4375.
measuredDate|stringDate of measurement, used with dob. Defaults to today.No
weight_kgnumberWeight in kg.One of
weight_gnumberWeight in g.
height_cmnumberRecumbent length or standing height in cm.--
muac_mmnumberMUAC in mm.One of
muac_cmnumberMUAC in cm.
measure'L'|'H''L' recumbent, 'H' standing. Defaults to 'L' for age <24m, 'H' for ≥24m.No
oedemabooleanBilateral pitting oedema. Adds a warning to WFA and WFLH.No

Output reference

FieldTypeDescription
muac_thresholdstringSAM / MAM / Normal -- absolute MUAC, age-independent.
acfastringMUAC-for-age. SAM / MAM / Normal. Ages 3-60 m.
bmistringBMI-for-age. SAM / MAM / Normal / Overweight / Obese. Ages 0-60 m.
lhfastringStunting. Normal / Moderately stunted / Severely stunted.
wfastringUnderweight. Normal / Moderately underweight / Severely underweight.
wflhstringWasting. Normal / Moderate wasting / Severe wasting / Overweight / Obese.
z_lhfa z_wfa z_wflh z_bmi z_acfanumberz-score to 4 dp. Exact LMS, not pre-rounded.
bmi_valnumberBMI in kg/m2 (4 dp).
flag_lhfa etc.0|11 = biologically implausible z-score.
height_cm_rawnumberHeight as entered.
height_cm_adjnumberHeight after +/-0.7 cm correction if applied.
measure_correctionstring|nulle.g. "+0.7cm (H to L)"
age_days age_monthsnumberComputed age.
errorsstring[]Fatal input errors.
warningsstring[]Non-fatal notices.

Table sources

ModeIndexCoveragePrefer when
'day'1 row per day0-1826 dDOB is known
'month'1 row per month0-60 mOnly completed months available

Day-indexed tables are extracted from the R package anthro v1.1.0 (WorldHealthOrganization/anthro): weianthro, lenanthro, bmianthro, acanthro, wflanthro, wfhanthro -- the same datasets used in WHO igrowup SAS/SPSS/Stata packages. Month-indexed tables are the WHO supplementary monthly tables from the same study.

Formula

Source: WHO Technical Report 2006, section 5.2, pp. 300-304.

z = [(X/M)^L - 1] / (L x S)   when L != 0
z = ln(X/M) / S                 when L = 0

SD23 adjustment when |z| > 3:
  z = +3 + (X - SD3)  / (SD3 - SD2)    when z > +3
  z = -3 + (X - SD3') / (SD2' - SD3')  when z < -3
  where SD3 = M(1 + L*S*3)^(1/L),  SD2 = M(1 + L*S*2)^(1/L)

Measure correction

Source: WHO 2006, Chapter 7. Mean difference between recumbent length and standing height = 0.73 cm, applied as 0.7 cm.

Table expectsChild measured asCorrection applied
L (recumbent)H (standing)height + 0.7 cm
H (standing)L (recumbent)length - 0.7 cm
SameNone

Day mode: the loh field in lenanthro per day determines the expected type (L for days 0-730, H for days 731-1826). Month mode: L for months 0-23, H for months 24-60.

Classification cut-points

Source: WHO (2009), ISBN 9789241598163.

IndicatorSevere / SAMModerate / MAMNormalOverweight / Obese
MUAC (absolute)<115 mm115 to <125 mm≥125 mm--
ACFA, BMI-for-agez < -3-3 ≤ z < -2z ≥ -2z>2 / z>3
LHFA (stunting)z < -3-3 ≤ z < -2z ≥ -2--
WFA (underweight)z < -3-3 ≤ z < -2z ≥ -2--
WFLH (wasting)z < -3-3 ≤ z < -2-2 ≤ z ≤ +2z>2 / z>3

Plausibility flags

Source: WHO igrowup documentation (igrowup_standard.sas). flag_* = 1 indicates a z-score outside the biologically plausible range; the observation should be reviewed.

IndicatorFlagged when
WFA, LHFA|z| > 6
WFLH, BMI, ACFA|z| > 5

Precision

This library uses the exact floating-point z-score for classification without prior rounding. The R anthro package rounds z to 2 decimal places before classifying: a z-score of -2.003 rounds to -2.00 and is classified as Normal rather than MAM. This library retains full precision, which is relevant for observations near a cut-point boundary.


Citations

What
Tables and methodsWHO MGRS (2006). WHO Child Growth Standards: Methods and development. Geneva: WHO. ISBN 924154693X
igrowup day-indexed tablesWHO (2006). igrowup software
R package (table source)Borghi E et al. anthro R package v1.1.0. CRAN · GitHub
FormulaWHO MGRS (2006), Technical Report section 5.2, pp. 300-304
Cut-pointsWHO (2009). ISBN 9789241598163
Measure correctionWHO MGRS (2006), Chapter 7
Plausibility flagsWHO igrowup documentation (igrowup_standard.sas / .ado)

Changelog

1.1.1

  • Python package (anthro on PyPI) — same WHO tables, formula, and output schema as the JS library
  • Shared data/ directory — no duplication between JS and Python packages
  • Global VERSION file — single source of truth for npm, PyPI, and JS source
  • CI publishes both npm and PyPI on version tag push
  • 34 Python tests verified against R anthro v1.1.0

1.1.1

  • Day-indexed (WHO igrowup) and month-indexed (WHO supplementary) table modes
  • Exact floating-point z-scores -- not pre-rounded before classification
  • Automatic +/-0.7 cm measure correction from loh field
  • 6 indicators: muac_threshold, acfa, bmi, lhfa, wfa, wflh
  • Missing input returns a descriptive string, not null
  • Day 1826 (exactly 60 months) inclusive in all tables
  • TypeScript declarations
  • 33 tests verified against R anthro v1.1.0

Contributing

JS tests: node test/anthro.test.js — no install required.

Python tests: python3 python/test_anthro.py — no install required.

To re-export day-indexed tables from the R anthro package: Rscript scripts/export-tables.R

CONTRIBUTING.md · Issues · github.com/flame-cai/anthro