Generate WHO Child Growth Standards charts with percentile curves and child data overlay.
Features
- - Height-for-age (0-19 years)
- Weight-for-age (0-10 years)
- BMI-for-age (0-19 years)
- Supports boys and girls
- Downloads WHO data on demand from cdn.who.int (cached locally)
- Overlays child's actual measurements with trend line
Examples
| Height | Weight | BMI |
|---|
| <img src="examples/annaheight.png" width="250"> | <img src="examples/annaweight.png" width="250"> | <img src="examples/anna_bmi.png" width="250"> |
Prerequisites
Install Python dependencies:
CODEBLOCK0
Usage
Basic Chart Generation
CODEBLOCK1
Arguments:
- -
name: Child's name (used in chart title) - INLINECODE1 : Date of birth in DD.MM.YYYY format
- INLINECODE2 /
-s: F (female) or M (male) — default: F - INLINECODE6 /
-t: height, weight, bmi, or all — default: all - INLINECODE12 /
-d: JSON file with measurement data - INLINECODE14 /
-o: Output directory for charts
With Measurement Data
Create a JSON file with height/weight measurements (heights in meters, weights in kg):
CODEBLOCK2
CODEBLOCK3
Integration with Withings
Combine with withings-family skill to fetch weight data automatically:
CODEBLOCK4
Output
By default, charts and cache are written to:
- - INLINECODE17
- INLINECODE18
Where <workspace> is the folder that contains your skills/ directory (auto-detected from CWD or script location).
技能名称: who-growth-charts
详细描述:
生成包含百分位曲线和儿童数据叠加的WHO儿童生长标准图表。
功能特性
- - 年龄别身高(0-19岁)
- 年龄别体重(0-10岁)
- 年龄别BMI(0-19岁)
- 支持男孩和女孩
- 按需从cdn.who.int下载WHO数据(本地缓存)
- 叠加儿童实际测量数据并显示趋势线
示例
| 身高 | 体重 | BMI |
|---|
| <img src=examples/annaheight.png width=250> | <img src=examples/annaweight.png width=250> | <img src=examples/anna_bmi.png width=250> |
前置条件
安装Python依赖:
bash
pip install pandas matplotlib scipy openpyxl
使用方法
基础图表生成
bash
python3 ./scripts/growth_chart.py 儿童姓名 DD.MM.YYYY --sex F --type all
参数说明:
- - name:儿童姓名(用于图表标题)
- birthdate:出生日期,格式为DD.MM.YYYY
- --sex / -s:F(女性)或M(男性)— 默认值:F
- --type / -t:height、weight、bmi或all — 默认值:all
- --data / -d:包含测量数据的JSON文件
- --output / -o:图表输出目录
使用测量数据
创建包含身高/体重测量数据的JSON文件(身高单位为米,体重单位为千克):
json
{
heights: [ [2024-01-15T10:00:00, 1.05] ],
weights: [ [2024-01-15T10:00:00, 17.5] ]
}
bash
python3 ./scripts/growthchart.py Emma 06.07.2016 --sex F --data emmadata.json --type all
与Withings集成
结合withings-family技能自动获取体重数据:
bash
获取Withings体重数据(假设已安装withings-family技能)
python3 ../withings-family/scripts/withings.py emma body > /tmp/withings.json
解析并生成图表
(如果已实现,生长图表脚本可处理Withings JSON格式,否则需进行转换)
输出
默认情况下,图表和缓存文件写入以下位置:
- - /who-growth-charts/
- /who-growth-charts/cache/
其中是包含skills/目录的文件夹(根据当前工作目录或脚本位置自动检测)。