Autoimmune Disorder Symptom Checker

Autoimmune Disorder Symptom Checker

Select your symptoms to see potential associated conditions.

Check all symptoms you are experiencing:

Important Disclaimer

This tool is for informational purposes only and is not a substitute for professional medical advice, diagnosis, or treatment. The results are based on common symptom patterns and do not constitute a medical diagnosis. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.

Potential Conditions

No potential conditions identified based on the selected symptoms. Please select symptoms to see results.

'; return; } const resultsContainer = document.createElement('div'); resultsContainer.className = 'space-y-4'; analysisResults.forEach(result => { const card = document.createElement('div'); card.className = 'p-4 border rounded-lg bg-white'; card.innerHTML = `

${result.condition}

${result.score} of your symptoms are commonly associated with this condition:

    ${result.matchedSymptoms.map(s => `
  • ${s}
  • `).join('')}
`; resultsContainer.appendChild(card); }); resultsContent.appendChild(resultsContainer); }; // --- PDF Generation --- const generatePdf = () => { const { jsPDF } = window.jspdf; if (typeof jsPDF === 'undefined' || typeof jsPDF.API.autoTable !== 'function') { console.error("jsPDF or autoTable library not loaded correctly."); return; } if (selectedSymptoms.length === 0) { alert("Please select symptoms before downloading a report."); return; } const doc = new jsPDF(); const pageHeight = doc.internal.pageSize.height; const pageWidth = doc.internal.pageSize.width; const margin = 14; let yPos = 0; // Define Colors const primaryColor = '#3b82f6'; // Blue const secondaryColor = '#4b5563'; // Gray const lightGrayColor = '#f3f4f6'; const textColor = '#1f2937'; const lightTextColor = '#6b7280'; const disclaimerBgColor = '#fef2f2'; const disclaimerTextColor = '#991b1b'; const disclaimerBorderColor = '#fecaca'; const addHeader = () => { doc.setFont('helvetica', 'bold'); doc.setFontSize(18); doc.setTextColor(primaryColor); doc.text('Symptom Checker Analysis', margin, 20); doc.setFont('helvetica', 'normal'); doc.setFontSize(10); doc.setTextColor(lightTextColor); const reportDate = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); doc.text(`Report Generated: ${reportDate}`, pageWidth - margin, 20, { align: 'right' }); doc.setDrawColor(primaryColor); doc.setLineWidth(0.5); doc.line(margin, 25, pageWidth - margin, 25); yPos = 35; }; const addFooter = () => { const pageCount = doc.internal.getNumberOfPages(); for (let i = 1; i <= pageCount; i++) { doc.setPage(i); doc.setFont('helvetica', 'normal'); doc.setFontSize(8); doc.setTextColor(lightTextColor); doc.text(`Page ${i} of ${pageCount}`, pageWidth / 2, pageHeight - 10, { align: 'center' }); doc.text('Confidential & Informational Report', margin, pageHeight - 10); } }; addHeader(); // --- Section: Submitted Symptoms --- doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(textColor); doc.text('Submitted Symptoms', margin, yPos); yPos += 7; doc.autoTable({ startY: yPos, body: selectedSymptoms.map(s => [s]), theme: 'plain', styles: { fillColor: lightGrayColor, fontSize: 10 }, columnStyles: { 0: { cellPadding: 3 } } }); yPos = doc.autoTable.previous.finalY + 15; // --- Section: Potential Conditions Analysis --- doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(textColor); doc.text('Potential Conditions Analysis', margin, yPos); yPos += 5; analysisResults.forEach(result => { if (yPos > pageHeight - 60) { // Check for page break before drawing card doc.addPage(); addHeader(); } const cardStartY = yPos; doc.setFont('helvetica', 'bold'); doc.setFontSize(16); doc.setTextColor(primaryColor); doc.text(result.condition, margin, yPos += 5); doc.setFont('helvetica', 'normal'); doc.setFontSize(9); doc.setTextColor(lightTextColor); doc.text(`Match Relevance: ${result.score} symptom(s)`, margin, yPos += 5); yPos += 5; doc.autoTable({ startY: yPos, head: [['Your symptoms commonly associated with this condition']], body: result.matchedSymptoms.map(s => [s]), theme: 'grid', headStyles: { fillColor: secondaryColor, textColor: '#ffffff', fontSize: 9, fontStyle: 'bold' }, styles: { fontSize: 9, cellPadding: 2 } }); yPos = doc.autoTable.previous.finalY + 10; // Draw a border around the card doc.setDrawColor(lightGrayColor); doc.setLineWidth(0.3); doc.rect(margin - 2, cardStartY - 5, pageWidth - (margin * 2) + 4, yPos - cardStartY, 'S'); yPos += 5; }); // --- Section: Disclaimer --- if (yPos > pageHeight - 40) { // Check for page break doc.addPage(); addHeader(); } doc.setFont('helvetica', 'bold'); doc.setFontSize(12); doc.setTextColor(disclaimerTextColor); doc.text('Important Disclaimer', margin, yPos); yPos += 6; doc.setFillColor(disclaimerBgColor); doc.setDrawColor(disclaimerBorderColor); doc.rect(margin, yPos, pageWidth - (margin * 2), 20, 'FD'); doc.setFont('helvetica', 'normal'); doc.setFontSize(9); doc.setTextColor(disclaimerTextColor); const disclaimerText = "This tool is for informational purposes only and is not a substitute for professional medical advice, diagnosis, or treatment. The results are based on common symptom patterns and do not constitute a medical diagnosis. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition."; const disclaimerLines = doc.splitTextToSize(disclaimerText, pageWidth - (margin * 2) - 4); doc.text(disclaimerLines, margin + 2, yPos + 5); addFooter(); doc.save('Symptom_Checker_Report.pdf'); }; downloadPdfBtn.addEventListener('click', generatePdf); // --- Initial Load --- initializeSymptoms(); updateUI(); });
Scroll to Top