Client-side growth percentile calculator. Converts (sex, birth date, measurement date, type, value) into a WHO or CDC percentile and z-score using the LMS method (Cole & Green, 1992).
Everything runs in the browser — no data leaves the device.
Live: https://growthchartcalculator.com
- Astro + TypeScript
- Chart.js for the optional growth chart view
- LMS reference tables (WHO 2006, CDC 2000) bundled at build time via Vite's
?rawloader
npm install
npm run dev # Vite dev server
npm run build # tsc + vite build → dist/
npm run preview # serve the built dist/npm run build is the full check — tsc is the only type check; there's no separate lint step.
src/references.ts— loads the CSV LMS tables fromsrc/data/and exposesgetReference(standard, sex, type, age).src/growth.ts— LMS math (Box-Cox / log fallback, normal CDF via Abramowitz & Stegun, inverse via Acklam). No deps.src/main.ts— form wiring, percentile bands, optional chart rendering, and print output.src/pages/— Astro routes, including the calculator (index.astro) and landing pages (who-growth-chart,cdc-growth-chart,baby-percentile-calculator, etc.).
src/data/ contains the LMS tables:
- WHO (0–60 months): sex-specific files,
monthcolumn. - CDC (0–240 months): single file per metric with
Sex(1=boy, 2=girl) andAgemos.
getReference normalizes both into { month, L, M, S }.
The birth-to-24-month WHO weight-for-age and length-for-age L/M/S rows match the CSV files linked
from the CDC WHO data files page. The CDC age-based tables match the CDC 2000 Growth Charts data
files for weight-for-age and length/stature-for-age. npm test verifies representative source rows,
CDC's published 9-month male weight-for-age LMS example, and the bundled CDC percentile columns
against the LMS equations.
After calculation, the default result view is a percentile-band summary with findings, visual percentile bands, and Low / Typical / High labels. Users can switch the visualization section to percentile charts with the Bands / Charts control; the selected view is saved in localStorage. Results include a medical disclaimer reminding users that growth charts are informational and should be discussed with a pediatrician or healthcare provider.
Cloudflare Pages builds on every push to main:
- Framework: Astro
- Build command:
npm run build - Output:
dist
MIT