NAME
    WHO::GrowthReference::Table - Lookup height/weight in the WHO growth
    chart (a.k.a. growth reference, growth standards)

VERSION
    This document describes version 0.012 of WHO::GrowthReference::Table
    (from Perl distribution WHO-GrowthReference-Table), released on
    2022-06-07.

SYNOPSIS
     use WHO::GrowthReference::Table qw(get_who_growth_reference);

     # get mean height & weight of a 3-year old girl

     my $res = get_who_growth_reference(gender => "F", dob => time() - 3*365.25*86400);
     # => [200, "OK", {
     #      age => "36.0 month(s)",
     #      height_mean => 95.034, # cm
     #      weight_mean => 13.9,   # kg
     #      height_P01  => ..., # height at 0.1% percentile
     #      height_P1   => ..., # height at 1% percentile
     #      height_Z-3  => ..., # height at -3 SD
     #      height_Z-2  => ..., # height at -2 SD
     #      ...
     #     }]

     # you have a 3.5-year old boy weighing at 14.8kg and with a height of 102cm,
     # calculate the percentiles

     my $res = get_who_growth_reference(gender => "M", dob => time() - 3.5*365.25*86400, weight=>14.8, height=>102);
     # => [200, "OK", {
     #      age => "42.0 month(s)",
     #      height_mean => 99.844, # cm
     #      height_percentile => 70.2, # your boy's height is above world average, about 70.2% of boys of the same age are shorter than your boy
     #      height_zscore => ...,
     #      weight_mean => 15.3,   # kg
     #      weight_percentile => 39.6, # your boy's weight is below world average, about 39.6% of boys of the same age weigh less than your boy
     #      weight_zscore => ...,
     #      height_P01 => ...,
     #      ...
     #      height_potential => ...,
     #      height_potential_Z0 => ...,
     #      weight_potential_10y => ...,
     #      weight_potential_10y_Z0 => ...,
     #     }]

