Skip to main content

Calculate z-scores of anthropometric measurements based on WHO and CDC child growth standards

Project description

pygrowup-erknet

modified version of: http://github.com/ewheeler/pygrowup

pygrowup calculates z-scores for the following anthropometric indicators:

  • weight-for-age

  • length/height-for-age

  • weight-for-length/height

  • head-circumference-for-age

  • body-mass-index-for-age

based on the WHO Child Growth Standards:

and can optionally use CDC growth standards:

REQUIREMENTS

  • Python 3.8 or later

INSTALLATION

pip install pygrowup-erknet

EXAMPLE USAGE

Typical usage might look like this::

from pygrowup_erknet import Calculator
# Height adjustments are part of the WHO specification (see section 5.1)
# to correct for recumbent vs standing measurements,
# but none of the existing software seems to implement this.
# default is false so values are closer to those produced
# by igrowup software
#
# WHO specs include adjustments (see Chapter 7) to z-scores of weight-based
# indicators that are greater than +/- 3 SDs. These adjustments
# correct for right skewness and avoid making assumptions about
# the distribution of data beyond the limits of the observed values.
#
# However, when calculating z-scores in a live data collection
# situation, z-scores greater than +/- 3 SDs are likely to indicate
# data entry or anthropometric measurement errors and should not
# be adjusted. Instead, these large z-scores should be used to
# identify poor data quality and/or entry errors.
# These z-score adjustments are appropriate only when there
# is confidence in data quality.
#
# In this example, Calculator is initialized with its default values
# (i.e., ``calculator = Calculator()`` would do the same thing).
# The ``include_cdc`` option will enable CDC measurements for children >5 years.
# The ``override_tables`` option allows to provide a custom list of ``GrowthTable``. Can be used with ``CDC_TABLES`` to override the Who tables altogether.
calculator = Calculator(adjust_height_data=False,
                       include_cdc=False,
                       override_tables=None)

# The age in the calculator is always in months. To covert days to months, divide the age by 30.4375.

calculator.zscore_for_measurement(indicator='wfa' # allowed values are: bmifa, hcfa, lfa, hfa, wfa, wfh, wfl
                                    measurement=10.4, # weight in kg, height/lengt/head circumference in cm, bmi in kg/m2
                                    sex='M, # 'M' or 'F'
                                    index_value=22.45, #age in months or length/height in cm (depends on the indicator)
                                    is_recumbent_height=False) # ignored if adjust_height_data is set to False.

# The above method can be simplified using the following methods:

calculator.lhfa(measurement=10.4, age_in_months=22.45, sex='M', is_recumbent_height=False)

calculator.wfl(measurement=10.4, sex='M', length=84.8, is_recumbent_height=False)

calculator.wfh(measurement=10.4, sex='M', height=84.8, is_recumbent_height=False)

calculator.wfa(measurement=10.4, age_in_months=22.45, sex='M')

calculator.bmifa(measurement=14.46, age_in_months=22.45, sex='M')

calculator.hcfa(measurement=48.5, age_in_months=22.45, sex='M')

EXCEPTIONS

caller should watch for:

as well as more specific errors (all subclasses of RuntimeError and PyGrowUpError):

  • DataNotFound raised when no data is not found for the requested observation.

  • InvalidMeasurement raised when measurement (height/length, bmi, weight, head circumference) is invalid for a requested indicator.

  • InvalidTableNameError raised when an invalid indicator (table) was requested (allowed values are: bmifa, hcfa, lfa, hfa, wfa, wfh, wfl).

  • InvalidIndexErrorraised when an invalid index value was given for a requested indicator (usually age or length/height).

  • InvalidAge (subclass of InvalidIndexError) raised when the age is invalid for a requested indicator.

  • InvalidLengthError (subclass of InvalidIndexError) raised when the length/height is invalid for a requested indicator.

  • InvalidSexError raised when the sex could not be inferred, allowed values are 'M' or 'F'.

TESTING

to run the tests: $ python -m pygrowup_erknet.tests

BUILDING

$ python setup.py sdist bdist_wheel

$ twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygrowup_erknet-0.9.4.tar.gz (285.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygrowup_erknet-0.9.4-py3-none-any.whl (314.2 kB view details)

Uploaded Python 3

File details

Details for the file pygrowup_erknet-0.9.4.tar.gz.

File metadata

  • Download URL: pygrowup_erknet-0.9.4.tar.gz
  • Upload date:
  • Size: 285.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pygrowup_erknet-0.9.4.tar.gz
Algorithm Hash digest
SHA256 0736f5211e60f7862fd65a319451a914377e6ba996efd69bed743f1a7a9873a7
MD5 d23833437973c31eaae8a894b9edc983
BLAKE2b-256 fc24cacee49878e77be02a80c7de008d716e5e76b0e9be7d25891ac82bfa8a74

See more details on using hashes here.

File details

Details for the file pygrowup_erknet-0.9.4-py3-none-any.whl.

File metadata

File hashes

Hashes for pygrowup_erknet-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 55859e2b24c455d4654e52d2264ece208d520444cd545f350560c742955b990b
MD5 4a4ed64496bcd742a04744b3ed8b6539
BLAKE2b-256 5646d5eae2062cc683c97f0e9258ce8a4737f533eb58cfe29696d8d21bc7cf0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page