Skip to content

kmanan/child-growth-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

cdc-growth-charts

CI

A privacy-first pediatric growth chart viewer built on the CDC growth reference (0–20 years). Plot a child's weight, length / height, head circumference, and BMI against the same percentile curves a US pediatric EMR uses.

Two modes from one codebase:

  • Hosted (e.g. krytonlabs.com/childgrowth) — ephemeral "quick check and leave." Nothing persists. Refresh = gone.
  • Self-host — same UI plus opt-in localStorage tracking and one-click export to Baby Buddy CSV format for when you outgrow this tool.

Quickstart (self-host)

git clone https://github.com/kmanan/child-growth-graph.git
cd child-growth-graph
docker compose up -d

Then open http://localhost:4769. That's it.

CDC Growth Charts interface preview

Why 4769? It's GROW on a phone keypad, and it sidesteps the port-3000 traffic jam (Grafana, Gitea, every other Next.js app). Override with HOST_PORT=8080 docker compose up -d, or copy .env.example to .env and edit. The container always listens on 3000 internally; the host port is yours to choose.

What it does

  • Plots weight-for-age, length/stature-for-age, head-circumference-for-age, and BMI-for-age against the CDC reference's 10th / 50th / 90th percentile curves.
  • Computes percentile and z-score for any measurement, with "outside chart range" handling for ages beyond the table's support.
  • Toggle between US (lb / in) and metric (kg / cm) input and display.
  • Dark mode.
  • No backend, no database, no analytics, no telemetry. The entire app runs in the browser; the server only serves the static bundle.

Validated to within 2.5×10⁻⁵% relative error against the CDC's published P3/P10/P50/P90/P97 columns across all 1,536 reference rows. See docs/oss-self-host-design.md for the methodology.

Self-host features

When NEXT_PUBLIC_ENABLE_TRACKING=true is baked into the build (the default for the Dockerfile), two extra capabilities turn on:

  1. localStorage persistence. Measurements survive refreshes. Schema is versioned (growth-charts.v1) and corrupt entries fall back to empty.

  2. Baby Buddy CSV export. A single click produces four downloads matching Baby Buddy's import format exactly:

    • weight.csvchild_id,weight,date,notes
    • height.csvchild_id,height,date,notes
    • headcircumference.csvchild_id,head_circumference,date,notes
    • bmi.csvchild_id,bmi,date,notes

    child_id defaults to 1 (Baby Buddy's first-child default). Edit the CSV before importing if your Baby Buddy install uses a different ID. Values export in whatever unit system you're currently viewing — the button labels the units explicitly.

Docker Image

Tagged releases publish multi-arch images to GitHub Container Registry:

docker run -d --name growth-charts -p 4769:3000 ghcr.io/kmanan/child-growth-graph:latest

For sub-path mounting, build your own image with --build-arg BASE_PATH=/childgrowth because Next.js inlines basePath at build time.

Configuration

Variable Default Scope Purpose
BASE_PATH "" Build-time (Docker ARG) URL prefix for sub-path mounting. Inlined into client bundle; requires rebuild.
NEXT_PUBLIC_ENABLE_TRACKING "true" (Docker), "false" (npm) Build-time Enables localStorage + CSV export.
HOST_PORT 4769 Runtime (compose) Port to expose on the host.
PORT 3000 Runtime (container) Internal Next.js listen port.

Sub-path mounting (e.g. behind a reverse proxy at /childgrowth)

basePath is a Next.js build-time inlined value, so this requires rebuilding the image:

docker build --build-arg BASE_PATH=/childgrowth -t cdc-growth-charts .
docker run -d -p 3000:3000 cdc-growth-charts

Then proxy proxy_pass http://127.0.0.1:3000/childgrowth; — do not strip the prefix; Next expects it intact. See docs/oss-self-host-design.md §8.4 for the full discussion.

Development

npm install          # use Node 20; .nvmrc and .node-version are provided
npm run dev          # http://localhost:3000
npm run build        # production build
npm run lint         # ESLint (flat config)
node data/build_lms.mjs  # regenerate lib/growthData.ts from data/raw/*.csv
npm run validate:data  # verify CDC LMS math against published percentiles
npm audit --omit=dev # production dependency audit

Node ≥ 20.9 required.

Data source

CDC L/M/S parameter tables (public domain). See data/raw/README.md for source URLs, retrieval date, and SHA256 checksums.

Not medical advice

This is a viewer/calculator, not a medical device. Numbers shown are directional and based on the CDC reference. Always consult your pediatrician for clinical assessment. See docs/oss-self-host-design.md §2 for full scope/non-goals.

License

Apache 2.0. See NOTICE for attribution.

Design doc

docs/oss-self-host-design.md — architecture, deployment, threat model, roadmap.


Migrating to a fuller baby tracker? Baby Buddy is the canonical self-host option, and the CSV export here drops straight into its import flow.

About

growth graphs for infants

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors