root = Card([header, overviewRow, chartsRow, peopleRow, careRow, actionsCard], "clear", "column", "xl")
header = CardHeader("Hospital Command Center — St. Mary's", "Live operations · Tuesday, March 4 · 14:22 · All systems nominal")
overviewRow = Card([bedCard, erCard, criticalCard], "clear", "row")
bedCard = Card([bedHeading, bedProgress, bedText], "card", "column", "s")
bedHeading = Heading("Bed occupancy", "h3")
bedProgress = Progress(87, "348 of 400 beds occupied")
bedText = TextContent("**ICU** 24/28 · **Med/Surg** 142/160 · **Telemetry** 58/72 · **Pediatrics** 31/40 · **Step-down** 12/16 · **ED** 81/84", "small")
erCard = Card([erHeading, erCallout, erText], "card", "column", "s")
erHeading = Heading("Current ER wait", "h3")
erCallout = TextCallout("warning", "42 minutes average", "Door-to-provider — up from 28 minutes at 06:00")
erText = TextContent("**38** patients waiting · **6** critical in ED · Peak expected 16:00–19:00", "small")
criticalCard = Card([criticalHeading, criticalAlert, criticalTable], "card", "column", "s")
criticalHeading = Heading("Critical patients", "h3")
criticalAlert = Alert("3 patients critical", "ICU at 86% — 2 stabilizing, 1 transfer pending", "destructive")
criticalTable = Table([critPatient, critUnit, critStatus])
critPatient = Col("Patient", ["A. Okonkwo", "J. Ramirez", "S. Patel"])
critUnit = Col("Unit", ["ICU", "ICU", "Cardiac"])
critStatus = Col("Status", ["Ventilated — stable", "Post-op — monitoring", "Arrhythmia — telemetry"])
chartsRow = Card([admCard, deptCard], "clear", "row")
admCard = Card([admHeading, admChart], "card", "column", "s")
admHeading = Heading("Admissions — last 14 days", "h3")
admChart = AreaChart(admLabels, [admSeries], "natural", "Date", "Admissions")
admLabels = ["Feb 19", "Feb 20", "Feb 21", "Feb 22", "Feb 23", "Feb 24", "Feb 25", "Feb 26", "Feb 27", "Feb 28", "Mar 1", "Mar 2", "Mar 3", "Mar 4"]
admSeries = Series("Admissions", [38, 44, 41, 39, 47, 52, 49, 45, 46, 53, 50, 48, 55, 51])
deptCard = Card([deptHeading, deptChart], "card", "column", "s")
deptHeading = Heading("Patients per department", "h3")
deptChart = HorizontalBarChart(deptLabels, [deptSeries], "grouped", "Patients", "Department")
deptLabels = ["Med/Surg", "Emergency", "Cardiology", "Oncology", "Pediatrics", "Orthopedics", "ICU"]
deptSeries = Series("Patients", [142, 81, 38, 29, 31, 26, 24])
peopleRow = Card([staffCard, orCard], "clear", "row")
staffCard = Card([staffHeading, staffTable], "card", "column", "s")
staffHeading = Heading("Staff on shift — shift B", "h3")
staffTable = Table([staffName, staffRole, staffDept, staffShift])
staffName = Col("Name", ["Dr. Lena Fischer", "Dr. Omar Haddad", "Nurse Priya Nair", "Nurse Tom Becker", "Tech Ana Ruiz", "Dr. Grace Liu"])
staffRole = Col("Role", ["Attending — ED", "Attending — ICU", "Charge RN — Med/Surg", "RN — Cardiology", "CT Technologist", "Oncologist"])
staffDept = Col("Department", ["Emergency", "ICU", "Med/Surg", "Cardiology", "Radiology", "Oncology"])
staffShift = Col("Shift", ["Day", "Day", "Day", "Evening", "Day", "Night"])
orCard = Card([orHeading, orTable], "card", "column", "s")
orHeading = Heading("Operating room bookings — today", "h3")
orTable = Table([orTime, orProcedure, orSurgeon, orRoom])
orTime = Col("Time", ["07:30", "08:15", "09:00", "10:30", "11:45", "13:00"])
orProcedure = Col("Procedure", ["Total knee replacement", "Laparoscopic cholecystectomy", "CABG", "Hip arthroplasty", "Appendectomy", "Spinal fusion"])
orSurgeon = Col("Surgeon", ["Dr. Whitfield", "Dr. Chen", "Dr. Osei", "Dr. Whitfield", "Dr. Marsh", "Dr. Patel"])
orRoom = Col("OR", ["OR-2", "OR-4", "OR-1", "OR-3", "OR-5", "OR-2"])
careRow = Card([dischargeCard, suppliesCard], "clear", "row")
dischargeCard = Card([dischargeHeading, dischargeList], "card", "column", "s")
dischargeHeading = Heading("Ready for discharge", "h3")
dischargeList = ListBlock([disItem1, disItem2, disItem3, disItem4], "number")
disItem1 = ListItem("Elena Vasquez", "Med/Surg — awaiting transport · Targeting 15:00")
disItem2 = ListItem("Robert Kim", "Orthopedics — PT cleared · Paperwork signed")
disItem3 = ListItem("Amara Diallo", "Oncology — follow-up scheduled · Pharmacy ready")
disItem4 = ListItem("Jack Morrison", "Cardiology — vitals stable · Cardiologist sign-off pending")
suppliesCard = Card([suppliesHeading, suppliesTable], "card", "column", "s")
suppliesHeading = Heading("Supplies running low", "h3")
suppliesTable = Table([supplyName, supplyStock, supplyStatus])
supplyName = Col("Supply", ["N95 masks", "Saline IV bags", "Insulin pens", "Surgical gloves (M)", "Blood culture bottles"])
supplyStock = Col("Stock", ["~2 days (14 boxes)", "~3 days (220 bags)", "~2 days (18 units)", "~4 days (60 boxes)", "~5 days (40 bottles)"])
supplyStatus = Col("Status", ["Critical", "Critical", "Low", "Low", "Low"])
actionsCard = Card([actionsHeading, actionRow], "sunk", "column", "m")
actionsHeading = Heading("Operations actions", "h3")
actionRow = Card([incidentDialog, dayDialog, transferDialog], "clear", "row")
incidentDialog = DialogBlock("File incident", "Report an incident", "Describe the event so the right team can respond. Reports are routed to risk management immediately.", [incidentForm])
incidentForm = Form("incident_report", incidentButtons, [incTypeField, incSeverityField, incLocationField, incDetailField])
incTypeField = FormControl("Incident type", incTypeSelect)
incTypeSelect = Select("incident_type", [incOptMed, incOptFall, incOptEquip, incOptStaff], "Select a type")
incOptMed = SelectItem("medication", "Medication error")
incOptFall = SelectItem("fall", "Patient fall")
incOptEquip = SelectItem("equipment", "Equipment failure")
incOptStaff = SelectItem("safety", "Staff safety / security")
incSeverityField = FormControl("Severity", incSeverityRadio)
incSeverityRadio = RadioGroup("severity", [sevLow, sevMed, sevHigh])
sevLow = RadioItem("Low", "No patient impact", "low")
sevMed = RadioItem("Medium", "Care delayed", "medium")
sevHigh = RadioItem("High", "Immediate risk", "high")
incLocationField = FormControl("Location", incLocationInput)
incLocationInput = Input("location", "e.g. 3W-12, Bed B")
incDetailField = FormControl("Description", incDetailArea, "Include actions already taken")
incDetailArea = TextArea("description", "What happened?", 4)
incidentButtons = Buttons([incSubmit, incCancel])
incSubmit = Button("Submit report", null, "primary")
incCancel = Button("Cancel", null, "tertiary")
dayDialog = DialogBlock("View another day", "Open another day", "Load the operations view for a different date — bed counts, ER wait, staffing and OR bookings.", [dayForm])
dayForm = Form("lookup_day", dayButtons, [dayField])
dayField = FormControl("Date", dayDatePicker, "Reports for the selected date will replace today's data")
dayDatePicker = DatePicker("target_date", "single")
dayButtons = Buttons([dayViewBtn, dayCancelBtn])
dayViewBtn = Button("View day")
dayCancelBtn = Button("Cancel", null, "tertiary")
transferDialog = DialogBlock("Request transfer", "Request a patient transfer", "Transfers route to the bed coordinator and are typically confirmed within 30 minutes.", [transferForm])
transferForm = Form("transfer_request", transferButtons, [transferPatientField, transferUnitField, transferReasonField, transferPriorityField])
transferPatientField = FormControl("Patient", transferPatientSelect)
transferPatientSelect = Select("patient", [transferPat1, transferPat2, transferPat3], "Select patient")
transferPat1 = SelectItem("okonkwo", "A. Okonkwo — ICU to Step-down")
transferPat2 = SelectItem("ramirez", "J. Ramirez — ICU to Med/Surg")
transferPat3 = SelectItem("morrison", "J. Morrison — Cardiology to Telemetry")
transferUnitField = FormControl("Receiving unit", transferUnitSelect)
transferUnitSelect = Select("receiving_unit", [transferUnitSD, transferUnitMS, transferUnitTel, transferUnitRehab], "Select unit")
transferUnitSD = SelectItem("stepdown", "Step-down")
transferUnitMS = SelectItem("medsurg", "Med/Surg")
transferUnitTel = SelectItem("telemetry", "Telemetry")
transferUnitRehab = SelectItem("rehab", "Rehab")
transferReasonField = FormControl("Reason", transferReasonArea)
transferReasonArea = TextArea("reason", "Clinical rationale", 3)
transferPriorityField = FormControl("Priority", transferPriorityRadio)
transferPriorityRadio = RadioGroup("priority", [transferPrioStd, transferPrioUrg])
transferPrioStd = RadioItem("Standard", "Within 4 hours", "standard")
transferPrioUrg = RadioItem("Urgent", "As soon as possible", "urgent")
transferButtons = Buttons([transferSubmit, transferCancel])
transferSubmit = Button("Submit request", null, "primary")
transferCancel = Button("Cancel", null, "tertiary")