diff --git a/lib/growth/growth.ex b/lib/growth/growth.ex index d5c60f0..b7cc470 100644 --- a/lib/growth/growth.ex +++ b/lib/growth/growth.ex @@ -87,6 +87,70 @@ defmodule Growth do * `:subscapular_skinfold`: subscapular skinfold in milimeters, defaults to `nil`. * `:triceps_skinfold`: triceps skinfold in milimeters, defaults to `nil`. + ## Examples + + iex> Growth.new( + ...> "child a", + ...> :male, + ...> ~D[2024-01-01], + ...> date_of_measurement: ~D[2024-04-01], + ...> weight: 8, + ...> height: 65.4, + ...> arm_circumference: 15.5, + ...> head_circumference: 42.8, + ...> subscapular_skinfold: 10.9, + ...> triceps_skinfold: 13.5 + ...> ) + %Growth{ + name: "child a", + gender: :male, + date_of_birth: ~D[2024-01-01], + date_of_measurement: ~D[2024-04-01], + age_in_days: 91, + age_in_weeks: 13, + age_in_months: 2, + weight: 8, + height: 65.4, + arm_circumference: 15.5, + head_circumference: 42.8, + subscapular_skinfold: 10.9, + triceps_skinfold: 13.5, + bmi: 18.703999850368, + results: [ + %{ + head_circumference: [ + {"day", {1.945484886994137, 42.800000000000004}}, + {"week", {1.945484886994137, 42.800000000000004}}, + {"month", {3.130859582465616, :na}} + ] + }, + %{arm_circumference: [{"day", {1.9227031505630465, 15.499999999999996}}]}, + %{subscapular_skinfold: [{"day", {1.9437372448689536, 10.9}}]}, + %{triceps_skinfold: [{"day", {1.950277062993091, 13.500000000000353}}]}, + %{ + weight: [ + {"day", {1.982458622036091, 8.0}}, + {"week", {1.982458622036091, 8.0}}, + {"month", {3.0355951313091745, :na}} + ] + }, + %{ + height: [ + {"day", {1.956263992749136, 65.4}}, + {"week", {1.956263992749136, 65.4}}, + {"month", {3.4867331002754054, :na}} + ] + }, + %{ + bmi: [ + {"day", {1.1977344927294398, 18.703999850368085}}, + {"week", {1.1977344927294398, 18.703999850368085}}, + {"month", {1.5837461190318038, 18.703999850367996}} + ] + } + ] + } + """ @spec new(String.t(), gender(), Date.t(), opts()) :: t() def new(name, gender, date_of_birth, opts \\ []) do