DESCRIPTION
FUNCTIONS
  get_who_growth_reference
    Usage:

     get_who_growth_reference(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Lookup height/weight in the WHO growth chart (a.k.a. growth reference,
    growth standards).

    Examples:

    *   Get weight/height information for a boy that is born on May 4, 2017:

         get_who_growth_reference(gender => "M", dob => "2017-05-04");

        Result:

         [
           200,
           "OK",
           {
             age           => "61.0 month(s)",
             bmi_mean      => 15.264,
             bmi_P01       => 12.041,
             bmi_P1        => 12.72,
             bmi_P10       => 13.764,
             bmi_P15       => 14.03,
             bmi_P25       => 14.441,
             bmi_P3        => 13.148,
             bmi_P5        => 13.384,
             bmi_P50       => 15.264,
             bmi_P75       => 16.172,
             bmi_P85       => 16.7,
             bmi_P90       => 17.074,
             bmi_P95       => 17.656,
             bmi_P97       => 18.052,
             bmi_P99       => 18.845,
             bmi_P999      => 20.355,
             bmi_SD0       => 15.264,
             bmi_SD1       => 16.645,
             bmi_SD1neg    => 14.071,
             bmi_SD2       => 18.259,
             bmi_SD2neg    => 13.031,
             bmi_SD3       => 20.166,
             bmi_SD3neg    => 12.118,
             bmi_SD4       => 22.072,
             bmi_SD4neg    => 11.204,
             gender        => "M",
             height_mean   => 110.265,
             height_P01    => 96.076,
             height_P1     => 99.583,
             height_P10    => 104.381,
             height_P15    => 105.506,
             height_P25    => 107.168,
             height_P3     => 101.629,
             height_P5     => 102.712,
             height_P50    => 110.265,
             height_P75    => 113.362,
             height_P85    => 115.023,
             height_P90    => 116.149,
             height_P95    => 117.817,
             height_P97    => 118.9,
             height_P99    => 120.946,
             height_P999   => 124.453,
             height_SD0    => 110.265,
             height_SD1    => 114.856,
             height_SD1neg => 105.673,
             height_SD2    => 119.448,
             height_SD2neg => 101.082,
             height_SD3    => 124.039,
             height_SD3neg => 96.49,
             height_SD4    => 128.63,
             height_SD4neg => 91.899,
             weight_mean   => 18.506,
             weight_P01    => 12.581,
             weight_P1     => 13.802,
             weight_P10    => 15.711,
             weight_P15    => 16.204,
             weight_P25    => 16.967,
             weight_P3     => 14.58,
             weight_P5     => 15.013,
             weight_P50    => 18.506,
             weight_P75    => 20.216,
             weight_P85    => 21.212,
             weight_P90    => 21.92,
             weight_P95    => 23.023,
             weight_P97    => 23.774,
             weight_P99    => 25.276,
             weight_P999   => 28.126,
             weight_SD0    => 18.506,
             weight_SD1    => 21.109,
             weight_SD1neg => 16.279,
             weight_SD2    => 24.165,
             weight_SD2neg => 14.367,
             weight_SD3    => 27.77,
             weight_SD3neg => 12.718,
             weight_SD4    => 31.375,
             weight_SD4neg => 11.07,
           },
           {
             "func.raw_weight" => [
               61,
               -0.2026,
               18.5057,
               0.12988,
               12.581,
               13.802,
               14.58,
               15.013,
               15.711,
               16.204,
               16.967,
               18.506,
               20.216,
               21.212,
               21.92,
               23.023,
               23.774,
               25.276,
               28.126,
             ],
           },
         ]

    *   Get weight/height information for a 6.5yo girl:

         get_who_growth_reference(gender => "F", age => "6.5y");

        Result:

         [
           200,
           "OK",
           {
             age           => "78.0 month(s)",
             bmi_mean      => 15.32,
             bmi_P01       => 11.645,
             bmi_P1        => 12.365,
             bmi_P10       => 13.525,
             bmi_P15       => 13.832,
             bmi_P25       => 14.315,
             bmi_P3        => 12.832,
             bmi_P5        => 13.096,
             bmi_P50       => 15.32,
             bmi_P75       => 16.492,
             bmi_P85       => 17.206,
             bmi_P90       => 17.728,
             bmi_P95       => 18.57,
             bmi_P97       => 19.165,
             bmi_P99       => 20.41,
             bmi_P999      => 23.013,
             bmi_SD0       => 15.32,
             bmi_SD1       => 17.131,
             bmi_SD1neg    => 13.879,
             bmi_SD2       => 19.482,
             bmi_SD2neg    => 12.704,
             bmi_SD3       => 22.668,
             bmi_SD3neg    => 11.725,
             bmi_SD4       => 25.855,
             bmi_SD4neg    => 10.746,
             gender        => "F",
             height_mean   => 117.977,
             height_P01    => 101.611,
             height_P1     => 105.657,
             height_P10    => 111.19,
             height_P15    => 112.488,
             height_P25    => 114.405,
             height_P3     => 108.016,
             height_P5     => 109.266,
             height_P50    => 117.977,
             height_P75    => 121.549,
             height_P85    => 123.466,
             height_P90    => 124.764,
             height_P95    => 126.688,
             height_P97    => 127.938,
             height_P99    => 130.297,
             height_P999   => 134.343,
             height_SD0    => 117.977,
             height_SD1    => 123.273,
             height_SD1neg => 112.681,
             height_SD2    => 128.569,
             height_SD2neg => 107.385,
             height_SD3    => 133.865,
             height_SD3neg => 102.089,
             height_SD4    => 139.161,
             height_SD4neg => 96.793,
             weight_mean   => 21.227,
             weight_P01    => 13.932,
             weight_P1     => 15.333,
             weight_P10    => 17.626,
             weight_P15    => 18.239,
             weight_P25    => 19.206,
             weight_P3     => 16.252,
             weight_P5     => 16.773,
             weight_P50    => 21.227,
             weight_P75    => 23.591,
             weight_P85    => 25.028,
             weight_P90    => 26.077,
             weight_P95    => 27.761,
             weight_P97    => 28.945,
             weight_P99    => 31.399,
             weight_P999   => 36.41,
             weight_SD0    => 21.227,
             weight_SD1    => 24.877,
             weight_SD1neg => 18.333,
             weight_SD2    => 29.572,
             weight_SD2neg => 15.998,
             weight_SD3    => 35.757,
             weight_SD3neg => 14.087,
             weight_SD4    => 41.942,
             weight_SD4neg => 12.175,
           },
           {
             "func.raw_weight" => [
               78,
               -0.5185,
               21.2274,
               0.1523,
               13.932,
               15.333,
               16.252,
               16.773,
               17.626,
               18.239,
               19.206,
               21.227,
               23.591,
               25.028,
               26.077,
               27.761,
               28.945,
               31.399,
               36.41,
             ],
           },
         ]

    *   See percentiles/z-scores for a 6yo boy weighing 17kg and having a
        height of 102cm:

         get_who_growth_reference(gender => "M", age => "6y", height => 102, weight => 17);

        Result:

         [
           200,
           "OK",
           {
             age                  => "72.0 month(s)",
             bmi                  => 16.3398692810458,
             bmi_mean             => 15.306,
             bmi_P01              => 12.066,
             bmi_P1               => 12.733,
             bmi_P10              => 13.773,
             bmi_P15              => 14.042,
             bmi_P25              => 14.459,
             bmi_P3               => 13.157,
             bmi_P5               => 13.393,
             bmi_P50              => 15.306,
             bmi_P75              => 16.258,
             bmi_P85              => 16.819,
             bmi_P90              => 17.221,
             bmi_P95              => 17.854,
             bmi_P97              => 18.291,
             bmi_P99              => 19.176,
             bmi_P999             => 20.91,
             bmi_percentile       => 76.4593454731863,
             bmi_SD0              => 15.306,
             bmi_SD1              => 16.761,
             bmi_SD1neg           => 14.083,
             bmi_SD2              => 18.52,
             bmi_SD2neg           => 13.04,
             bmi_SD3              => 20.689,
             bmi_SD3neg           => 12.141,
             bmi_SD4              => 22.858,
             bmi_SD4neg           => 11.242,
             bmi_zscore           => 0.71056307975653,
             gender               => "M",
             height_mean          => 115.951,
             height_P01           => 100.726,
             height_P1            => 104.49,
             height_P10           => 109.637,
             height_P15           => 110.845,
             height_P25           => 112.628,
             height_P3            => 106.685,
             height_P5            => 107.847,
             height_P50           => 115.951,
             height_P75           => 119.274,
             height_P85           => 121.057,
             height_P90           => 122.265,
             height_P95           => 124.055,
             height_P97           => 125.217,
             height_P99           => 127.412,
             height_P999          => 131.176,
             height_percentile    => 0.404622741764081,
             height_potential     => 155.876968650372,
             height_potential_SD0 => 176.543,
             height_SD0           => 115.951,
             height_SD1           => 120.878,
             height_SD1neg        => 111.024,
             height_SD2           => 125.804,
             height_SD2neg        => 106.097,
             height_SD3           => 130.731,
             height_SD3neg        => 101.171,
             height_SD4           => 135.658,
             height_SD4neg        => 96.244,
             height_zscore        => -2.83170929760455,
             weight_mean          => 20.514,
             weight_P01           => 13.913,
             weight_P1            => 15.248,
             weight_P10           => 17.361,
             weight_P15           => 17.912,
             weight_P25           => 18.768,
             weight_P3            => 16.105,
             weight_P5            => 16.585,
             weight_P50           => 20.514,
             weight_P75           => 22.48,
             weight_P85           => 23.637,
             weight_P90           => 24.467,
             weight_P95           => 25.767,
             weight_P97           => 26.661,
             weight_P99           => 28.464,
             weight_P999          => 31.948,
             weight_percentile    => 7.67396907216494,
             weight_SD0           => 20.514,
             weight_SD1           => 23.517,
             weight_SD1neg        => 17.996,
             weight_SD2           => 27.129,
             weight_SD2neg        => 15.87,
             weight_SD3           => 31.508,
             weight_SD3neg        => 14.063,
             weight_SD4           => 35.888,
             weight_SD4neg        => 12.256,
             weight_zscore        => -1.46848541862653,
           },
           {
             "func.raw_weight" => [
               72,
               -0.318,
               20.5137,
               0.13372,
               13.913,
               15.248,
               16.105,
               16.585,
               17.361,
               17.912,
               18.768,
               20.514,
               22.48,
               23.637,
               24.467,
               25.767,
               26.661,
               28.464,
               31.948,
             ],
           },
         ]

    Caveats:

    Currently the z-zcore line values (e.g. height_Z1, height_Z-1, etc) are
    calculated using linear interpolation.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   age => *duration*

    *   dob => *date*

    *   gender* => *str*

    *   height => *float*

        Specify height to calculate percentile.

    *   now => *date*

        Assume now is this date, instead of current date.

    *   weight => *float*

        Specify weight to calculate percentile.

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/WHO-GrowthReference-Table>.

SOURCE
    Source repository is at
    <https://github.com/perlancar/perl-WHO-GrowthReference-Table>.

SEE ALSO
    WHO::GrowthReference::GenChart uses this module to make growth charts.

    For CLI frontends for this module and more, see
    App::WHOGrowthReferenceUtils.

    Source data is from <http://www.who.int/childgrowth/standards/en/>. Note
    that CDC also publishes growth standards; I might write
    CDC::GrowthReference::Table too someday.

AUTHOR
    perlancar <perlancar@cpan.org>

CONTRIBUTING
    To contribute, you can send patches by email/via RT, or send pull
    requests on GitHub.

    Most of the time, you don't need to build the distribution yourself. You
    can simply modify the code, then test via:

     % prove -l

    If you want to build the distribution (e.g. to try to install it locally
    on your system), you can install Dist::Zilla,
    Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two
    other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional
    steps required beyond that are considered a bug and can be reported to
    me.

COPYRIGHT AND LICENSE
    This software is copyright (c) 2022, 2021, 2018 by perlancar
    <perlancar@cpan.org>.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    <https://rt.cpan.org/Public/Dist/Display.html?Name=WHO-GrowthReference-T
    able>

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

