root = Card([header, metricsRow, chartsRow, staffSection, criticalSection, dischargeSection, orSection, suppliesSection, actionsSection], "card", "column", "l")
header = CardHeader("Hospital Operations Command", "Real-time status — " + todayLabel)
todayLabel = "2025-01-15"
metricsRow = Card([bedOccupancy, erWait], "clear", "row", "l", "stretch", "between")
bedOccupancy = Card([bedLabel, bedProgress], "sunk", "column", "m")
bedLabel = Heading("Bed Occupancy", "h3")
bedProgress = Progress(87, "87% — 348 of 400 beds occupied")
erWait = Card([erLabel, erValue], "sunk", "column", "m", "center", "center")
erLabel = Heading("ER Wait Time", "h3")
erValue = TextContent("42 min", "large-heavy")
chartsRow = Card([admissionsChart, deptChart], "clear", "row", "l", "stretch", "between")
admissionsChart = Card([admissionsTitle, admissionsLine], "sunk", "column", "m")
admissionsTitle = Heading("Admissions (Last 14 Days)", "h3")
admissionsLine = LineChart(admLabels, [admSeries], "natural", "Day", "Admissions")
admLabels = ["Jan 1", "Jan 2", "Jan 3", "Jan 4", "Jan 5", "Jan 6", "Jan 7", "Jan 8", "Jan 9", "Jan 10", "Jan 11", "Jan 12", "Jan 13", "Jan 14"]
admSeries = Series("Admissions", [28, 31, 25, 34, 29, 37, 33, 30, 26, 32, 35, 28, 31, 34])
deptChart = Card([deptTitle, deptBars], "sunk", "column", "m")
deptTitle = Heading("Patients per Department", "h3")
deptBars = HorizontalBarChart(deptLabels, [deptSeries], "grouped", "Patients", "Department")
deptLabels = ["Emergency", "ICU", "Cardiology", "Orthopedics", "Oncology", "Pediatrics", "Surgery", "Neurology"]
deptSeries = Series("Current Census", [42, 28, 35, 22, 18, 15, 31, 19])
staffSection = Card([staffTitle, staffTable], "sunk", "column", "m")
staffTitle = Heading("Staff on Shift", "h3")
staffTable = Table([staffRoleCol, staffCountCol, staffNamesCol])
staffRoleCol = Col("Role", ["Physicians", "Nurses", "Techs", "Support", "Admin"])
staffCountCol = Col("On Shift", [12, 48, 18, 22, 8])
staffNamesCol = Col("Lead", ["Dr. Chen", "Charge RN Davis", "Lead Tech Morris", "Supervisor Lee", "Coordinator Park"])
criticalSection = Card([criticalTitle, criticalList], "sunk", "column", "m")
criticalTitle = Heading("Critical Patients", "h3")
criticalList = ListBlock(criticalItems, "number")
criticalItems = [crit1, crit2, crit3, crit4]
crit1 = ListItem("Room 302 — John Doe", "Septic shock, on vasopressors, lactate 5.2", null, "View Chart")
crit2 = ListItem("ICU Bed 4 — Maria Santos", "Post-op CABG, tamponade risk, echo pending", null, "View Chart")
crit3 = ListItem("ER Bay 1 — Robert Kim", "STEMI, door-to-balloon 42 min, cath lab activated", null, "View Chart")
crit4 = ListItem("Room 418 — Elena Ruiz", "Status epilepticus, on propofol infusion, EEG ordered", null, "View Chart")
dischargeSection = Card([dischargeTitle, dischargeList], "sunk", "column", "m")
dischargeTitle = Heading("Ready for Discharge", "h3")
dischargeList = ListBlock(dischargeItems, "number")
dischargeItems = [disc1, disc2, disc3, disc4, disc5]
disc1 = ListItem("Room 205 — Alice Wong", "CHF exacerbation resolved, meds reconciled, home health arranged", null, "Discharge")
disc2 = ListItem("Room 210 — James Miller", "Pneumonia improved, IV to PO switch complete, follow-up scheduled", null, "Discharge")
disc3 = ListItem("Room 215 — Fatima Al-Rashid", "Post-cholecystectomy day 2, tolerating diet, pain controlled", null, "Discharge")
disc4 = ListItem("Room 220 — David Park", "Cellulitis resolving, wound culture negative, oral antibiotics ready", null, "Discharge")
disc5 = ListItem("Room 225 — Sofia Garcia", "Dehydration corrected, labs normalized, outpatient follow-up set", null, "Discharge")
orSection = Card([orTitle, orTable], "sunk", "column", "m")
orTitle = Heading("Today's OR Bookings", "h3")
orTable = Table([orTimeCol, orRoomCol, orProcedureCol, orSurgeonCol, orStatusCol])
orTimeCol = Col("Time", ["07:00-09:30", "07:30-10:00", "08:00-11:00", "10:00-12:30", "11:00-13:00", "13:00-15:30", "14:00-17:00", "15:30-18:00"])
orRoomCol = Col("OR", ["1", "2", "3", "1", "4", "2", "3", "1"])
orProcedureCol = Col("Procedure", ["Laparoscopic Cholecystectomy", "Total Knee Arthroplasty", "Craniotomy for Tumor", "Appendectomy", "Hip ORIF", "Thyroidectomy", "Spinal Fusion", "Hernia Repair"])
orSurgeonCol = Col("Surgeon", ["Dr. Patel", "Dr. Kim", "Dr. Ahmed", "Dr. Chen", "Dr. Ross", "Dr. Liu", "Dr. Williams", "Dr. Patel"])
orStatusCol = Col("Status", ["In Progress", "In Progress", "In Progress", "Prepped", "Prepped", "Scheduled", "Scheduled", "Scheduled"])
suppliesSection = Card([suppliesTitle, suppliesList], "sunk", "column", "m")
suppliesTitle = Heading("Supplies Running Low", "h3")
suppliesList = ListBlock(supplyItems, "number")
supplyItems = [supply1, supply2, supply3, supply4, supply5]
supply1 = ListItem("Normal Saline 1L Bags", "12 units remaining (par: 50) — Critical", null, "Reorder")
supply2 = ListItem("Epinephrine 1:10,000 Syringes", "8 units remaining (par: 20) — Critical", null, "Reorder")
supply3 = ListItem("Central Line Kits (Triple Lumen)", "3 kits remaining (par: 10) — Low", null, "Reorder")
supply4 = ListItem("Chest Tube Trays (28 Fr)", "4 trays remaining (par: 8) — Low", null, "Reorder")
supply5 = ListItem("Blood Culture Bottles (Aerobic/Anaerobic)", "15 sets remaining (par: 30) — Low", null, "Reorder")
actionsSection = Card([actionsTitle, incidentBtn, transferBtn, dayPicker], "clear", "column", "m")
actionsTitle = Heading("Actions", "h3")
incidentBtn = Button("File Incident Report", null, "primary", "normal", "medium")
transferBtn = Button("Request Patient Transfer", null, "secondary", "normal", "medium")
dayPicker = Form("day-select", dayButtons, [dayField])
dayField = FormControl("View Another Day", dayInput, "Select a date to load historical data")
dayInput = DatePicker("view_date", "single", null, ["2025-01-15"])
dayButtons = Buttons([daySubmit])
daySubmit = Button("Load Day", null, "tertiary", "normal", "small")