anthro
WHO 2006 Child Growth Standards. Computes z-scores and nutritional classifications for 6 indicators from child measurements.
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).
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
| Parameter | Type | Description | Required |
|---|---|---|---|
mode | string | 'day' (default) or 'month' | No |
sex | string|number | 'male' 'female' 'm' 'f' 'M' 'F' 1 2 | Yes |
dob | Date|string | Date of birth (ISO 8601). Preferred -- gives exact age in days. | One of |
age_days | number | Exact age in complete days. | |
age_months | number | Completed months, converted via x30.4375. | |
measured | Date|string | Date of measurement, used with dob. Defaults to today. | No |
weight_kg | number | Weight in kg. | One of |
weight_g | number | Weight in g. | |
height_cm | number | Recumbent length or standing height in cm. | -- |
muac_mm | number | MUAC in mm. | One of |
muac_cm | number | MUAC in cm. | |
measure | 'L'|'H' | 'L' recumbent, 'H' standing. Defaults to 'L' for age <24m, 'H' for ≥24m. | No |
oedema | boolean | Bilateral pitting oedema. Adds a warning to WFA and WFLH. | No |
Output reference
| Field | Type | Description |
|---|---|---|
muac_threshold | string | SAM / MAM / Normal -- absolute MUAC, age-independent. |
acfa | string | MUAC-for-age. SAM / MAM / Normal. Ages 3-60 m. |
bmi | string | BMI-for-age. SAM / MAM / Normal / Overweight / Obese. Ages 0-60 m. |
lhfa | string | Stunting. Normal / Moderately stunted / Severely stunted. |
wfa | string | Underweight. Normal / Moderately underweight / Severely underweight. |
wflh | string | Wasting. Normal / Moderate wasting / Severe wasting / Overweight / Obese. |
z_lhfa z_wfa z_wflh z_bmi z_acfa | number | z-score to 4 dp. Exact LMS, not pre-rounded. |
bmi_val | number | BMI in kg/m2 (4 dp). |
flag_lhfa etc. | 0|1 | 1 = biologically implausible z-score. |
height_cm_raw | number | Height as entered. |
height_cm_adj | number | Height after +/-0.7 cm correction if applied. |
measure_correction | string|null | e.g. "+0.7cm (H to L)" |
age_days age_months | number | Computed age. |
errors | string[] | Fatal input errors. |
warnings | string[] | Non-fatal notices. |
Table sources
| Mode | Index | Coverage | Prefer when |
|---|---|---|---|
'day' | 1 row per day | 0-1826 d | DOB is known |
'month' | 1 row per month | 0-60 m | Only 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 expects | Child measured as | Correction applied |
|---|---|---|
| L (recumbent) | H (standing) | height + 0.7 cm |
| H (standing) | L (recumbent) | length - 0.7 cm |
| Same | None | |
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.
| Indicator | Severe / SAM | Moderate / MAM | Normal | Overweight / Obese |
|---|---|---|---|---|
| MUAC (absolute) | <115 mm | 115 to <125 mm | ≥125 mm | -- |
| ACFA, BMI-for-age | z < -3 | -3 ≤ z < -2 | z ≥ -2 | z>2 / z>3 |
| LHFA (stunting) | z < -3 | -3 ≤ z < -2 | z ≥ -2 | -- |
| WFA (underweight) | z < -3 | -3 ≤ z < -2 | z ≥ -2 | -- |
| WFLH (wasting) | z < -3 | -3 ≤ z < -2 | -2 ≤ z ≤ +2 | z>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.
| Indicator | Flagged 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 methods | WHO MGRS (2006). WHO Child Growth Standards: Methods and development. Geneva: WHO. ISBN 924154693X |
| igrowup day-indexed tables | WHO (2006). igrowup software |
| R package (table source) | Borghi E et al. anthro R package v1.1.0. CRAN · GitHub |
| Formula | WHO MGRS (2006), Technical Report section 5.2, pp. 300-304 |
| Cut-points | WHO (2009). ISBN 9789241598163 |
| Measure correction | WHO MGRS (2006), Chapter 7 |
| Plausibility flags | WHO igrowup documentation (igrowup_standard.sas / .ado) |
Changelog
1.1.1
- Python package (
anthroon PyPI) — same WHO tables, formula, and output schema as the JS library - Shared
data/directory — no duplication between JS and Python packages - Global
VERSIONfile — 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
lohfield - 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