Developer builds on-device WHO baby growth percentile calculator, details math pitfalls
A developer building a baby journal app implemented WHO Child Growth Standards percentile calculations on-device and released the result as an open-source, zero-dependency TypeScript library called who-growth-standards. Rather than simple lookups, the WHO publishes L, M, and S values per age and sex, requiring a Box-Cox transformation and normal distribution calculation to derive percentiles. A key technical hazard is that the L value can equal zero in certain indicators, causing division-by-zero errors that silently return NaN or Infinity unless a logarithmic fallback is coded in. The developer also identified catastrophic floating-point cancellation when L approaches zero at very small values, a subtle numerical issue now documented explicitly in the test suite. All twelve official WHO Excel data files, covering six indicators across both sexes and roughly 17,000 data rows, are bundled and code-generated in the library to avoid the inaccuracies seen in implementations that rely on interpolated anchor points.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in