GrowthCleanPy
GrowthCleanPy is a Python package for cleaning pediatric growth data. It identifies implausible height and weight measurements — such as unit errors, swapped height/weight values, duplicates, carried-forward values, and extreme outliers — by comparing each measurement against standard growth references (WHO, CDC, NHANES, and Tanner height-velocity data). It adds an exclude column marking the status of each measurement so that only trustworthy values are retained for analysis.
GrowthCleanPy is a Python port of the R growthcleanr algorithm. This is a version 0 (minimum viable) release providing the core pediatric cleaning capability; future releases are expected to add functionality and enhancements.
The growth reference data is bundled with the package — no external data files need to be downloaded or configured.
Installation
GrowthCleanPy requires Python 3.10 or newer.
Install from the distributed wheel:
pip install growthcleanpy-0.1.0-py3-none-any.whl
Dependencies (pandas, numpy) are installed automatically. The same wheel works on Windows, macOS, Linux, and Databricks.
Confirm the installation:
python -c "import growthcleanpy; print(growthcleanpy.__version__)"
Input data
The input is a pandas DataFrame (or CSV) in long format with one measurement per row and the following columns:
| Column | Description |
|---|---|
subjid |
Subject / patient identifier |
param |
Measurement type (e.g. HEIGHTCM, WEIGHTKG) |
agedays |
Age in days at time of measurement |
sex |
Sex (0/1 or M/F) |
measurement |
The measured value (cm or kg) |
Usage
import pandas as pd
from growthcleanpy import cleangrowth
# load your data
df = pd.read_csv("my_growth_data.csv")
# run the cleaner
result = cleangrowth(df)
# review what was flagged
print(result["exclude"].value_counts())
# keep only valid measurements
clean = result[result["exclude"] == "Include"]
# save results
result.to_csv("cleaned_results.csv", index=False)
The result is the input data with an added exclude column. Rows marked Include passed all checks; other labels indicate why a measurement was flagged.
Common exclude labels
| Label | Meaning |
|---|---|
Include |
Passed all checks — keep. |
Missing |
Value missing or invalid age. |
Exclude-Carried-Forward |
Repeated (carried-forward) value. |
Exclude-Extraneous-Same-Day |
Extra measurement on a day with multiple values. |
Unit-Error-High / Unit-Error-Low |
Likely wrong units (e.g. lbs vs kg). |
Swapped-Measurements |
Height and weight appear swapped. |
Exclude-SD-Cutoff |
Extreme value beyond the plausibility cutoff. |
Exclude-EWMA-*, Exclude-*-Height-Change, Exclude-Pair-Delta-* |
Flagged by outlier / growth-velocity checks. |
Repository contents
| Path | Description |
|---|---|
src/growthcleanpy/ |
Package source code |
src/growthcleanpy/reference/ |
Bundled growth reference data (WHO/CDC/NHANES/Tanner) |
tests/ |
Automated regression tests |
tests/data/ |
Sample input and baseline output for testing |
pyproject.toml |
Package configuration and dependencies |
run_tests.sh |
Build-and-test automation script |
Running the tests
The automated regression suite verifies that the packaged library reproduces the validated baseline output exactly. Run against a source checkout:
pip install -e .[dev]
python -m pytest tests/
Or run the full build-and-test cycle against a freshly built wheel:
bash run_tests.sh
Releases
Built wheel packages are attached to tagged Releases. Download the .whl from the desired release and install as shown above.
Public Domain Standard Notice
This repository constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. This repository is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication. All contributions to this repository will be released under the CC0 dedication. By submitting a pull request you are agreeing to comply with this waiver of copyright interest.
License Standard Notice
The repository utilizes code licensed under the terms of the Apache Software License and therefore is licensed under ASL v2 or later.
This source code in this repository is free: you can redistribute it and/or modify it under the terms of the Apache Software License version 2, or (at your option) any later version.
This source code in this repository is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache Software License for more details.
You should have received a copy of the Apache Software License along with this program. If not, see http://www.apache.org/licenses/LICENSE-2.0.html
The source code forked from other open source projects will inherit its license.
Privacy Standard Notice
This repository contains only non-sensitive, publicly available data and information. All material and community participation is covered by the Disclaimer and Code of Conduct. For more information about CDC's privacy policy, please visit http://www.cdc.gov/other/privacy.html.
Contributing Standard Notice
Anyone is encouraged to contribute to the repository by forking and submitting a pull request. (If you are new to GitHub, you might start with a basic tutorial.) By contributing to this project, you grant a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users under the terms of the Apache Software License v2 or later.
All comments, messages, pull requests, and other submissions received through CDC including this GitHub page may be subject to applicable federal law, including but not limited to the Federal Records Act, and may be archived. Learn more at http://www.cdc.gov/other/privacy.html.
Records Management Standard Notice
This repository is not a source of government records, but is a copy to increase collaboration and collaborative potential. All government records will be published through the CDC web site.
Additional Standard Notices
Please refer to CDC's Template Repository for more information about contributing to this repository, public domain notices and disclaimers, and code of conduct.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file growthcleanpy-0.1.0.tar.gz.
File metadata
- Download URL: growthcleanpy-0.1.0.tar.gz
- Upload date:
- Size: 5.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72c131598165cd5f5097c3ef5d558c5d67064c1c6f60f88a417c9fd23c6196d9
|
|
| MD5 |
c89d790aad1e705878564153b5ae84ce
|
|
| BLAKE2b-256 |
64feb0db87709d611596e9e467c2292172e2d92a3b3cf1b26ddce2cfa80f84cc
|
Provenance
The following attestation bundles were made for growthcleanpy-0.1.0.tar.gz:
Publisher:
publish.yml on CDCgov/GrowthCleanPy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
growthcleanpy-0.1.0.tar.gz -
Subject digest:
72c131598165cd5f5097c3ef5d558c5d67064c1c6f60f88a417c9fd23c6196d9 - Sigstore transparency entry: 2772883131
- Sigstore integration time:
-
Permalink:
CDCgov/GrowthCleanPy@4ec196378a01c5dc4f78039867f25c2ff55fe4fb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CDCgov
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4ec196378a01c5dc4f78039867f25c2ff55fe4fb -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file growthcleanpy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: growthcleanpy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20756816b193fc0c207662748b39a9177febd5e1be0ddeef7c1e023263eed214
|
|
| MD5 |
0cfe1e642c989b655a4fcaa8a42b4089
|
|
| BLAKE2b-256 |
b59e39fbd4a27aacb8afe67ab358d56c02f9539626a97857be096b5f3a22ffac
|
Provenance
The following attestation bundles were made for growthcleanpy-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on CDCgov/GrowthCleanPy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
growthcleanpy-0.1.0-py3-none-any.whl -
Subject digest:
20756816b193fc0c207662748b39a9177febd5e1be0ddeef7c1e023263eed214 - Sigstore transparency entry: 2772883146
- Sigstore integration time:
-
Permalink:
CDCgov/GrowthCleanPy@4ec196378a01c5dc4f78039867f25c2ff55fe4fb -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CDCgov
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4ec196378a01c5dc4f78039867f25c2ff55fe4fb -
Trigger Event:
workflow_dispatch
-
Statement type: