From 0865706a94e7dfdd249e21e2b2f5bd0cce753b68 Mon Sep 17 00:00:00 2001 From: Mannu Date: Sat, 16 May 2026 18:07:41 +0530 Subject: [PATCH] Add WHO growth standards with percentile tracking - Add head circumference to WHO standards (boys & girls 0-24 months) - Update growth API to return WHO standards with records - Update growth page to show percentile rankings - Add head circumference input to form - Use FamilyProvider instead of hardcoded childId - Show percentile (e.g., "50th-85th") for each measurement Co-Authored-By: Claude Opus 4.7 --- src/app/api/growth/route.ts | 17 +++++- src/app/growth/page.tsx | 106 ++++++++++++++++++++++++++---------- src/lib/growth-standards.ts | 73 +++++++++++++------------ 3 files changed, 129 insertions(+), 67 deletions(-) diff --git a/src/app/api/growth/route.ts b/src/app/api/growth/route.ts index bf1496b..7561709 100644 --- a/src/app/api/growth/route.ts +++ b/src/app/api/growth/route.ts @@ -1,5 +1,6 @@ import { NextResponse } from "next/server"; import { sql } from "@/db"; +import { WHO_BOY_WEIGHT, WHO_GIRL_WEIGHT, getAgeInMonthsFromBirth } from "@/lib/growth-standards"; interface GrowthEntry { childId: string; @@ -35,6 +36,8 @@ export async function POST(request: Request) { export async function GET(request: Request) { const { searchParams } = new URL(request.url); const childId = searchParams.get("childId"); + const birthDate = searchParams.get("birthDate"); + const sex = searchParams.get("sex") || "male"; if (!childId) { return NextResponse.json({ error: "childId required" }, { status: 400 }); @@ -46,7 +49,19 @@ export async function GET(request: Request) { [childId] ); - return NextResponse.json({ growth }); + // Get WHO standards for the child's age + const ageMonths = birthDate ? getAgeInMonthsFromBirth(birthDate) : 12; + const whoData = sex === "male" ? WHO_BOY_WEIGHT : WHO_GIRL_WEIGHT; + const whoStandard = whoData.find((d) => d.ageMonths === ageMonths) || whoData[whoData.length - 1]; + + return NextResponse.json({ + growth, + whoStandard: { + weight: whoStandard.weight, + height: whoStandard.height, + headCircumference: whoStandard.headCircumference, + } + }); } catch (error) { console.error(error); return NextResponse.json({ error: String(error) }, { status: 500 }); diff --git a/src/app/growth/page.tsx b/src/app/growth/page.tsx index dd4421e..54a6dae 100644 --- a/src/app/growth/page.tsx +++ b/src/app/growth/page.tsx @@ -1,44 +1,33 @@ "use client"; import { useState, useEffect } from "react"; +import { useFamily } from "../FamilyProvider"; import { WHO_BOY_WEIGHT, WHO_GIRL_WEIGHT, getAgeInMonthsFromBirth, getPercentile } from "@/lib/growth-standards"; -interface Child { - id: string; - name: string; - birthDate: string; - sex: string; -} - export default function GrowthPage() { - const [childId] = useState("5ad3b16a-1e0d-45ab-bc91-038397d75d0a"); + const { childId, child, familyId } = useFamily(); const [growthData, setGrowthData] = useState([]); + const [whoStandard, setWhoStandard] = useState(null); const [loading, setLoading] = useState(true); const [showAdd, setShowAdd] = useState(false); const [weight, setWeight] = useState(""); const [height, setHeight] = useState(""); - const [child, setChild] = useState(null); + const [headCircumference, setHeadCircumference] = useState(""); useEffect(() => { + if (!childId) return; fetch(`/api/growth?childId=${childId}`) .then(r => r.json()) .then(data => { setGrowthData(data.growth || []); + setWhoStandard(data.whoStandard); setLoading(false); }) .catch(() => setLoading(false)); - - // Fetch child info - fetch("/api/children?familyId=default") - .then(r => r.json()) - .then(data => { - if (data.children?.length > 0) { - setChild(data.children[0]); - } - }); }, [childId]); const handleAdd = async () => { + if (!childId || (!weight && !height && !headCircumference)) return; await fetch("/api/growth", { method: "POST", headers: { "Content-Type": "application/json" }, @@ -47,24 +36,42 @@ export default function GrowthPage() { measuredAt: new Date().toISOString(), weightKg: weight ? parseFloat(weight) : null, heightCm: height ? parseFloat(height) : null, + headCircumferenceCm: headCircumference ? parseFloat(headCircumference) : null, }), }); setShowAdd(false); setWeight(""); setHeight(""); + setHeadCircumference(""); + // Refresh data fetch(`/api/growth?childId=${childId}`) .then(r => r.json()) - .then(data => setGrowthData(data.growth || [])); + .then(data => { + setGrowthData(data.growth || []); + setWhoStandard(data.whoStandard); + }); }; // Get latest measurement const latest = growthData[0]; - // Get standard data for comparison + // Calculate age in months for WHO standard const ageMonths = child ? getAgeInMonthsFromBirth(child.birthDate) : 12; const standards = child?.sex === "male" ? WHO_BOY_WEIGHT : WHO_GIRL_WEIGHT; const standard = standards.find(s => s.ageMonths === Math.min(ageMonths, 24)) || standards[standards.length - 1]; + // Calculate percentile for latest reading + const weightPercentile = latest?.weight_kg && whoStandard ? + getPercentile(latest.weight_kg, whoStandard.weight.p3, whoStandard.weight.p15, whoStandard.weight.p50, whoStandard.weight.p85, whoStandard.weight.p97) : null; + const heightPercentile = latest?.height_cm && whoStandard ? + getPercentile(latest.height_cm, whoStandard.height.p3, whoStandard.height.p15, whoStandard.height.p50, whoStandard.height.p85, whoStandard.height.p97) : null; + const headPercentile = latest?.head_circumference_cm && whoStandard ? + getPercentile(latest.head_circumference_cm, whoStandard.headCircumference.p3, whoStandard.headCircumference.p15, whoStandard.headCircumference.p50, whoStandard.headCircumference.p85, whoStandard.headCircumference.p97) : null; + + if (!familyId) { + return
Please log in to view growth records.
; + } + return (
@@ -84,38 +91,64 @@ export default function GrowthPage() {
{child.name}
{ageMonths} months old
-
+
-
Weight (50th percentile)
+
Weight (50th %)
{standard.weight.p50} kg
-
Range: {standard.weight.p3}-{standard.weight.p97} kg
+
Range: {standard.weight.p3}-{standard.weight.p97}
-
Height (50th percentile)
+
Height (50th %)
{standard.height.p50} cm
-
Range: {standard.height.p3}-{standard.height.p97} cm
+
Range: {standard.height.p3}-{standard.height.p97}
+
+
+
Head (50th %)
+
{standard.headCircumference.p50} cm
+
Range: {standard.headCircumference.p3}-{standard.headCircumference.p97}
)} - {/* Latest Reading */} + {/* Latest Reading with Percentile */} {latest && (
Latest: {new Date(latest.measured_at).toLocaleDateString()}
-
+
{latest.weight_kg && (
Weight
{latest.weight_kg} kg
+ {weightPercentile && ( +
+ {weightPercentile} percentile +
+ )}
)} {latest.height_cm && (
Height
{latest.height_cm} cm
+ {heightPercentile && ( +
+ {heightPercentile} percentile +
+ )} +
+ )} + {latest.head_circumference_cm && ( +
+
Head
+
{latest.head_circumference_cm} cm
+ {headPercentile && ( +
+ {headPercentile} percentile +
+ )}
)}
@@ -123,20 +156,30 @@ export default function GrowthPage() { )} {showAdd && ( -
+
setWeight(e.target.value)} - className="w-full p-3 border rounded-xl mb-2" + className="w-full p-3 border rounded-xl" /> setHeight(e.target.value)} - className="w-full p-3 border rounded-xl mb-2" + className="w-full p-3 border rounded-xl" + /> + setHeadCircumference(e.target.value)} + className="w-full p-3 border rounded-xl" />
)) diff --git a/src/lib/growth-standards.ts b/src/lib/growth-standards.ts index 7c71fb6..431a1e9 100644 --- a/src/lib/growth-standards.ts +++ b/src/lib/growth-standards.ts @@ -6,48 +6,49 @@ export interface GrowthStandard { ageMonths: number; weight: { p50: number; p3: number; p15: number; p85: number; p97: number }; height: { p50: number; p3: number; p15: number; p85: number; p97: number }; + headCircumference: { p50: number; p3: number; p15: number; p85: number; p97: number }; } -// Boys weight (kg) by month +// Boys weight (kg) by month - with head circumference (cm) export const WHO_BOY_WEIGHT: GrowthStandard[] = [ - { ageMonths: 0, weight: { p50: 3.3, p3: 2.5, p15: 2.9, p85: 3.9, p97: 4.4 }, height: { p50: 49.9, p3: 46.3, p15: 47.9, p85: 51.8, p97: 53.4 } }, - { ageMonths: 1, weight: { p50: 4.5, p3: 3.4, p15: 3.9, p85: 5.2, p97: 5.8 }, height: { p50: 54.7, p3: 50.7, p15: 52.4, p85: 57.0, p97: 58.7 } }, - { ageMonths: 2, weight: { p50: 5.6, p3: 4.3, p15: 4.9, p85: 6.4, p97: 7.1 }, height: { p50: 58.4, p3: 54.1, p15: 55.8, p85: 61.0, p97: 62.7 } }, - { ageMonths: 3, weight: { p50: 6.4, p3: 4.9, p15: 5.6, p85: 7.3, p97: 8.1 }, height: { p50: 61.4, p3: 56.8, p15: 58.6, p85: 64.3, p97: 66.1 } }, - { ageMonths: 4, weight: { p50: 7.0, p3: 5.4, p15: 6.1, p85: 8.0, p97: 8.9 }, height: { p50: 63.9, p3: 59.0, p15: 60.9, p85: 66.8, p97: 68.7 } }, - { ageMonths: 5, weight: { p50: 7.5, p3: 5.8, p15: 6.5, p85: 8.6, p97: 9.5 }, height: { p50: 65.9, p3: 60.8, p15: 62.8, p85: 69.1, p97: 71.0 } }, - { ageMonths: 6, weight: { p50: 7.9, p3: 6.1, p15: 6.9, p85: 9.1, p97: 10.0 }, height: { p50: 67.6, p3: 62.4, p15: 64.5, p85: 70.8, p97: 72.8 } }, - { ageMonths: 7, weight: { p50: 8.3, p3: 6.4, p15: 7.2, p85: 9.5, p97: 10.5 }, height: { p50: 69.2, p3: 63.8, p15: 66.0, p85: 72.4, p97: 74.5 } }, - { ageMonths: 8, weight: { p50: 8.6, p3: 6.6, p15: 7.5, p85: 9.9, p97: 10.9 }, height: { p50: 70.6, p3: 65.1, p15: 67.4, p85: 73.9, p97: 76.0 } }, - { ageMonths: 9, weight: { p50: 8.9, p3: 6.8, p15: 7.7, p85: 10.2, p97: 11.3 }, height: { p50: 72.0, p3: 66.3, p15: 68.7, p85: 75.3, p97: 77.5 } }, - { ageMonths: 10, weight: { p50: 9.2, p3: 7.0, p15: 7.9, p85: 10.5, p97: 11.6 }, height: { p50: 73.3, p3: 67.5, p15: 70.0, p85: 76.7, p97: 78.9 } }, - { ageMonths: 11, weight: { p50: 9.4, p3: 7.1, p15: 8.1, p85: 10.8, p97: 12.0 }, height: { p50: 74.5, p3: 68.7, p15: 71.2, p85: 77.9, p97: 80.2 } }, - { ageMonths: 12, weight: { p50: 9.6, p3: 7.3, p15: 8.3, p85: 11.1, p97: 12.3 }, height: { p50: 75.7, p3: 69.8, p15: 72.4, p85: 79.1, p97: 81.4 } }, - { ageMonths: 15, weight: { p50: 10.3, p3: 7.8, p15: 8.9, p85: 11.9, p97: 13.2 }, height: { p50: 78.8, p3: 72.3, p15: 75.1, p85: 82.4, p97: 84.9 } }, - { ageMonths: 18, weight: { p50: 10.9, p3: 8.3, p15: 9.4, p85: 12.6, p97: 14.0 }, height: { p50: 81.7, p3: 74.7, p15: 77.6, p85: 85.7, p97: 88.3 } }, - { ageMonths: 21, weight: { p50: 11.5, p3: 8.7, p15: 9.9, p85: 13.3, p97: 14.8 }, height: { p50: 84.1, p3: 76.9, p15: 79.9, p85: 88.4, p97: 91.0 } }, - { ageMonths: 24, weight: { p50: 12.2, p3: 9.2, p15: 10.4, p85: 14.0, p97: 15.6 }, height: { p50: 86.4, p3: 78.9, p15: 82.0, p85: 90.7, p97: 93.4 } }, + { ageMonths: 0, weight: { p50: 3.3, p3: 2.5, p15: 2.9, p85: 3.9, p97: 4.4 }, height: { p50: 49.9, p3: 46.3, p15: 47.9, p85: 51.8, p97: 53.4 }, headCircumference: { p50: 34.5, p3: 32.2, p15: 33.0, p85: 36.0, p97: 36.9 } }, + { ageMonths: 1, weight: { p50: 4.5, p3: 3.4, p15: 3.9, p85: 5.2, p97: 5.8 }, height: { p50: 54.7, p3: 50.7, p15: 52.4, p85: 57.0, p97: 58.7 }, headCircumference: { p50: 37.3, p3: 34.7, p15: 35.6, p85: 39.0, p97: 40.0 } }, + { ageMonths: 2, weight: { p50: 5.6, p3: 4.3, p15: 4.9, p85: 6.4, p97: 7.1 }, height: { p50: 58.4, p3: 54.1, p15: 55.8, p85: 61.0, p97: 62.7 }, headCircumference: { p50: 39.1, p3: 36.3, p15: 37.3, p85: 41.0, p97: 42.1 } }, + { ageMonths: 3, weight: { p50: 6.4, p3: 4.9, p15: 5.6, p85: 7.3, p97: 8.1 }, height: { p50: 61.4, p3: 56.8, p15: 58.6, p85: 64.3, p97: 66.1 }, headCircumference: { p50: 40.5, p3: 37.5, p15: 38.6, p85: 42.5, p97: 43.6 } }, + { ageMonths: 4, weight: { p50: 7.0, p3: 5.4, p15: 6.1, p85: 8.0, p97: 8.9 }, height: { p50: 63.9, p3: 59.0, p15: 60.9, p85: 66.8, p97: 68.7 }, headCircumference: { p50: 41.6, p3: 38.5, p15: 39.6, p85: 43.7, p97: 44.8 } }, + { ageMonths: 5, weight: { p50: 7.5, p3: 5.8, p15: 6.5, p85: 8.6, p97: 9.5 }, height: { p50: 65.9, p3: 60.8, p15: 62.8, p85: 69.1, p97: 71.0 }, headCircumference: { p50: 42.6, p3: 39.3, p15: 40.5, p85: 44.7, p97: 45.8 } }, + { ageMonths: 6, weight: { p50: 7.9, p3: 6.1, p15: 6.9, p85: 9.1, p97: 10.0 }, height: { p50: 67.6, p3: 62.4, p15: 64.5, p85: 70.8, p97: 72.8 }, headCircumference: { p50: 43.4, p3: 40.0, p15: 41.2, p85: 45.6, p97: 46.7 } }, + { ageMonths: 7, weight: { p50: 8.3, p3: 6.4, p15: 7.2, p85: 9.5, p97: 10.5 }, height: { p50: 69.2, p3: 63.8, p15: 66.0, p85: 72.4, p97: 74.5 }, headCircumference: { p50: 44.1, p3: 40.6, p15: 41.8, p85: 46.4, p97: 47.5 } }, + { ageMonths: 8, weight: { p50: 8.6, p3: 6.6, p15: 7.5, p85: 9.9, p97: 10.9 }, height: { p50: 70.6, p3: 65.1, p15: 67.4, p85: 73.9, p97: 76.0 }, headCircumference: { p50: 44.7, p3: 41.1, p15: 42.4, p85: 47.1, p97: 48.1 } }, + { ageMonths: 9, weight: { p50: 8.9, p3: 6.8, p15: 7.7, p85: 10.2, p97: 11.3 }, height: { p50: 72.0, p3: 66.3, p15: 68.7, p85: 75.3, p97: 77.5 }, headCircumference: { p50: 45.2, p3: 41.5, p15: 42.8, p85: 47.6, p97: 48.7 } }, + { ageMonths: 10, weight: { p50: 9.2, p3: 7.0, p15: 7.9, p85: 10.5, p97: 11.6 }, height: { p50: 73.3, p3: 67.5, p15: 70.0, p85: 76.7, p97: 78.9 }, headCircumference: { p50: 45.7, p3: 41.9, p15: 43.2, p85: 48.1, p97: 49.2 } }, + { ageMonths: 11, weight: { p50: 9.4, p3: 7.1, p15: 8.1, p85: 10.8, p97: 12.0 }, height: { p50: 74.5, p3: 68.7, p15: 71.2, p85: 77.9, p97: 80.2 }, headCircumference: { p50: 46.1, p3: 42.2, p15: 43.6, p85: 48.6, p97: 49.7 } }, + { ageMonths: 12, weight: { p50: 9.6, p3: 7.3, p15: 8.3, p85: 11.1, p97: 12.3 }, height: { p50: 75.7, p3: 69.8, p15: 72.4, p85: 79.1, p97: 81.4 }, headCircumference: { p50: 46.5, p3: 42.5, p15: 43.9, p85: 49.1, p97: 50.2 } }, + { ageMonths: 15, weight: { p50: 10.3, p3: 7.8, p15: 8.9, p85: 11.9, p97: 13.2 }, height: { p50: 78.8, p3: 72.3, p15: 75.1, p85: 82.4, p97: 84.9 }, headCircumference: { p50: 47.2, p3: 43.1, p15: 44.6, p85: 49.9, p97: 51.0 } }, + { ageMonths: 18, weight: { p50: 10.9, p3: 8.3, p15: 9.4, p85: 12.6, p97: 14.0 }, height: { p50: 81.7, p3: 74.7, p15: 77.6, p85: 85.7, p97: 88.3 }, headCircumference: { p50: 47.8, p3: 43.6, p15: 45.1, p85: 50.5, p97: 51.7 } }, + { ageMonths: 21, weight: { p50: 11.5, p3: 8.7, p15: 9.9, p85: 13.3, p97: 14.8 }, height: { p50: 84.1, p3: 76.9, p15: 79.9, p85: 88.4, p97: 91.0 }, headCircumference: { p50: 48.3, p3: 44.0, p15: 45.6, p85: 51.1, p97: 52.2 } }, + { ageMonths: 24, weight: { p50: 12.2, p3: 9.2, p15: 10.4, p85: 14.0, p97: 15.6 }, height: { p50: 86.4, p3: 78.9, p15: 82.0, p85: 90.7, p97: 93.4 }, headCircumference: { p50: 48.8, p3: 44.4, p15: 46.0, p85: 51.6, p97: 52.8 } }, ]; -// Girls weight (kg) by month +// Girls weight (kg) by month - with head circumference export const WHO_GIRL_WEIGHT: GrowthStandard[] = [ - { ageMonths: 0, weight: { p50: 3.2, p3: 2.4, p15: 2.8, p85: 3.7, p97: 4.2 }, height: { p50: 49.1, p3: 45.4, p15: 47.1, p85: 51.1, p97: 52.7 } }, - { ageMonths: 1, weight: { p50: 4.2, p3: 3.2, p15: 3.6, p85: 4.8, p97: 5.5 }, height: { p50: 53.7, p3: 49.6, p15: 51.3, p85: 56.1, p97: 57.8 } }, - { ageMonths: 2, weight: { p50: 5.1, p3: 3.9, p15: 4.5, p85: 5.9, p97: 6.6 }, height: { p50: 57.1, p3: 52.7, p15: 54.4, p85: 59.7, p97: 61.4 } }, - { ageMonths: 3, weight: { p50: 5.8, p3: 4.5, p15: 5.1, p85: 6.7, p97: 7.5 }, height: { p50: 59.8, p3: 55.1, p15: 57.0, p85: 62.7, p97: 64.5 } }, - { ageMonths: 4, weight: { p50: 6.4, p3: 4.9, p15: 5.6, p85: 7.3, p97: 8.2 }, height: { p50: 62.1, p3: 57.2, p15: 59.1, p85: 65.2, p97: 67.1 } }, - { ageMonths: 5, weight: { p50: 6.9, p3: 5.3, p15: 6.0, p85: 7.9, p97: 8.8 }, height: { p50: 64.0, p3: 58.9, p15: 60.9, p85: 67.2, p97: 69.1 } }, - { ageMonths: 6, weight: { p50: 7.3, p3: 5.6, p15: 6.4, p85: 8.4, p97: 9.3 }, height: { p50: 65.7, p3: 60.4, p15: 62.5, p85: 68.9, p97: 70.9 } }, - { ageMonths: 7, weight: { p50: 7.6, p3: 5.9, p15: 6.7, p85: 8.8, p97: 9.8 }, height: { p50: 67.3, p3: 61.8, p15: 64.0, p85: 70.5, p97: 72.6 } }, - { ageMonths: 8, weight: { p50: 7.9, p3: 6.1, p15: 6.9, p85: 9.1, p97: 10.2 }, height: { p50: 68.7, p3: 63.1, p15: 65.4, p85: 72.0, p97: 74.2 } }, - { ageMonths: 9, weight: { p50: 8.2, p3: 6.3, p15: 7.1, p85: 9.5, p97: 10.5 }, height: { p50: 70.1, p3: 64.4, p15: 66.7, p85: 73.5, p97: 75.7 } }, - { ageMonths: 10, weight: { p50: 8.4, p3: 6.5, p15: 7.4, p85: 9.8, p97: 10.9 }, height: { p50: 71.5, p3: 65.6, p15: 68.0, p85: 75.0, p97: 77.2 } }, - { ageMonths: 11, weight: { p50: 8.7, p3: 6.7, p15: 7.6, p85: 10.1, p97: 11.2 }, height: { p50: 72.8, p3: 66.7, p15: 69.2, p85: 76.4, p97: 78.7 } }, - { ageMonths: 12, weight: { p50: 8.9, p3: 6.8, p15: 7.8, p85: 10.3, p97: 11.5 }, height: { p50: 74.0, p3: 67.7, p15: 70.3, p85: 77.7, p97: 80.1 } }, - { ageMonths: 15, weight: { p50: 9.7, p3: 7.4, p15: 8.4, p85: 11.2, p97: 12.5 }, height: { p50: 77.2, p3: 70.3, p15: 73.0, p85: 81.0, p97: 83.5 } }, - { ageMonths: 18, weight: { p50: 10.3, p3: 7.8, p15: 8.9, p85: 12.0, p97: 13.4 }, height: { p50: 80.2, p3: 72.9, p15: 75.7, p85: 84.3, p97: 86.9 } }, - { ageMonths: 21, weight: { p50: 10.9, p3: 8.3, p15: 9.5, p85: 12.7, p97: 14.2 }, height: { p50: 82.7, p3: 75.3, p15: 78.0, p85: 87.1, p97: 89.8 } }, - { ageMonths: 24, weight: { p50: 11.5, p3: 8.7, p15: 10.0, p85: 13.4, p97: 15.0 }, height: { p50: 85.0, p3: 77.4, p15: 80.2, p85: 89.8, p97: 92.5 } }, + { ageMonths: 0, weight: { p50: 3.2, p3: 2.4, p15: 2.8, p85: 3.7, p97: 4.2 }, height: { p50: 49.1, p3: 45.4, p15: 47.1, p85: 51.1, p97: 52.7 }, headCircumference: { p50: 33.9, p3: 31.7, p15: 32.5, p85: 35.4, p97: 36.3 } }, + { ageMonths: 1, weight: { p50: 4.2, p3: 3.2, p15: 3.6, p85: 4.8, p97: 5.5 }, height: { p50: 53.7, p3: 49.6, p15: 51.3, p85: 56.1, p97: 57.8 }, headCircumference: { p50: 36.5, p3: 34.0, p15: 34.9, p85: 38.2, p97: 39.2 } }, + { ageMonths: 2, weight: { p50: 5.1, p3: 3.9, p15: 4.5, p85: 5.9, p97: 6.6 }, height: { p50: 57.1, p3: 52.7, p15: 54.4, p85: 59.7, p97: 61.4 }, headCircumference: { p50: 38.3, p3: 35.5, p15: 36.5, p85: 40.1, p97: 41.2 } }, + { ageMonths: 3, weight: { p50: 5.8, p3: 4.5, p15: 5.1, p85: 6.7, p97: 7.5 }, height: { p50: 59.8, p3: 55.1, p15: 57.0, p85: 62.7, p97: 64.5 }, headCircumference: { p50: 39.5, p3: 36.6, p15: 37.6, p85: 41.5, p97: 42.6 } }, + { ageMonths: 4, weight: { p50: 6.4, p3: 4.9, p15: 5.6, p85: 7.3, p97: 8.2 }, height: { p50: 62.1, p3: 57.2, p15: 59.1, p85: 65.2, p97: 67.1 }, headCircumference: { p50: 40.6, p3: 37.5, p15: 38.6, p85: 42.6, p97: 43.7 } }, + { ageMonths: 5, weight: { p50: 6.9, p3: 5.3, p15: 6.0, p85: 7.9, p97: 8.8 }, height: { p50: 64.0, p3: 58.9, p15: 60.9, p85: 67.2, p97: 69.1 }, headCircumference: { p50: 41.5, p3: 38.3, p15: 39.4, p85: 43.6, p97: 44.7 } }, + { ageMonths: 6, weight: { p50: 7.3, p3: 5.6, p15: 6.4, p85: 8.4, p97: 9.3 }, height: { p50: 65.7, p3: 60.4, p15: 62.5, p85: 68.9, p97: 70.9 }, headCircumference: { p50: 42.3, p3: 38.9, p15: 40.1, p85: 44.5, p97: 45.6 } }, + { ageMonths: 7, weight: { p50: 7.6, p3: 5.9, p15: 6.7, p85: 8.8, p97: 9.8 }, height: { p50: 67.3, p3: 61.8, p15: 64.0, p85: 70.5, p97: 72.6 }, headCircumference: { p50: 43.0, p3: 39.5, p15: 40.7, p85: 45.3, p97: 46.4 } }, + { ageMonths: 8, weight: { p50: 7.9, p3: 6.1, p15: 6.9, p85: 9.1, p97: 10.2 }, height: { p50: 68.7, p3: 63.1, p15: 65.4, p85: 72.0, p97: 74.2 }, headCircumference: { p50: 43.6, p3: 40.0, p15: 41.2, p85: 46.0, p97: 47.1 } }, + { ageMonths: 9, weight: { p50: 8.2, p3: 6.3, p15: 7.1, p85: 9.5, p97: 10.5 }, height: { p50: 70.1, p3: 64.4, p15: 66.7, p85: 73.5, p97: 75.7 }, headCircumference: { p50: 44.1, p3: 40.4, p15: 41.7, p85: 46.6, p97: 47.7 } }, + { ageMonths: 10, weight: { p50: 8.4, p3: 6.5, p15: 7.4, p85: 9.8, p97: 10.9 }, height: { p50: 71.5, p3: 65.6, p15: 68.0, p85: 75.0, p97: 77.2 }, headCircumference: { p50: 44.6, p3: 40.8, p15: 42.1, p85: 47.1, p97: 48.2 } }, + { ageMonths: 11, weight: { p50: 8.7, p3: 6.7, p15: 7.6, p85: 10.1, p97: 11.2 }, height: { p50: 72.8, p3: 66.7, p15: 69.2, p85: 76.4, p97: 78.7 }, headCircumference: { p50: 45.0, p3: 41.2, p15: 42.5, p85: 47.6, p97: 48.7 } }, + { ageMonths: 12, weight: { p50: 8.9, p3: 6.8, p15: 7.8, p85: 10.3, p97: 11.5 }, height: { p50: 74.0, p3: 67.7, p15: 70.3, p85: 77.7, p97: 80.1 }, headCircumference: { p50: 45.4, p3: 41.5, p15: 42.8, p85: 48.0, p97: 49.2 } }, + { ageMonths: 15, weight: { p50: 9.7, p3: 7.4, p15: 8.4, p85: 11.2, p97: 12.5 }, height: { p50: 77.2, p3: 70.3, p15: 73.0, p85: 81.0, p97: 83.5 }, headCircumference: { p50: 46.1, p3: 42.1, p15: 43.5, p85: 48.8, p97: 49.9 } }, + { ageMonths: 18, weight: { p50: 10.3, p3: 7.8, p15: 8.9, p85: 12.0, p97: 13.4 }, height: { p50: 80.2, p3: 72.9, p15: 75.7, p85: 84.3, p97: 86.9 }, headCircumference: { p50: 46.7, p3: 42.6, p15: 44.0, p85: 49.5, p97: 50.6 } }, + { ageMonths: 21, weight: { p50: 10.9, p3: 8.3, p15: 9.5, p85: 12.7, p97: 14.2 }, height: { p50: 82.7, p3: 75.3, p15: 78.0, p85: 87.1, p97: 89.8 }, headCircumference: { p50: 47.2, p3: 43.0, p15: 44.4, p85: 50.0, p97: 51.1 } }, + { ageMonths: 24, weight: { p50: 11.5, p3: 8.7, p15: 10.0, p85: 13.4, p97: 15.0 }, height: { p50: 85.0, p3: 77.4, p15: 80.2, p85: 89.8, p97: 92.5 }, headCircumference: { p50: 47.6, p3: 43.4, p15: 44.8, p85: 50.4, p97: 51.6 } }, ]; export function getAgeInMonthsFromBirth(birthDate: string): number {