From 0be925f58faf0f277ca4651eb4ebcce036550018 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 23 Mar 2026 23:11:24 +0100 Subject: [PATCH] Add growth velocity, feeding guidance, BMI classification to well visits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Growth reference data by age (newborn through 21y): expected weight/length/HC gains per day/month/year, puberty growth spurt details - Feeding/nutrition guidance by age: formula amounts, breastfeeding frequency, solid food introduction timeline, juice limits, milk transitions, calorie needs - BMI/obesity classification per AAP 2023 CPG + CDC Extended BMI: Underweight, Healthy, Overweight, Obesity Class I/II/III with action items (≥120% and ≥140% of 95th percentile thresholds) - Weight-for-length guidance for children <2 years - "By Visit" panel now shows growth reference + feeding guidance + BMI table - Well visit AI prompt updated to include growth assessment, BMI classification, and feeding counseling in generated notes - Backend injects age-appropriate growth/nutrition data into AI context --- public/css/styles.css | 15 ++ public/js/pediatricScheduleData.js | 241 +++++++++++++++++++++++++++++ public/js/wellVisit.js | 61 ++++++++ src/routes/wellVisit.js | 69 +++++++++ src/utils/prompts.js | 26 +++- 5 files changed, 406 insertions(+), 6 deletions(-) diff --git a/public/css/styles.css b/public/css/styles.css index 4af990d..dddfa36 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -348,6 +348,21 @@ body{font-family:'Inter',system-ui,sans-serif;background:var(--g50);color:var(-- .wv-status-range{background:var(--blue-light);color:var(--blue-dark);} .wv-screen-name{font-size:13px;color:var(--g700);} +/* Growth & Feeding */ +.wv-growth-box{display:flex;flex-direction:column;gap:8px;} +.wv-growth-item{display:flex;gap:8px;align-items:baseline;font-size:13px;line-height:1.5;padding:6px 10px;background:var(--g50);border-radius:8px;} +.wv-growth-label{font-weight:600;color:var(--g700);min-width:120px;white-space:nowrap;} +.wv-feeding-list{margin:0;padding-left:20px;font-size:13px;line-height:1.7;color:var(--g700);} +.wv-feeding-list li{margin-bottom:4px;} +/* BMI Classification */ +.wv-bmi-table{display:flex;flex-direction:column;gap:6px;} +.wv-bmi-row{display:grid;grid-template-columns:160px 1fr 1fr;gap:8px;padding:8px 12px;background:var(--g50);border-radius:8px;font-size:12px;align-items:center;} +.wv-bmi-label{font-weight:700;font-size:13px;} +.wv-bmi-range{color:var(--g600);} +.wv-bmi-action{color:var(--g600);font-style:italic;} +.wv-bmi-note{margin-top:8px;font-size:11px;color:#6b7280;display:flex;align-items:flex-start;gap:6px;} +@media(max-width:768px){.wv-bmi-row{grid-template-columns:1fr;}} + /* Notes */ .wv-notes-box{background:var(--blue-light);border-radius:8px;padding:12px 16px;font-size:13px;color:#1e40af;display:flex;align-items:flex-start;gap:8px;} .wv-empty,.wv-loading{color:var(--g400);font-size:14px;padding:20px 0;text-align:center;} diff --git a/public/js/pediatricScheduleData.js b/public/js/pediatricScheduleData.js index f8e8bbf..3866972 100644 --- a/public/js/pediatricScheduleData.js +++ b/public/js/pediatricScheduleData.js @@ -1703,6 +1703,245 @@ const NEWBORN_SCREENING = { notes: "Exact panel varies by state. For complete current list: https://www.hrsa.gov/advisory-committees/heritable-disorders/rusp/index.html and https://www.babysfirsttest.org/" }; +// ─── GROWTH VELOCITY & EXPECTED GAINS (AAP / WHO / Nelson Textbook) ───────── +// Sources: AAP Bright Futures, WHO Growth Standards, Nelson Textbook of Pediatrics +const GROWTH_REFERENCE = { + newborn: { + weight: "Expect 5-7% weight loss in first 3-5 days, regain birth weight by 10-14 days. Gain ~20-30 g/day (⅔–1 oz/day) in first month.", + length: "Grow ~1.5 cm/week (~0.6 in/week) in first month.", + headCirc: "Head circumference grows ~0.5 cm/week in first month.", + feeding: [ + "Breastfeeding: 8-12 times per 24 hours on demand, both breasts each feeding", + "Formula: 1-2 oz (30-60 mL) per feeding, 8-12 feedings/day in first week; increases to 2-3 oz per feeding by end of first month", + "No water, juice, or other liquids", + "Vitamin D supplementation: 400 IU/day starting in first few days of life for all breastfed and partially breastfed infants" + ] + }, + "1mo": { + weight: "Gain ~20-30 g/day (⅔–1 oz/day). Should double birth weight by 4-5 months.", + length: "Grow ~3-4 cm/month (~1.2-1.6 in/month).", + headCirc: "Head circumference grows ~1.5-2 cm/month.", + feeding: [ + "Breastfeeding: 8-12 times per 24 hours, ~15-20 min per breast", + "Formula: 3-4 oz (90-120 mL) per feeding every 3-4 hours", + "No water, juice, cereal in bottle, or solids", + "Continue Vitamin D 400 IU/day if breastfed" + ] + }, + "2mo": { + weight: "Gain ~20-30 g/day. Average ~5-6 kg (~11-13 lb) by 2 months.", + length: "Grow ~3-4 cm/month.", + headCirc: "Head circumference grows ~1.5-2 cm/month.", + feeding: [ + "Breastfeeding: 6-10 times per 24 hours, may begin longer stretches at night", + "Formula: 4-5 oz (120-150 mL) per feeding, 6-8 feedings/day (~24-32 oz/day total)", + "No water, juice, or solids yet — exclusive breast milk or formula until 6 months", + "Continue Vitamin D 400 IU/day if breastfed" + ] + }, + "4mo": { + weight: "Gain ~15-20 g/day. Should double birth weight around 4-5 months.", + length: "Grow ~2-3 cm/month (~1 in/month).", + headCirc: "Head circumference grows ~1 cm/month.", + feeding: [ + "Breastfeeding: 5-8 times per 24 hours", + "Formula: 5-6 oz (150-180 mL) per feeding, 5-6 feedings/day (~28-36 oz/day total)", + "May introduce pureed single-ingredient foods (iron-fortified cereals, pureed vegetables, fruits) at 4-6 months if showing readiness signs", + "Signs of readiness: good head control, sitting with support, showing interest in food, loss of tongue-thrust reflex", + "Early allergen introduction (peanut protein) recommended at 4-6 months for high-risk infants (per AAP/NIAID guidelines)", + "No juice, honey, or cow's milk" + ] + }, + "6mo": { + weight: "Gain ~10-15 g/day. Should double birth weight by now; will triple by 12 months.", + length: "Grow ~1.5-2.5 cm/month. Average length increases ~50% from birth by 12 months.", + headCirc: "Head circumference grows ~0.5-1 cm/month.", + feeding: [ + "Begin complementary foods (pureed/mashed): iron-fortified cereals, vegetables, fruits, meats", + "Introduce variety of textures and flavors — one new food every 3-5 days to watch for allergies", + "Early allergen introduction: peanut, egg, dairy, wheat, soy, fish — per AAP guidelines to reduce allergy risk", + "Breastfeeding: continue on demand, 4-6 times/day alongside solids", + "Formula: 24-32 oz/day total, may decrease as solids increase", + "May offer sips of water from open or straw cup with meals (2-4 oz/day)", + "No juice before 12 months (AAP recommendation), no honey, no cow's milk as main drink" + ] + }, + "9mo": { + weight: "Gain ~10-13 g/day.", + length: "Grow ~1.5 cm/month.", + headCirc: "Head circumference grows ~0.5 cm/month.", + feeding: [ + "3 meals of soft table foods + 1-2 snacks/day; finger foods encouraged (soft pieces, dissolvable puffs)", + "Breastfeeding or formula: continue 3-5 times/day (~24-30 oz formula/day)", + "Encourage self-feeding and cup drinking", + "No juice before 12 months, no honey, no cow's milk as drink", + "Iron-rich foods important: fortified cereals, meats, beans" + ] + }, + "12mo": { + weight: "Should have tripled birth weight (~10 kg / 22 lb average). Gain ~200-250 g/month (~7-8 oz/month) in second year.", + length: "Average 75 cm (29.5 in). Grow ~1 cm/month (~0.5 in/month) in second year.", + headCirc: "Head circumference grows ~0.25-0.5 cm/month.", + feeding: [ + "Transition to whole cow's milk: 16-24 oz/day (no more than 24 oz to prevent iron deficiency anemia)", + "Wean from bottle by 12-15 months — use open cup or straw cup", + "3 meals + 2 snacks/day of table foods, chopped/small pieces", + "May introduce 100% fruit juice: max 4 oz/day (AAP), offer only with meals in a cup, not a bottle", + "Honey now safe (after age 1)", + "Avoid choking hazards: whole grapes, hot dogs, nuts, raw carrots, popcorn, hard candy", + "Continue Vitamin D 600 IU/day if <16 oz whole milk/day" + ] + }, + "15mo": { + weight: "Gain ~200-250 g/month. Average ~11 kg (24 lb).", + length: "Grow ~1 cm/month.", + feeding: [ + "Whole cow's milk 16-24 oz/day; no more than 24 oz", + "3 meals + 2 snacks/day; family foods with appropriate modifications", + "100% juice max 4 oz/day with meals only", + "May be a picky eater — continue offering variety without pressure", + "Wean completely from bottle if not yet done" + ] + }, + "18mo": { + weight: "Gain ~200 g/month. Average ~11-12 kg (24-26 lb).", + length: "Grow ~1 cm/month. Average ~82 cm (32 in).", + feeding: [ + "Whole cow's milk 16-24 oz/day (switch to low-fat/skim at age 2 per AAP if no concerns)", + "3 meals + 2 snacks/day; continue offering diverse foods", + "100% juice max 4 oz/day with meals", + "Self-feeding with utensils encouraged; expect messiness", + "Limit added sugars and sodium; avoid sugar-sweetened beverages" + ] + }, + "24mo": { + weight: "Average ~12-13 kg (26-29 lb). Should have quadrupled birth weight. Gain ~2-2.5 kg/year through early childhood.", + length: "Average ~86-87 cm (34 in). Grow ~7-8 cm/year (~3 in/year) ages 2-5.", + bmiClassification: true, + feeding: [ + "Transition to low-fat (1%) or skim milk per family preference/growth; 16-20 oz/day", + "3 meals + 2 snacks/day; follow MyPlate guidelines", + "100% juice max 4 oz/day", + "Limit added sugars to <25 g/day; avoid sugar-sweetened beverages", + "Serve age-appropriate portions: ~1 tablespoon per year of age per food group", + "Family meals together when possible — positive mealtime environment" + ] + }, + "30mo": { + weight: "Gain ~2-2.5 kg/year (~4.5-5.5 lb/year).", + length: "Grow ~7-8 cm/year (~3 in/year).", + bmiClassification: true, + feeding: [ + "Low-fat or skim milk ~16-20 oz/day", + "MyPlate: fruits, vegetables, grains, protein, dairy at each meal", + "100% juice max 4-6 oz/day (ages 1-3: max 4 oz; ages 4-6: max 6 oz)", + "Limit ultra-processed foods, fast food, and sugary snacks" + ] + }, + "3y": { + weight: "Average ~14-15 kg (31-33 lb). Gain ~2 kg/year.", + length: "Average ~95 cm (37 in). Grow ~6-7 cm/year (~2.5 in/year).", + bmiClassification: true, + feeding: [ + "Low-fat milk; total dairy ~2 cups/day", + "MyPlate portions; ~1,000-1,400 calories/day", + "100% juice max 4 oz/day", + "Encourage water as primary beverage", + "Limit added sugars <25 g/day" + ] + }, + "4y": { + weight: "Gain ~2-2.5 kg/year. Average ~16-17 kg (35-37 lb).", + length: "Grow ~6-7 cm/year. Average ~102 cm (40 in).", + bmiClassification: true, + feeding: [ + "~1,200-1,600 calories/day depending on activity", + "100% juice max 4-6 oz/day", + "Fat-free or low-fat milk and dairy products", + "Encourage 5+ servings of fruits/vegetables daily", + "Limit screen time during meals; promote family meals" + ] + }, + "5y": { + weight: "Gain ~2-2.5 kg/year. Average ~18-20 kg (40-44 lb).", + length: "Grow ~5-7 cm/year. Average ~109 cm (43 in).", + bmiClassification: true, + feeding: [ + "~1,200-1,800 calories/day depending on activity", + "100% juice max 4-6 oz/day (age 4-6: max 6 oz)", + "Encourage independence in food choices from healthy options", + "Model healthy eating behaviors" + ] + }, + "6y_to_10y": { + weight: "Gain ~2-3 kg/year (4.5-6.5 lb/year) until puberty. Preadolescent weight gain may accelerate.", + length: "Grow ~5-6 cm/year (~2-2.5 in/year) until puberty.", + bmiClassification: true, + feeding: [ + "~1,400-2,200 calories/day based on age, gender, and activity level", + "100% juice max 8 oz/day (ages 7+)", + "Water and low-fat milk as primary beverages", + "Encourage whole grains, lean protein, fruits, vegetables", + "Limit sugar-sweetened beverages, fast food, and ultra-processed snacks", + "Teach nutrition label reading" + ] + }, + "11y_to_14y": { + weight: "Puberty weight gain: Girls ~7-25 kg total over puberty (peak ~8-9 kg/year). Boys ~7-30 kg total (peak ~9 kg/year, typically 1-2 years after girls).", + length: "Puberty growth spurt: Girls ~8-14 cm/year (peak ~11-12 years, ~2 years after breast development). Boys ~10-14 cm/year (peak ~13-14 years). Girls typically complete growth ~2 years after menarche; boys by ~17-18 years.", + bmiClassification: true, + feeding: [ + "~1,800-3,200 calories/day depending on gender, pubertal stage, and activity", + "Calcium: 1,300 mg/day (critical for peak bone mass during puberty)", + "Iron: 8-15 mg/day (increased need in menstruating adolescents)", + "Healthy body image counseling — avoid restrictive dieting", + "Screen for disordered eating behaviors", + "Limit sugar-sweetened beverages and energy drinks", + "No caffeine >100 mg/day for ages 12-18" + ] + }, + "15y_to_21y": { + weight: "Late pubertal changes; growth velocity slowing. Most girls have reached adult weight; boys may gain until 18-21.", + length: "Girls: most have reached adult height by 15-16. Boys: may grow until 18-21. Final height typically within 2 inches of mid-parental height.", + bmiClassification: true, + feeding: [ + "~2,000-3,200 calories/day based on activity level", + "Calcium: 1,300 mg/day through age 18, then 1,000 mg/day", + "Iron: 11 mg/day (males), 15 mg/day (females, menstruating)", + "Healthy relationship with food; screen for eating disorders (SCOFF tool)", + "Vegetarian/vegan diets need B12, iron, zinc, calcium supplementation assessment", + "Avoid energy drinks; limit caffeine to <100 mg/day (12-18) or <400 mg/day (18+)", + "Promote meal planning and cooking skills for independence" + ] + } +}; + +// ─── BMI / WEIGHT CLASSIFICATION (AAP 2023 CPG + CDC Extended BMI) ────────── +// Source: AAP Clinical Practice Guideline for Evaluation and Treatment of +// Children and Adolescents with Obesity (Pediatrics 2023;151(2):e2022060640) +// CDC Extended BMI-for-Age Percentiles (Pediatrics 2023;152(3):e2023062285) +const BMI_CLASSIFICATION = { + appliesAge: "Ages 2-20 years (use weight-for-length <2 years)", + categories: [ + { label: "Underweight", range: "BMI < 5th percentile", color: "#60a5fa", action: "Evaluate for nutritional deficiency, chronic illness, or eating disorder" }, + { label: "Healthy Weight", range: "BMI 5th to < 85th percentile", color: "#34d399", action: "Reinforce healthy habits" }, + { label: "Overweight", range: "BMI 85th to < 95th percentile", color: "#fbbf24", action: "Motivational interviewing, dietary counseling, activity assessment" }, + { label: "Obesity (Class I)", range: "BMI ≥ 95th percentile but < 120% of 95th", color: "#fb923c", action: "Intensive health behavior and lifestyle treatment (IHBLT); comorbidity screening: fasting glucose/HbA1c, lipid panel, ALT, BP" }, + { label: "Severe Obesity (Class II)", range: "BMI ≥ 120% to < 140% of 95th percentile (or BMI ≥ 35)", color: "#f87171", action: "IHBLT; consider pharmacotherapy (≥12 years); comorbidity screening; sleep study if symptomatic; assess psychosocial impact" }, + { label: "Severe Obesity (Class III)",range: "BMI ≥ 140% of 95th percentile (or BMI ≥ 40)", color: "#dc2626", action: "IHBLT; consider pharmacotherapy (≥12y) and metabolic/bariatric surgery (≥13y); comprehensive comorbidity evaluation; behavioral health" } + ], + underTwo: "For children < 2 years: use WHO weight-for-length chart. Weight-for-length ≥ 97.7th percentile indicates high weight status. No BMI classification for under 2.", + comorbidityScreening: [ + "Fasting glucose or HbA1c (for type 2 diabetes risk — screen starting at age 10 or puberty onset if BMI ≥85th %ile)", + "Fasting lipid panel", + "ALT (for nonalcoholic fatty liver disease — screen starting at age 9-11 if BMI ≥85th %ile)", + "Blood pressure at every visit", + "Polysomnography if symptoms of obstructive sleep apnea", + "Mental health screening (depression, anxiety, bullying, stigma)" + ], + notes: "Use CDC Extended BMI-for-Age growth charts for children with BMI >97th percentile to better track changes over time. The 98th percentile on extended charts approximates 120% of the 95th percentile in older children/adolescents." +}; + // ─── EXPORTS ────────────────────────────────────────────────────────────────── if (typeof module !== "undefined" && module.exports) { module.exports = { @@ -1715,5 +1954,7 @@ if (typeof module !== "undefined" && module.exports) { AAP_FOOTNOTES, DYSLIPIDEMIA_SCHEDULE, NEWBORN_SCREENING, + GROWTH_REFERENCE, + BMI_CLASSIFICATION, }; } diff --git a/public/js/wellVisit.js b/public/js/wellVisit.js index ffd33e5..ac76eab 100644 --- a/public/js/wellVisit.js +++ b/public/js/wellVisit.js @@ -208,6 +208,27 @@ } window.wvSwitchSubtab = switchSubtab; + // ─── Map visit ID to GROWTH_REFERENCE key ───────────────────────────────── + function getGrowthDataForVisit(visitId) { + if (typeof GROWTH_REFERENCE === 'undefined') return null; + // Direct match + if (GROWTH_REFERENCE[visitId]) return GROWTH_REFERENCE[visitId]; + // Map visit IDs to growth reference keys + var mapping = { + 'newborn': 'newborn', '3-5d': 'newborn', + '1mo': '1mo', '2mo': '2mo', '4mo': '4mo', '6mo': '6mo', '9mo': '9mo', + '12mo': '12mo', '15mo': '15mo', '18mo': '18mo', + '24mo': '24mo', '30mo': '30mo', + '3y': '3y', '4y': '4y', '5y': '5y', + '6y': '6y_to_10y', '7y': '6y_to_10y', '8y': '6y_to_10y', '9y': '6y_to_10y', '10y': '6y_to_10y', + '11y': '11y_to_14y', '12y': '11y_to_14y', '13y': '11y_to_14y', '14y': '11y_to_14y', + '15y': '15y_to_21y', '16y': '15y_to_21y', '17y': '15y_to_21y', '18y': '15y_to_21y', + '19y': '15y_to_21y', '20y': '15y_to_21y', '21y': '15y_to_21y' + }; + var key = mapping[visitId]; + return key ? GROWTH_REFERENCE[key] : null; + } + // ─── BY VISIT panel ─────────────────────────────────────────────────────── function renderVisitPanel(visitId) { var data = (typeof PERIODICITY !== 'undefined') ? PERIODICITY[visitId] : null; @@ -306,6 +327,46 @@ html += ''; } + // ── Growth Reference & Feeding Guidance ── + var growthData = getGrowthDataForVisit(visitId); + if (growthData) { + html += '
'; + html += '

Expected Growth

'; + html += '
'; + if (growthData.weight) html += '
⚖️ Weight' + esc(growthData.weight) + '
'; + if (growthData.length) html += '
📏 Length/Height' + esc(growthData.length) + '
'; + if (growthData.headCirc) html += '
🧠 Head Circumference' + esc(growthData.headCirc) + '
'; + html += '
'; + + if (growthData.feeding && growthData.feeding.length) { + html += '

Feeding & Nutrition Guidance

'; + html += ''; + } + + html += '
'; + } + + // ── BMI / Weight Classification (ages 2+) ── + if (growthData && growthData.bmiClassification && typeof BMI_CLASSIFICATION !== 'undefined') { + html += '
'; + html += '

BMI / Weight Classification (AAP 2023)

'; + html += '
'; + BMI_CLASSIFICATION.categories.forEach(function (cat) { + html += '
'; + html += '
' + esc(cat.label) + '
'; + html += '
' + esc(cat.range) + '
'; + html += '
' + esc(cat.action) + '
'; + html += '
'; + }); + html += '
'; + html += '
' + esc(BMI_CLASSIFICATION.notes) + '
'; + html += '
'; + } + // ── Notes ── if (data.notes) { html += '
' + esc(data.notes) + '
'; diff --git a/src/routes/wellVisit.js b/src/routes/wellVisit.js index 35ff8cc..e60ece1 100644 --- a/src/routes/wellVisit.js +++ b/src/routes/wellVisit.js @@ -9,6 +9,55 @@ var PROMPTS = require('../utils/prompts'); var { authMiddleware } = require('../middleware/auth'); var logger = require('../utils/logger'); +// Load growth reference and BMI classification data +var scheduleData; +try { + scheduleData = require('../../public/js/pediatricScheduleData'); +} catch(e) { + scheduleData = {}; +} +var GROWTH_REFERENCE = scheduleData.GROWTH_REFERENCE || {}; +var BMI_CLASSIFICATION = scheduleData.BMI_CLASSIFICATION || {}; + +// Map visit age text to GROWTH_REFERENCE keys +function getGrowthRefForAge(ageStr) { + if (!ageStr) return null; + var a = ageStr.toLowerCase().trim(); + // Direct key matches + var directKeys = ['newborn', '1mo', '2mo', '4mo', '6mo', '9mo', '12mo', '15mo', '18mo', '24mo', '30mo', '3y', '4y', '5y']; + for (var i = 0; i < directKeys.length; i++) { + if (a.indexOf(directKeys[i]) !== -1) return GROWTH_REFERENCE[directKeys[i]] || null; + } + // Age-based range matching + var ageMatch = a.match(/(\d+)\s*(month|mo|year|y|yr)/i); + if (ageMatch) { + var num = parseInt(ageMatch[1]); + var unit = ageMatch[2].toLowerCase(); + if (unit === 'month' || unit === 'mo') { + if (num <= 1) return GROWTH_REFERENCE['1mo']; + if (num <= 3) return GROWTH_REFERENCE['2mo']; + if (num <= 5) return GROWTH_REFERENCE['4mo']; + if (num <= 8) return GROWTH_REFERENCE['6mo']; + if (num <= 11) return GROWTH_REFERENCE['9mo']; + if (num <= 14) return GROWTH_REFERENCE['12mo']; + if (num <= 17) return GROWTH_REFERENCE['15mo']; + if (num <= 23) return GROWTH_REFERENCE['18mo']; + if (num <= 29) return GROWTH_REFERENCE['24mo']; + if (num <= 35) return GROWTH_REFERENCE['30mo']; + } + if (unit === 'year' || unit === 'y' || unit === 'yr') { + if (num <= 3) return GROWTH_REFERENCE['3y']; + if (num <= 4) return GROWTH_REFERENCE['4y']; + if (num <= 5) return GROWTH_REFERENCE['5y']; + if (num <= 10) return GROWTH_REFERENCE['6y_to_10y']; + if (num <= 14) return GROWTH_REFERENCE['11y_to_14y']; + return GROWTH_REFERENCE['15y_to_21y']; + } + } + if (a.indexOf('newborn') !== -1 || a.indexOf('birth') !== -1) return GROWTH_REFERENCE['newborn']; + return null; +} + // ── POST generate SSHADESS assessment summary ──────────────────────────── router.post('/well-visit/shadess', authMiddleware, async function(req, res) { var start = Date.now(); @@ -141,6 +190,26 @@ router.post('/well-visit/note', authMiddleware, async function(req, res) { context += physicianMemories + '\n\n'; } + // Add growth reference and feeding guidance for this age + var growthRef = getGrowthRefForAge(patientAge || visitAge); + if (growthRef) { + context += 'GROWTH/NUTRITION GUIDANCE (AAP reference for this age):\n'; + if (growthRef.weight) context += 'Expected weight gain: ' + growthRef.weight + '\n'; + if (growthRef.length) context += 'Expected length/height gain: ' + growthRef.length + '\n'; + if (growthRef.headCirc) context += 'Expected head circumference gain: ' + growthRef.headCirc + '\n'; + if (growthRef.feeding && growthRef.feeding.length) { + context += 'Feeding guidance:\n'; + growthRef.feeding.forEach(function(f) { context += ' - ' + f + '\n'; }); + } + if (growthRef.bmiClassification && BMI_CLASSIFICATION.categories) { + context += 'BMI Classification (AAP 2023 / CDC Extended BMI):\n'; + BMI_CLASSIFICATION.categories.forEach(function(c) { + context += ' - ' + c.label + ': ' + c.range + ' → ' + c.action + '\n'; + }); + } + context += '\n'; + } + var prompt = (noteStyle === 'short') ? PROMPTS.wellVisitShort : PROMPTS.wellVisitNote; var result = await callAI([ diff --git a/src/utils/prompts.js b/src/utils/prompts.js index 66d2bc9..6063ab0 100644 --- a/src/utils/prompts.js +++ b/src/utils/prompts.js @@ -222,24 +222,38 @@ Chief Complaint: Interval History: (development, growth, behavior, school/activities, diet, sleep, safety since last visit — from transcript if provided) Review of Systems: (pertinent only; use physician ROS template if provided under PHYSICIAN TEMPLATES) Physical Examination: (use physician exam template if provided; include vital signs and measurements given) +Growth Assessment: (if vitals/measurements provided: comment on growth velocity and percentile trends. For ages ≥2, include BMI percentile and weight classification per AAP 2023 guidelines: + - Underweight: BMI <5th %ile + - Healthy Weight: 5th to <85th %ile + - Overweight: 85th to <95th %ile + - Obesity Class I: ≥95th but <120% of 95th %ile + - Severe Obesity Class II: ≥120% to <140% of 95th %ile (or BMI ≥35) + - Severe Obesity Class III: ≥140% of 95th %ile (or BMI ≥40) + For ages <2, use weight-for-length. If BMI or percentiles not provided, state "BMI classification deferred — percentiles not provided.") Screening Results: (list all screenings completed, results, validated tools used) Immunizations: (vaccines given today; note refusals or deferrals) Assessment: 1. Well child visit — [age] [gender] -2. [Any additional diagnoses] -Plan: (anticipatory guidance, follow-up, referrals, next well visit) +2. Growth: [comment on growth pattern — appropriate/concerning] +3. [Any additional diagnoses] +Plan: +- Nutrition/Feeding: (age-appropriate feeding guidance discussed — if GROWTH/NUTRITION GUIDANCE provided below, summarize what was discussed) +- Anticipatory guidance +- Follow-up, referrals, next well visit Rules: - Do NOT fabricate screening results — only include what was explicitly provided - Use physician templates when supplied -- Do not invent exam findings; state "deferred" if not provided`, +- Do not invent exam findings; state "deferred" if not provided +- Always include age-appropriate growth assessment and feeding/nutrition counseling in the plan +- If growth/nutrition reference data is provided, incorporate relevant guidance into the plan as "anticipatory guidance provided"`, wellVisitShort: `You are an expert pediatric physician. Generate a brief well child visit note (SOAP style). Keep concise. ${CORE_RULES} S: Well child visit, brief interval history, parent concerns -O: Vitals/measurements provided, exam findings (use template if provided) -A: Well child, age-appropriate development, any additional diagnoses -P: Vaccines, screenings, anticipatory guidance, follow-up`, +O: Vitals/measurements provided, exam findings (use template if provided). Include growth assessment and BMI classification for ages ≥2. +A: Well child, age-appropriate development, growth status, any additional diagnoses +P: Feeding/nutrition guidance discussed, vaccines, screenings, anticipatory guidance, follow-up`, // ======================== SICK VISIT NOTE ======================== sickVisitNote: `You are an expert pediatrician. Generate a concise, professional sick visit note from the provided data.