Disclaimer:
This is a general assessment, not a medical diagnosis. Consult a physical therapist or certified trainer for a comprehensive evaluation and personalized exercise program.
`;
}
function downloadResultPDF() {
const { jsPDF } = window.jspdf;
const doc = new jsPDF({ unit: 'pt', format: 'a4' });
const docWidth = doc.internal.pageSize.getWidth();
const margin = 40;
let currentY = margin;
// Header
doc.setFont('helvetica', 'bold');
doc.setFontSize(22);
doc.setTextColor(79, 70, 229);
doc.text('Muscle Imbalance Assessment Report', margin, currentY);
currentY += 25;
doc.setFont('helvetica', 'normal');
doc.setFontSize(10);
doc.setTextColor(108, 117, 125);
doc.text(`Report Date: ${new Date().toLocaleDateString('en-US')}`, margin, currentY);
currentY += 40;
const addSectionHeader = (title) => {
doc.setFont('helvetica', 'bold');
doc.setFontSize(14);
doc.setTextColor(33, 37, 41);
doc.text(title, margin, currentY);
currentY += 15;
doc.setDrawColor(222, 226, 230);
doc.line(margin, currentY, docWidth - margin, currentY);
currentY += 25;
};
// Observations
addSectionHeader('Your Observations');
doc.setFont('helvetica', 'normal');
doc.setFontSize(11);
lastResult.observations.forEach(obs => {
doc.text(`• ${obs}`, margin, currentY);
currentY += 18;
});
currentY += 20;
// Assessment Results
addSectionHeader('Assessment Results');
doc.autoTable({
startY: currentY,
head: [['Likely Overactive (Tight) Muscles', 'Likely Underactive (Weak) Muscles']],
body: [
[lastResult.tight.join('\n'), lastResult.weak.join('\n')]
],
theme: 'grid',
headStyles: { fillColor: [79, 70, 229] },
styles: { font: 'helvetica', fontSize: 10, cellPadding: 10, valign: 'top' }
});
currentY = doc.autoTable.previous.finalY + 30;
// Corrective Strategy
addSectionHeader('General Corrective Strategy');
doc.setFont('helvetica', 'normal');
doc.setFontSize(11);
const strategyText = [
'For the identified tight muscles, focus on consistent stretching and foam rolling to improve flexibility and reduce overactivity.',
'For the weak muscles, incorporate targeted strengthening exercises into your routine to improve stability, motor control, and function.'
];
doc.text(strategyText, margin, currentY);
currentY += 50;
// Disclaimer
const pageHeight = doc.internal.pageSize.getHeight();
doc.setFont('helvetica', 'bold');
doc.setFontSize(10);
doc.setTextColor(220, 38, 38);
const disclaimerY = pageHeight - 60;
doc.text('Disclaimer: This is not a medical diagnosis.', margin, disclaimerY);
doc.setFont('helvetica', 'normal');
doc.setFontSize(9);
doc.setTextColor(108, 117, 125);
doc.text('This tool provides a preliminary assessment based on common movement patterns. Consult a physical therapist or certified personal trainer for a comprehensive evaluation and a personalized corrective exercise program.', margin, disclaimerY + 15, { maxWidth: docWidth - margin * 2 });
doc.save('Muscle-Imbalance-Report.pdf');
}