Project

anthro

0.0
The project is in a healthy, maintained state
A Ruby gem for calculating anthropometric z-scores and percentiles based on the WHO and CDC 2000 growth chart data.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.6
~> 1.15, >= 1.15.1
~> 5.25
~> 13.2
~> 1.74

Runtime

~> 0.1.3
 Project Readme

Anthro

A Ruby gem for calculating anthropometric z-scores and percentiles based on the WHO Growth Charts and CDC Growth Charts.

Installation

Install the gem and add to the application's Gemfile by executing:

bundle add anthro

If bundler is not being used to manage dependencies, install the gem by executing:

gem install anthro

Usage

Convenience Methods (Recommended)

require 'anthro'

# Weight (month-based)
calc = Anthro.weight_for_age(sex: "male", age_months: 24.5, value: 13.0)
puts "Z-Score: #{calc.z_score.round(2)}"
puts "Percentile: #{calc.percentile.round(2)}%"

# Weight (days-based): days devided by 30.4375
calc = Anthro.weight_for_age(sex: "male", age_days: 3653, value: 33.0) # ~120 months
puts "Z-Score: #{calc.z_score.round(2)}"
puts "Percentile: #{calc.percentile.round(2)}%"

# Height
calc = Anthro.height_for_age(sex: "female", age_days: 1461, value: 100.0) # ~48 months
puts "Z-Score: #{calc.z_score.round(2)}"
puts "Percentile: #{calc.percentile.round(2)}%"

# BMI
calc = Anthro.bmi_for_age(sex: "male", age_months: 36, value: 16.0)
puts "Z-Score: #{calc.z_score.round(2)}"
puts "Percentile: #{calc.percentile.round(2)}%"

# Head Circumference
calc = Anthro.head_circumference_for_age(sex: "female", age_months: 12, value: 46.0)
puts "Z-Score: #{calc.z_score.round(2)}"
puts "Percentile: #{calc.percentile.round(2)}%"

Supported Measurements

  • Anthro.weight_for_age(sex:, age_months: or age_days:, value:) (0–20 years)
  • Anthro.height_for_age(sex:, age_months: or age_days:, value:) (0–20 years)
  • Anthro.bmi_for_age(sex:, age_months: or age_days:, value:) (2–20 years)
  • Anthro.head_circumference_for_age(sex:, age_months: or age_days:, value:) (0–2 years)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Data

This gem includes WHO and CDC 2000 growth chart data from WHO Growth Charts Data files and CDC Growth Charts Data Files.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hms-dbmi/anthro.

License

See the LICENSE file for license rights and limitations (MIT).