From 79aec9f7e53a9dfab1d181448eaa59206d2da21d Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Tue, 11 Jun 2024 11:42:57 +0000 Subject: [PATCH] feat(growth): calculate z-score/centile for all indicators --- lib/growth/growth.ex | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/growth/growth.ex b/lib/growth/growth.ex index 73b627c..d5c60f0 100644 --- a/lib/growth/growth.ex +++ b/lib/growth/growth.ex @@ -13,6 +13,7 @@ defmodule Growth do alias __MODULE__.Calc.Age alias __MODULE__.Calc.BMI + alias __MODULE__.Score @type gender :: :male | :female @@ -107,6 +108,7 @@ defmodule Growth do |> with_age_in_weeks() |> with_age_in_months() |> with_bmi() + |> with_results() end for precision <- [:day, :week, :month] do @@ -143,6 +145,18 @@ defmodule Growth do growth end + def with_results(growth) do + Score.Scorer.results(growth, [ + Score.BMI, + Score.Height, + Score.Weight, + Score.TricepsSkinfold, + Score.SubscapularSkinfold, + Score.ArmCircumference, + Score.HeadCircumference + ]) + end + defp default_opts do Enum.map(@valid_measures, fn :date_of_measurement = key ->