# pygrowthstandards
[](https://badge.fury.io/py/pygrowthstandards)
[](https://pypi.org/project/pygrowthstandards)
[](https://pypi.org/project/pygrowthstandards)
[](https://opensource.org/licenses/MIT)
[](https://github.com/Yannngn/pygrowthstandards/actions/workflows/python-package.yml)
[](https://github.com/pre-commit/pre-commit)
A Python library for calculating and visualizing child growth standards using data from the World Health Organization (WHO) and the INTERGROWTH-21st Project.
This toolkit provides a simple and flexible API to assess child growth by calculating z-scores and percentiles for common anthropometric measurements, including height, weight, BMI, and head circumference.
## Data Sources
This library implements standards from internationally recognized sources:
- **[WHO Child Growth Standards](https://www.who.int/tools/child-growth-standards):** For infants and children from birth to 5 years.
- **[WHO Growth Reference Data for 5-19 years](https://www.who.int/tools/growth-reference-data-for-5to19-years):** For school-aged children and adolescents.
- **[The INTERGROWTH-21st Project](https://intergrowth21.tghn.org/):** For newborn, preterm, and postnatal growth.
## Features
- Calculate z-scores and percentiles for stature (length/height), weight, BMI, and head circumference.
- Support for both WHO and INTERGROWTH-21st growth standards.
- A simple object-oriented `Calculator` for tracking a `Patient`'s measurements over time.
- A straightforward functional API for one-off calculations.
- Generate and save customizable growth charts.
## Installation
To install the latest stable release from PyPI:
```bash
pip install pygrowthstandards
```
### Development Installation
To install for development, clone the repository and install in editable mode using uv:
```bash
git clone https://github.com/Yannngn/pygrowthstandards.git
cd pygrowthstandards
uv venv --python 3.11
source .venv/bin/activate
uv sync
```
## Quick Start
### Object-Oriented Approach
The object-oriented API is ideal for tracking a patient's growth over time. It uses a `Patient` object to store measurements and a `Plotter` to visualize them.
```python
# filepath: main.py
import datetime
from pygrowthstandards.oop.patient import Patient
from pygrowthstandards.oop.measurement import MeasurementGroup
from pygrowthstandards.oop.plotter import Plotter
# 1. Create a Patient
patient = Patient(
sex="M",
birthday_date=datetime.date(2022, 1, 1),
)
# 2. Add measurements over time
measurements = [
MeasurementGroup(date=datetime.date(2022, 7, 1), weight=8.6, stature=68.4, head_circumference=44.5),
MeasurementGroup(date=datetime.date(2023, 1, 1), weight=10.2, stature=75.7, head_circumference=46.5),
MeasurementGroup(date=datetime.date(2024, 1, 1), weight=12.6, stature=87.8, head_circumference=48.5),
]
for mg in measurements:
patient.add_measurements(mg)
# 3. Calculate z-scores for all measurements
patient.calculate_all()
# 4. Display a summary table
print(patient.display_measurements())
# 5. Plot the growth charts
plotter = Plotter(patient)
plotter.plot(
age_group="0-2",
measurement_type="stature",
show=False,
output_path="stature_growth_chart.png"
)
```
#### Example Output
After running the above code, you can view the generated growth chart:

### Functional Approach
For quick, single, stateless calculations, the functional API provides direct access to the z-score calculation engine. This is useful when you don't need to track a patient's history.
```python
# filepath: main.py
from pygrowthstandards import functional as F
# Calculate z-scores for various measurements and ages
z1 = F.zscore("stature", 50, "F", age_days=0, gestational_age=280)
z2 = F.zscore("weight", 5, "F", age_days=30)
z3 = F.zscore("head_circumference", 40, "F", age_days=180)
z4 = F.zscore("stature", 80, "F", age_days=365)
z5 = F.zscore("weight", 12, "F", age_days=730)
z6 = F.zscore("head_circumference", 48, "F", age_days=1460)
print(f"{z1:.2f}\n{z2:.2f}\n{z3:.2f}\n{z4:.2f}\n{z5:.2f}\n{z6:.2f}")
```
The output of this script is:
```
0.45
1.34
-1.64
2.33
0.36
-0.94
```
## Contributing
Contributions are welcome! Please feel free to open an issue to report a bug or suggest a feature, or submit a pull request with your improvements.
Before contributing, please set up the development environment and run the pre-commit hooks and tests.
```bash
# Install hooks
pre-commit install
# Run tests
pytest
```
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Acknowledgements
This package is built upon the publicly available data provided by the **World Health Organization (WHO)** and **The INTERGROWTH-21st Project**. We are grateful for their commitment to open data and global health.
Raw data
{
"_id": null,
"home_page": null,
"name": "pygrowthstandards",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "Yannngn <contato.yannnob@gmail.com>",
"keywords": "anthropometry, children, growth, intergrowth, pediatrics, percentile, who, z-score",
"author": null,
"author_email": "Yannngn <contato.yannnob@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c6/a3/b8a064cfbe747487c69fd66e8df86760d75ea02c993fb736d08b4c56c22e/pygrowthstandards-0.1.2.tar.gz",
"platform": null,
"description": "# pygrowthstandards\n\n[](https://badge.fury.io/py/pygrowthstandards)\n[](https://pypi.org/project/pygrowthstandards)\n[](https://pypi.org/project/pygrowthstandards)\n[](https://opensource.org/licenses/MIT)\n[](https://github.com/Yannngn/pygrowthstandards/actions/workflows/python-package.yml)\n[](https://github.com/pre-commit/pre-commit)\n\nA Python library for calculating and visualizing child growth standards using data from the World Health Organization (WHO) and the INTERGROWTH-21st Project.\n\nThis toolkit provides a simple and flexible API to assess child growth by calculating z-scores and percentiles for common anthropometric measurements, including height, weight, BMI, and head circumference.\n\n## Data Sources\n\nThis library implements standards from internationally recognized sources:\n\n- **[WHO Child Growth Standards](https://www.who.int/tools/child-growth-standards):** For infants and children from birth to 5 years.\n- **[WHO Growth Reference Data for 5-19 years](https://www.who.int/tools/growth-reference-data-for-5to19-years):** For school-aged children and adolescents.\n- **[The INTERGROWTH-21st Project](https://intergrowth21.tghn.org/):** For newborn, preterm, and postnatal growth.\n\n## Features\n\n- Calculate z-scores and percentiles for stature (length/height), weight, BMI, and head circumference.\n- Support for both WHO and INTERGROWTH-21st growth standards.\n- A simple object-oriented `Calculator` for tracking a `Patient`'s measurements over time.\n- A straightforward functional API for one-off calculations.\n- Generate and save customizable growth charts.\n\n## Installation\n\nTo install the latest stable release from PyPI:\n\n```bash\npip install pygrowthstandards\n```\n\n### Development Installation\n\nTo install for development, clone the repository and install in editable mode using uv:\n\n```bash\ngit clone https://github.com/Yannngn/pygrowthstandards.git\ncd pygrowthstandards\nuv venv --python 3.11\nsource .venv/bin/activate\nuv sync\n```\n\n## Quick Start\n\n### Object-Oriented Approach\n\nThe object-oriented API is ideal for tracking a patient's growth over time. It uses a `Patient` object to store measurements and a `Plotter` to visualize them.\n\n```python\n# filepath: main.py\nimport datetime\nfrom pygrowthstandards.oop.patient import Patient\nfrom pygrowthstandards.oop.measurement import MeasurementGroup\nfrom pygrowthstandards.oop.plotter import Plotter\n\n# 1. Create a Patient\npatient = Patient(\n sex=\"M\",\n birthday_date=datetime.date(2022, 1, 1),\n)\n\n# 2. Add measurements over time\nmeasurements = [\n MeasurementGroup(date=datetime.date(2022, 7, 1), weight=8.6, stature=68.4, head_circumference=44.5),\n MeasurementGroup(date=datetime.date(2023, 1, 1), weight=10.2, stature=75.7, head_circumference=46.5),\n MeasurementGroup(date=datetime.date(2024, 1, 1), weight=12.6, stature=87.8, head_circumference=48.5),\n]\nfor mg in measurements:\n patient.add_measurements(mg)\n\n# 3. Calculate z-scores for all measurements\npatient.calculate_all()\n\n# 4. Display a summary table\nprint(patient.display_measurements())\n\n# 5. Plot the growth charts\nplotter = Plotter(patient)\nplotter.plot(\n age_group=\"0-2\",\n measurement_type=\"stature\",\n show=False,\n output_path=\"stature_growth_chart.png\"\n)\n```\n\n#### Example Output\n\nAfter running the above code, you can view the generated growth chart:\n\n\n\n### Functional Approach\n\nFor quick, single, stateless calculations, the functional API provides direct access to the z-score calculation engine. This is useful when you don't need to track a patient's history.\n\n```python\n# filepath: main.py\nfrom pygrowthstandards import functional as F\n\n# Calculate z-scores for various measurements and ages\nz1 = F.zscore(\"stature\", 50, \"F\", age_days=0, gestational_age=280)\nz2 = F.zscore(\"weight\", 5, \"F\", age_days=30)\nz3 = F.zscore(\"head_circumference\", 40, \"F\", age_days=180)\nz4 = F.zscore(\"stature\", 80, \"F\", age_days=365)\nz5 = F.zscore(\"weight\", 12, \"F\", age_days=730)\nz6 = F.zscore(\"head_circumference\", 48, \"F\", age_days=1460)\n\nprint(f\"{z1:.2f}\\n{z2:.2f}\\n{z3:.2f}\\n{z4:.2f}\\n{z5:.2f}\\n{z6:.2f}\")\n```\n\nThe output of this script is:\n\n```\n0.45\n1.34\n-1.64\n2.33\n0.36\n-0.94\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to open an issue to report a bug or suggest a feature, or submit a pull request with your improvements.\n\nBefore contributing, please set up the development environment and run the pre-commit hooks and tests.\n\n```bash\n# Install hooks\npre-commit install\n\n# Run tests\npytest\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Acknowledgements\n\nThis package is built upon the publicly available data provided by the **World Health Organization (WHO)** and **The INTERGROWTH-21st Project**. We are grateful for their commitment to open data and global health.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library for calculating child growth z-scores and percentiles using WHO and INTERGROWTH-21st standards",
"version": "0.1.2",
"project_urls": {
"Documentation": "https://github.com/Yannngn/pygrowthstandards#readme",
"Homepage": "https://github.com/Yannngn/pygrowthstandards",
"Issues": "https://github.com/Yannngn/pygrowthstandards/issues",
"Repository": "https://github.com/Yannngn/pygrowthstandards"
},
"split_keywords": [
"anthropometry",
" children",
" growth",
" intergrowth",
" pediatrics",
" percentile",
" who",
" z-score"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c491e9b5dc7390fc81a3524ca76b5f81cf0c7094eaffd63015517acd75e0d9b9",
"md5": "330892aff1b206887faf600421ad3cb8",
"sha256": "3a6300ba40b8c0f27e0983988b6dcd7b0d9e074db6999a5887a8e2fd0834897c"
},
"downloads": -1,
"filename": "pygrowthstandards-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "330892aff1b206887faf600421ad3cb8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 261931,
"upload_time": "2025-08-22T22:25:22",
"upload_time_iso_8601": "2025-08-22T22:25:22.369726Z",
"url": "https://files.pythonhosted.org/packages/c4/91/e9b5dc7390fc81a3524ca76b5f81cf0c7094eaffd63015517acd75e0d9b9/pygrowthstandards-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c6a3b8a064cfbe747487c69fd66e8df86760d75ea02c993fb736d08b4c56c22e",
"md5": "c44827093dae507da69ffaad4d872d72",
"sha256": "b7a0706bcf22f049bb6b11551edae0583e4e706477528f91d5ed31ad2d962873"
},
"downloads": -1,
"filename": "pygrowthstandards-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "c44827093dae507da69ffaad4d872d72",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 257543,
"upload_time": "2025-08-22T22:25:24",
"upload_time_iso_8601": "2025-08-22T22:25:24.363729Z",
"url": "https://files.pythonhosted.org/packages/c6/a3/b8a064cfbe747487c69fd66e8df86760d75ea02c993fb736d08b4c56c22e/pygrowthstandards-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-22 22:25:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Yannngn",
"github_project": "pygrowthstandards#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pandas",
"specs": [
[
">=",
"2.3.0"
]
]
}
],
"lcname": "pygrowthstandards"
}