root = Card([header, alertBanner, occupancySection, erSection, admissionsSection, deptSection, staffSection, criticalSection, dischargeSection, orSection, suppliesSection, actionsSection, incidentDialog, dayPicker, transferDialog])
header = CardHeader("Hospital Operations Command", "Live overview — updated 2 min ago")
alertBanner = Callout("info", "All systems operational", "ER wait times elevated. Staffing at normal levels.")
occupancySection = Card([occupancyHeading, occupancyChart, occupancyTags], "sunk")
occupancyHeading = Heading("Bed Occupancy", "h3")
occupancyChart = SingleStackedBarChart(["Occupied", "Available", "Maintenance"], [312, 48, 12])
occupancyTags = TagBlock(["312 / 372 beds in use (84%)", "48 available", "12 out of service"])
erSection = Card([erHeading, erWait, erNote], "sunk")
erHeading = Heading("Emergency Room Wait", "h3")
erWait = Progress(72, "Average ER wait: 72 minutes")
erNote = TextContent("Target under 45 minutes. Currently 60% above target.", "small")
admissionsSection = Card([admissionsHeading, admissionsChart], "sunk")
admissionsHeading = Heading("Admissions — Past 14 Days", "h3")
admissionsChart = LineChart(["D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "D10", "D11", "D12", "D13", "D14"], [admissionsSeries], "natural", "Day", "Admissions")
admissionsSeries = Series("Admissions", [42, 38, 51, 47, 55, 49, 44, 58, 52, 61, 47, 50, 56, 48])
deptSection = Card([deptHeading, deptChart], "sunk")
deptHeading = Heading("Patients per Department", "h3")
deptChart = BarChart(["Cardiology", "Neurology", "Orthopedics", "Pediatrics", "Oncology", "General"], [deptSeries], "grouped", "Department", "Patients")
deptSeries = Series("Patients", [58, 41, 37, 52, 33, 91])
staffSection = Card([staffHeading, staffTable], "sunk")
staffHeading = Heading("Staff on Shift", "h3")
staffTable = Table([staffName, staffRole, staffDept])
staffName = Col("Name", ["Dr. A. Patel", "Dr. M. Chen", "Nurse R. Okafor", "Nurse L. Diaz", "Dr. S. Kim", "Tech J. Brown"])
staffRole = Col("Role", ["Attending Physician", "Resident", "Charge Nurse", "RN", "Surgeon", "Lab Tech"])
staffDept = Col("Department", ["Cardiology", "ER", "ICU", "Surgery", "OR", "Pathology"])
criticalSection = Card([criticalHeading, criticalCallout], "sunk")
criticalHeading = Heading("Critical Patients", "h3")
criticalCallout = TextCallout("danger", "3 critical patients require attention", "Room 214 — Code Blue watch. Room 307 — unstable vitals. Room 118 — post-op complication.")
dischargeSection = Card([dischargeHeading, dischargeList], "sunk")
dischargeHeading = Heading("Ready for Discharge", "h3")
dischargeList = ListBlock([discharge1, discharge2, discharge3, discharge4], "number")
discharge1 = ListItem("Room 102 — J. Alvarez", "Discharge approved, awaiting transport")
discharge2 = ListItem("Room 115 — B. Tran", "Follow-up scheduled, meds ready")
discharge3 = ListItem("Room 201 — C. Novak", "Paperwork complete, family notified")
discharge4 = ListItem("Room 330 — D. Reyes", "Vitals stable, discharge summary done")
orSection = Card([orHeading, orTable], "sunk")
orHeading = Heading("Today's Operating Room Bookings", "h3")
orTable = Table([orTime, orRoom, orProcedure, orSurgeon])
orTime = Col("Time", ["07:30", "09:00", "10:30", "13:00", "15:00", "16:30"])
orRoom = Col("OR", ["OR1", "OR2", "OR3", "OR1", "OR2", "OR4"])
orProcedure = Col("Procedure", ["CABG", "Hip Replacement", "Appendectomy", "Spinal Fusion", "Knee Arthroscopy", "Emergency Laparotomy"])
orSurgeon = Col("Surgeon", ["Dr. S. Kim", "Dr. L. Grant", "Dr. R. Mehta", "Dr. A. Costa", "Dr. S. Kim", "Dr. M. Chen"])
suppliesSection = Card([suppliesHeading, suppliesTable], "sunk")
suppliesHeading = Heading("Supplies Running Low", "h3")
suppliesTable = Table([supplyItem, supplyStock, supplyStatus])
supplyItem = Col("Supply", ["IV Saline (1L)", "Surgical Gloves (M)", "N95 Masks", "Insulin Pens", "Blood Bags (O-)", "Suture Kits"])
supplyStock = Col("Stock", ["24 units", "300 pairs", "150 units", "18 units", "8 units", "12 kits"])
supplyStatus = Col("Status", ["Critical", "Low", "Low", "Critical", "Critical", "Low"])
actionsSection = Card([actionsHeading, actionsButtons], "sunk")
actionsHeading = Heading("Actions", "h3")
actionsButtons = Buttons([incidentBtn, dayBtn, transferBtn])
incidentBtn = Button("File Incident Report")
dayBtn = Button("View Another Day", null, "secondary")
transferBtn = Button("Request Patient Transfer", null, "secondary")
incidentDialog = DialogBlock("File Incident Report", "Incident Report", "Describe the incident to file a report", [incidentForm])
incidentForm = Form("incident-report", incidentButtons, [incidentTypeField, incidentDescField, incidentPriorityField])
incidentTypeField = FormControl("Incident Type", incidentTypeSelect, "Select the category")
incidentTypeSelect = Select("incident_type", [typeMed, typeFall, typeEquipment, typeOther], "Choose type")
typeMed = SelectItem("medication", "Medication Error")
typeFall = SelectItem("fall", "Patient Fall")
typeEquipment = SelectItem("equipment", "Equipment Failure")
typeOther = SelectItem("other", "Other")
incidentDescField = FormControl("Description", incidentDescArea, "Provide details")
incidentDescArea = TextArea("description", "Describe what happened...", 4)
incidentPriorityField = FormControl("Priority", incidentPriorityRadio)
incidentPriorityRadio = RadioGroup("priority", [prioHigh, prioMed, prioLow], "medium")
prioHigh = RadioItem("High", "Immediate attention", "high")
prioMed = RadioItem("Medium", "Address within 24h", "medium")
prioLow = RadioItem("Low", "Monitor", "low")
incidentButtons = Buttons([incidentSubmit])
incidentSubmit = Button("Submit Incident", null, "primary")
dayPicker = DialogBlock("View Another Day", "Select a Date", "Pick a day to view operations for that date", [dayCalendar])
dayCalendar = CalendarBlock("single")
transferDialog = DialogBlock("Request Patient Transfer", "Patient Transfer Request", "Request a transfer for a patient", [transferForm])
transferForm = Form("transfer-request", transferButtons, [patientField, fromDeptField, toDeptField, reasonField])
patientField = FormControl("Patient", patientInput)
patientInput = Input("patient", "Patient name or ID")
fromDeptField = FormControl("Current Department", fromDeptSelect)
fromDeptSelect = Select("from_dept", [fromCardio, fromNeuro, fromOrtho, fromPeds, fromOnco, fromGen], "Select current dept")
fromCardio = SelectItem("cardiology", "Cardiology")
fromNeuro = SelectItem("neurology", "Neurology")
fromOrtho = SelectItem("orthopedics", "Orthopedics")
fromPeds = SelectItem("pediatrics", "Pediatrics")
fromOnco = SelectItem("oncology", "Oncology")
fromGen = SelectItem("general", "General")
toDeptField = FormControl("Destination Department", toDeptSelect)
toDeptSelect = Select("to_dept", [toCardio, toNeuro, toOrtho, toPeds, toOnco, toGen], "Select destination dept")
toCardio = SelectItem("cardiology", "Cardiology")
toNeuro = SelectItem("neurology", "Neurology")
toOrtho = SelectItem("orthopedics", "Orthopedics")
toPeds = SelectItem("pediatrics", "Pediatrics")
toOnco = SelectItem("oncology", "Oncology")
toGen = SelectItem("general", "General")
reasonField = FormControl("Reason", reasonArea, "Explain the reason for transfer")
reasonArea = TextArea("reason", "Reason for transfer...", 3)
transferButtons = Buttons([transferSubmit])
transferSubmit = Button("Submit Transfer Request", null, "primary")