Summary Dashboard: Hospital & YouTube Data Comparison
This dashboard allows users to explore and compare hospital performance metrics and YouTube engagement statistics using a dynamic, tabbed interface built with Flask, TailwindCSS, and Chart.js.
Frontend Overview
- Tabbed Interface: Easily switch between hospital data and YouTube analytics.
- Interactive Charts: Visualized using Chart.js for responsive, real-time updates.
- Dynamic Dropdowns: Populated via API responses to load and compare datasets.
Hospital Comparison
(Frontend + Backend)- Data Source:
GET /api/comparison
→ reads fromdata/comparisondata.csv
- Dropdowns: Dynamically populated with hospital names and performance measures.
- Chart Output: Grouped bar chart with:
- Number of Adverse Events
- Number of Cases
- Risk-Adjusted Rate
- Handles missing or unavailable data gracefully.
YouTube Comparison
(Frontend + Backend)- File Selection:
GET /api/youtube/files
lists available CSVs in/data/yt/
- Dataset Loading:
GET /api/youtube/data/<filename>
fetches and cleans selected file. - Chart Output: Bar chart comparing:
- Views
- Likes
- Comments
- Likes per View
- Views per Comment
- Responsive design and tooltip interactivity included.
Backend API Endpoints
/api/comparison
(GET)
Reads hospital metrics from data/comparisondata.csv
and returns a normalized JSON response.
{ "success": true, "count": 300, "data": [ { "HOSPITAL": "Example Hospital", "PERFORMANCE_MEASURE": "Heart Surgery Mortality", "#_OF_ADVERSE_EVENTS": 7, "#_OF_CASES": 150, "RISK-ADJUSTED_RATE": 4.7 } ] }
/api/youtube/files
(GET)
Returns a list of available CSV datasets in the /data/yt/
directory.
{ "success": true, "files": ["MayoClinic.csv", "DoctorMike.csv", "..."] }
/api/youtube/data/<filename>
(GET)
Reads and processes the specified CSV file, returning cleaned data for visualization.
{ "success": true, "data": [ { "CHANNELTITLE": "Mayo Clinic", "VIEWCOUNT": "450000", "LIKECOUNT": "12000", "COMMENTCOUNT": "800", "DURATIONSEC": "360" } ] }
Interactive Exploration Tips
- Use the dropdowns to explore new combinations of data.
- Switch between tabs to analyze hospital vs. video metrics.
- Check console logs for helpful debug messages when loading fails.
This dashboard was created to provide insight into the intersection of healthcare performance and medical content engagement, giving users tools to explore patterns, gaps, and opportunities across both domains.