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.013 of WHO::GrowthReference::Table
    (from Perl distribution WHO-GrowthReference-Table), released on
    2024-07-17.

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           => "86.0 month(s)",
             bmi_mean      => 15.521,
             bmi_P01       => 12.198,
             bmi_P1        => 12.861,
             bmi_P10       => 13.917,
             bmi_P15       => 14.194,
             bmi_P25       => 14.627,
             bmi_P3        => 13.288,
             bmi_P5        => 13.528,
             bmi_P50       => 15.521,
             bmi_P75       => 16.55,
             bmi_P85       => 17.17,
             bmi_P90       => 17.622,
             bmi_P95       => 18.343,
             bmi_P97       => 18.848,
             bmi_P99       => 19.896,
             bmi_P999      => 22.044,
             bmi_SD0       => 15.521,
             bmi_SD1       => 17.106,
             bmi_SD1neg    => 14.236,
             bmi_SD2       => 19.116,
             bmi_SD2neg    => 13.171,
             bmi_SD3       => 21.763,
             bmi_SD3neg    => 12.272,
             bmi_SD4       => 24.409,
             bmi_SD4neg    => 11.373,
             gender        => "M",
             height_mean   => 122.675,
             height_P01    => 106.154,
             height_P1     => 110.238,
             height_P10    => 115.824,
             height_P15    => 117.134,
             height_P25    => 119.069,
             height_P3     => 112.62,
             height_P5     => 113.881,
             height_P50    => 122.675,
             height_P75    => 126.281,
             height_P85    => 128.216,
             height_P90    => 129.526,
             height_P95    => 131.469,
             height_P97    => 132.73,
             height_P99    => 135.112,
             height_P999   => 139.196,
             height_SD0    => 122.675,
             height_SD1    => 128.021,
             height_SD1neg => 117.329,
             height_SD2    => 133.367,
             height_SD2neg => 111.983,
             height_SD3    => 138.714,
             height_SD3neg => 106.636,
             height_SD4    => 144.06,
             height_SD4neg => 101.29,
             weight_mean   => 23.303,
             weight_P01    => 15.771,
             weight_P1     => 17.259,
             weight_P10    => 19.65,
             weight_P15    => 20.281,
             weight_P25    => 21.268,
             weight_P3     => 18.224,
             weight_P5     => 18.767,
             weight_P50    => 23.303,
             weight_P75    => 25.635,
             weight_P85    => 27.03,
             weight_P90    => 28.038,
             weight_P95    => 29.636,
             weight_P97    => 30.746,
             weight_P99    => 33.014,
             weight_P999   => 37.512,
             weight_SD0    => 23.303,
             weight_SD1    => 26.885,
             weight_SD1neg => 20.377,
             weight_SD2    => 31.33,
             weight_SD2neg => 17.958,
             weight_SD3    => 36.936,
             weight_SD3neg => 15.937,
             weight_SD4    => 42.542,
             weight_SD4neg => 13.915,
           },
           {
             "func.raw_weight" => [
               86,
               -0.4594,
               23.3029,
               0.13838,
               15.771,
               17.259,
               18.224,
               18.767,
               19.65,
               20.281,
               21.268,
               23.303,
               25.635,
               27.03,
               28.038,
               29.636,
               30.746,
               33.014,
               37.512,
             ],
           },
         ]

    *   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*

        (No description)

    *   dob => *date*

        (No description)

    *   gender* => *str*

        (No description)

    *   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,
    Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two
    other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps
    required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE
    This software is copyright (c) 2024, 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.