Healthcare Access & Quality Dashboard: US Region

Key Access & Quality Indicators

Health Insurance Coverage

Average ER Wait Time

Overall Patient Satisfaction Score

Screenings & Hospital Outcomes

Cancer Screening Rates (Adults 50+)

Hospital Readmission Rate (30-Day)

Virtual Care Integration

Patient Telehealth Visits by Specialty

Telehealth Adoption Rate (YoY)

Error: A required library or the main container is missing. The tool cannot be initialized.

'; return; } const { jsPDF } = window.jspdf; // --- CHART RENDERING --- const renderCharts = () => { try { // --- Chart 1: Insurance Coverage --- const insuranceOptions = { chart: { type: 'donut' }, series: [92.5, 7.5], // Regional data: 92.5% insured labels: ['Insured', 'Uninsured'], colors: ['#005a9c', '#d32f2f'], plotOptions: { pie: { donut: { labels: { show: true, total: { show: true, label: 'Coverage', formatter: () => '92.5%' } } } } }, legend: { position: 'bottom' }, responsive: [{ breakpoint: 480, options: { chart: { width: '100%' } } }] }; new ApexCharts(document.querySelector("#haq-insurance-chart"), insuranceOptions).render(); // --- Chart 2: ER Wait Time --- const erWaitTimeOptions = { chart: { type: 'radialBar' }, series: [88], // Regional time is 88% of national average (good) plotOptions: { radialBar: { hollow: { size: '70%' }, dataLabels: { name: { show: true, fontSize: '16px', color: '#6c757d', offsetY: -10, formatter: () => 'vs. National Avg.' }, value: { show: true, fontSize: '32px', color: '#2c3e50', offsetY: 10, formatter: () => '2h 20m' }, // Regional: 140 mins }, }, }, stroke: { lineCap: 'round' }, labels: ['Regional ER Wait Time'], colors: ['#28a745'] // Green - better than average }; new ApexCharts(document.querySelector("#haq-er-wait-time-chart"), erWaitTimeOptions).render(); // National average is 2h 42m (162 mins) // --- Chart 3: Patient Satisfaction --- const satisfactionOptions = { chart: { type: 'bar' }, series: [{ name: 'Score', data: [88, 92] }], // Regional vs. National Goal xaxis: { categories: ['Regional Score', 'National Target'] }, yaxis: { min: 0, max: 100, labels: { formatter: (val) => `${val}%` } }, plotOptions: { bar: { distributed: true, horizontal: false, barHeight: '70%'} }, colors: ['#ffc107', '#28a745'], // Yellow for regional, green for target legend: { show: false } }; new ApexCharts(document.querySelector("#haq-satisfaction-chart"), satisfactionOptions).render(); // --- Chart 4: Cancer Screening Rates --- const screeningOptions = { chart: { type: 'bar', stacked: true }, series: [ { name: 'Screened', data: [68, 72] }, // Colorectal, Breast { name: 'Not Screened', data: [32, 28] } ], xaxis: { categories: ['Colorectal Cancer', 'Breast Cancer'] }, yaxis: { labels: { formatter: (val) => `${val}%` } }, plotOptions: { bar: { horizontal: true } }, colors: ['#005a9c', '#bdc3c7'], dataLabels: { enabled: false }, tooltip: { y: { formatter: (val) => `${val}%` } } }; new ApexCharts(document.querySelector("#haq-screening-chart"), screeningOptions).render(); // --- Chart 5: Hospital Readmission Rate --- const readmissionOptions = { chart: { type: 'gauge', height: '100%' }, series: [15.8], // Regional rate plotOptions: { gauge: { startAngle: -90, endAngle: 90, value: { fontSize: '30px', offsetY: -10, formatter: (val) => `${val}%` }, dataLabels: { name: { show: true, offsetY: 20, color: '#6c757d', formatter: () => 'Lower is Better' } } } }, labels: ['30-Day Readmission'], colors: ['#dc3545'] // Red - high number is bad }; new ApexCharts(document.querySelector("#haq-readmission-chart"), readmissionOptions).render(); // --- Chart 6: Telehealth by Specialty --- const telehealthSpecialtyOptions = { chart: { type: 'bar' }, series: [{ name: 'Visits', data: [45, 30, 15, 10] }], xaxis: { categories: ['Mental Health', 'Primary Care', 'Specialty Care', 'Urgent Care'] }, plotOptions: { bar: { distributed: true } }, colors: ['#005a9c', '#3498db', '#e67e22', '#2c3e50'], dataLabels: { enabled: false }, legend: { show: false }, tooltip: { y: { formatter: (val) => `${val}% of all telehealth visits` } } }; new ApexCharts(document.querySelector("#haq-telehealth-specialty-chart"), telehealthSpecialtyOptions).render(); // --- Chart 7: Telehealth Trend --- const telehealthTrendOptions = { chart: { type: 'line' }, series: [{ name: 'Adoption Rate', data: [28, 32, 35] }], xaxis: { categories: ['2023', '2024', '2025 (YTD)'] }, yaxis: { min: 0, labels: { formatter: (val) => `${val}%` } }, stroke: { curve: 'smooth' }, markers: { size: 5 }, colors: ['#005a9c'] }; new ApexCharts(document.querySelector("#haq-telehealth-trend-chart"), telehealthTrendOptions).render(); } catch(error) { console.error("Chart rendering failed:", error); // Optionally display an error message in the UI } }; // --- TAB NAVIGATION --- const tabButtons = document.querySelectorAll('.haq-tab-button'); const tabContents = document.querySelectorAll('.haq-tab-content'); const nextBtn = document.getElementById('haq-next-btn'); const prevBtn = document.getElementById('haq-prev-btn'); const switchTab = (tabId) => { tabContents.forEach(content => { content.classList.remove('active'); content.style.display = 'none'; // Explicitly hide }); tabButtons.forEach(button => { button.classList.remove('active'); if (button.dataset.tab === tabId) { button.classList.add('active'); } }); const activeContent = document.getElementById(tabId); if(activeContent) { activeContent.classList.add('active'); activeContent.style.display = 'block'; // Explicitly show } updateNavButtons(); }; const updateNavButtons = () => { const i = [...tabButtons].findIndex(b => b.classList.contains('active')); prevBtn.disabled = i === 0; nextBtn.disabled = i === tabButtons.length - 1; }; tabButtons.forEach(button => button.addEventListener('click', () => switchTab(button.dataset.tab))); nextBtn.addEventListener('click', () => { const currentIndex = [...tabButtons].findIndex(b => b.classList.contains('active')); if (currentIndex < tabButtons.length - 1) { const nextTabId = tabButtons[currentIndex + 1].dataset.tab; switchTab(nextTabId); } }); prevBtn.addEventListener('click', () => { const currentIndex = [...tabButtons].findIndex(b => b.classList.contains('active')); if (currentIndex > 0) { const prevTabId = tabButtons[currentIndex - 1].dataset.tab; switchTab(prevTabId); } }); // --- PDF EXPORT --- document.getElementById('haq-download-pdf-btn').addEventListener('click', function() { const btn = this; btn.textContent = 'Generating...'; btn.disabled = true; const contentToCapture = document.getElementById('haq-pdf-capture-area'); const activeTabId = document.querySelector('.haq-tab-button.active').dataset.tab; // Temporarily make all tabs visible for capture tabContents.forEach(tab => tab.style.display = 'block'); html2canvas(contentToCapture, { scale: 2, windowWidth: contentToCapture.scrollWidth, windowHeight: contentToCapture.scrollHeight }) .then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const canvasWidth = canvas.width; const canvasHeight = canvas.height; const ratio = canvasWidth / canvasHeight; let imgWidth = pdfWidth - 20; let imgHeight = imgWidth / ratio; let heightLeft = imgHeight; let position = 15; // top margin pdf.setFontSize(22); pdf.setTextColor('#005a9c'); pdf.text('Healthcare Access & Quality Report', pdfWidth / 2, 10, { align: 'center' }); pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight); heightLeft -= (pdfHeight - position - 10); while (heightLeft > 0) { position = -imgHeight + heightLeft; pdf.addPage(); pdf.addImage(imgData, 'PNG', 10, position, imgWidth, imgHeight); heightLeft -= pdfHeight; } pdf.save('Healthcare_Access_Quality_Report.pdf'); }) .catch(error => { console.error("PDF generation failed:", error); alert("An error occurred while generating the PDF."); }) .finally(() => { // Restore tab visibility to the original active tab switchTab(activeTabId); btn.textContent = 'Download Full Report'; btn.disabled = false; }); }); // --- INITIALIZATION --- renderCharts(); updateNavButtons(); });
Scroll to Top