This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

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: * http://www.who.int/childgrowth/standards/en/ * http://www.who.int/entity/childgrowth/standards/technical_report/en/index.html

and can optionally use CDC growth standards: * http://www.cdc.gov/growthcharts

pygrowup avoids floating-point operations to eliminate the unwanted rounding that muddles the precision of some of the igrowup implementations: * http://docs.sun.com/source/806-3568/ncg_goldberg.html

REQUIREMENTS

INSTALLATION

pip install pygrowup

EXAMPLE USAGE

Typical usage might look like this:

#!/usr/bin/env python

from pygrowup import Calculator
# helpers contains optional utilities for formatting dates, etc
from pygrowup import helpers

# 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.
calculator = Calculator(adjust_height_data=False, adjust_weight_scores=False,
                       include_cdc=False, logger_name='pygrowup',
                       log_level='INFO')

# for a timeless example, lets pick a birthdate nine months ago
import datetime
great_day = datetime.datetime.utcnow().date()
nine_months_ago = great_day - datetime.timedelta(days=(9 * 30.4374))

# nine months ago in an odd, ambiguous string format
dob = nine_months_ago.strftime("%d%m%y")

my_child = {'date_of_birth' : dob, 'sex' : 'male', 'weight' : '8.0', 'height' : '69.5'}

# optionally use helper functions for formatting data

# transform something like '100309' into '2009-03-10'
valid_date = helpers.get_good_date(my_child['date_of_birth'])

# transform 'male' into 'M'
valid_gender = helpers.get_good_sex('male')

# calculate 9 months from valid_date
valid_age = helpers.date_to_age_in_months(valid_date[1])


# calculate length/height-for-age zscore
lhfa_zscore_for_my_child = calculator.lhfa(my_child['height'], valid_age, valid_gender)

# calculate weight-for-age zscore
wfa_zscore_for_my_child = calculator.wfa(my_child['weight'], valid_age, valid_gender)

# calculate weight-for-length zscore
# optional height parameter is only necessary for weight-for-height
# and weight-for-length
wfl_zscore_for_my_child = calculator.wfl(my_child['weight'], valid_age, valid_gender, my_child['height'])

# Note: for backwards compatibility you may still make calls to:
wfl_zscore_for_my_child = calculator.zscore_for_measurement('wfl', my_child['weight'], valid_age, valid_gender, my_child['height'])

EXCEPTIONS

caller should watch for:

  • AssertionError raised when caller provides inappropriate parameters

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

  • InvalidMeasurement raised when measurement is invalid for requested indicator
  • InvalidAge raised when age is invalid for requested indicator
  • DataNotFound raised when WHO/CDC data is not found for the requested observation (e.g., box-cox, median, coeffeciant of vairance for age)
  • DataError raised when an error occurs while loading WHO/CDC data into memory

TESTING

install nose to execute tests: pip install nose

the included tests use example anthropometric data taken from demonstration data shipped with WHO’s igrowup software. pygrowup performs the same calculations and compares the results to the WHO results. please see the sofware licence agreement for WHO’s igrowup, which is the souce of the test data files: http://www.who.int/childgrowth/software/license2.pdf

currently, 4 cases fail to produce results within 1 standard deviation of the WHO resuts. I believe these discrepencies are due to WHO’s use of floating point arithmetic in their igrowup software, which leads to less precise calculations compared to pygrowup. In the absence of any other trusted test data, please be aware that no claims are made to the accuracy or reliability of pygroup’s calculations.

to run the tests: $ nosetests tests.py

DEVELOPING

The source WHO .txt tables can be easily converted to json with the help of two amazing python utilities:

heres an example one-liner that changes the source .txt from tsv to csv (with pyp) and then to json (with csvkit’s csvjson) $ cat bmi_girls_2_5_zscores.txt | pyp "p.replace('\t', ',')" | csvjson > bmifa_girls_2_5_zscores.json

Release History

Release History

0.8.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.8.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.8b0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7.7b0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7.6b0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7.5b0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7b0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.6.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.6.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pygrowup-0.8.2.tar.gz (425.6 kB) Copy SHA256 Checksum SHA256 Source Mar 14, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting