Daily Multivitamin Recommendation Tool

Daily Multivitamin Recommendation Tool

1. Profile
2. Lifestyle
3. Recommendation

Part 1: About You

Part 2: Lifestyle Factors

${description}

Key Nutrients for Your Profile:

    ${keyNutrients.map(n => `
  • ${n.name}: ${n.reason}
  • `).join('')}
Disclaimer: This tool provides a general recommendation and is not a substitute for medical advice. Consult with a healthcare professional before starting any new supplement regimen.
`; downloadPdfBtn.style.display = 'inline-block'; } function getRecommendation(inputs) { let rec = { title: "Standard Multivitamin", description: "A basic formula to cover general nutritional gaps.", keyNutrients: [{ name: "General Vitamins & Minerals", reason: "Supports overall health and fills minor dietary gaps."}] }; // Age & Gender Logic if (inputs['q-age'] === 'senior') { rec.title = "Senior Formula Multivitamin"; rec.description = "A formula tailored for adults 50+, focusing on bone health and nutrient absorption."; rec.keyNutrients.push({ name: "Vitamin D & Calcium", reason: "Essential for bone density, which is a key concern for adults over 50." }); rec.keyNutrients.push({ name: "Vitamin B12", reason: "Absorption can decrease with age, crucial for nerve function and energy." }); } else if (inputs['q-gender'] === 'female') { rec.keyNutrients.push({ name: "Iron", reason: "Important for pre-menopausal women to prevent anemia." }); } // Diet Logic if (inputs['q-diet'] === 'vegan' || inputs['q-diet'] === 'vegetarian') { rec.title = "Vegetarian/Vegan Support Formula"; rec.description = "A specialized formula to provide key nutrients often lacking in plant-based diets."; rec.keyNutrients.push({ name: "Vitamin B12", reason: "Crucial for nerve health and not naturally found in plant foods." }); rec.keyNutrients.push({ name: "Iron (Plant-Based)", reason: "To support energy levels, as plant-based iron is less bioavailable." }); } if (inputs['q-diet'] === 'unbalanced') { rec.keyNutrients.push({ name: "Broad-Spectrum Nutrients", reason: "To help compensate for a lack of dietary variety." }); } // Lifestyle Logic if (inputs['q-sun'] === 'limited') { rec.keyNutrients.push({ name: "Vitamin D", reason: "For immune and bone support, as you have limited sun exposure." }); } if (inputs['q-activity'] === 'active' || inputs['q-concerns'] === 'energy') { rec.keyNutrients.push({ name: "B-Complex Vitamins", reason: "To support energy metabolism for an active lifestyle." }); } if (inputs['q-concerns'] === 'immunity') { rec.keyNutrients.push({ name: "Vitamin C & Zinc", reason: "Known for their roles in supporting a healthy immune system." }); } if (inputs['q-concerns'] === 'bone' && inputs['q-age'] !== 'senior') { rec.keyNutrients.push({ name: "Vitamin D & Calcium", reason: "To support your goal of maintaining strong bones." }); } // Deduplicate key nutrients const uniqueNutrients = []; const seen = new Set(); for (const nutrient of rec.keyNutrients) { if (!seen.has(nutrient.name)) { uniqueNutrients.push(nutrient); seen.add(nutrient.name); } } rec.keyNutrients = uniqueNutrients; return rec; } function generatePdf() { const { jsPDF } = jspdf; const doc = new jsPDF(); const pageW = doc.internal.pageSize.getWidth(); const { title, description, keyNutrients } = getRecommendation(userInputs); // Header doc.setFillColor(37, 99, 235); doc.rect(0, 0, pageW, 25, 'F'); doc.setFont('helvetica', 'bold'); doc.setFontSize(16); doc.setTextColor(255, 255, 255); doc.text('Multivitamin Recommendation Report', pageW / 2, 15, { align: 'center' }); // Recommendation doc.setFontSize(12); doc.setFont('helvetica', 'normal'); doc.text('Based on your profile, we recommend a:', pageW / 2, 40, { align: 'center' }); doc.setFontSize(18); doc.setFont('helvetica', 'bold'); doc.setTextColor(37, 99, 235); doc.text(title, pageW / 2, 50, { align: 'center' }); doc.setFontSize(11); doc.setFont('helvetica', 'normal'); doc.setTextColor(100, 116, 139); const splitDescription = doc.splitTextToSize(description, pageW - 40); doc.text(splitDescription, pageW / 2, 60, { align: 'center' }); // Key Nutrients Table const tableData = keyNutrients.map(n => [n.name, n.reason]); doc.autoTable({ startY: 80, theme: 'grid', headStyles: { fillColor: [37, 99, 235] }, head: [['Key Nutrient', 'Reason for Your Profile']], body: tableData, }); // Disclaimer doc.autoTable({ startY: doc.lastAutoTable.finalY + 10, theme: 'plain', body: [[ "Disclaimer: This tool offers a general guideline based on your inputs and is not a substitute for professional medical advice. Individual needs can vary. Always consult with a doctor or registered dietitian before starting any supplement." ]] }); // Footer const pageH = doc.internal.pageSize.getHeight(); doc.setLineWidth(0.5); doc.setDrawColor(37, 99, 235); doc.line(15, pageH - 15, pageW - 15, pageH - 15); doc.setFontSize(8); doc.setTextColor(128, 128, 128); doc.text('Personalized Wellness Recommendation', pageW / 2, pageH - 10, { align: 'center' }); doc.save('Multivitamin_Recommendation.pdf'); } updateUI(); });
Scroll to Top