root = Card([header, liveTag, statusSection, criticalCallout, admissionsCard, deptCard, staffCard, dischargeCard, orCard, suppliesCard, actionsCard], "card", "column", "l")
header = CardHeader("St. Mary's Medical Center", "Operations Command Center — live dashboard")
liveTag = Tag("Live · Updated 12:45 · Viewing Jun 12", null, "sm", "success")
statusSection = Card([statusHeading, occupancyProgress, kpiRow], "sunk", "column", "m")
statusHeading = Heading("Hospital status", "h3")
occupancyProgress = Progress(87, "Bed occupancy — 412 of 473 beds in use (61 free)")
kpiRow = Card([erKpi, pendKpi, freeKpi], "clear", "row", "m")
erKpi = Card([erNum, erLbl], "clear", "column", "xs")
erNum = TextContent("45 min", "large-heavy")
erLbl = TextContent("Current ER wait", "small")
pendKpi = Card([pendNum, pendLbl], "clear", "column", "xs")
pendNum = TextContent("8", "large-heavy")
pendLbl = TextContent("Ready for discharge", "small")
freeKpi = Card([freeNum, freeLbl], "clear", "column", "xs")
freeNum = TextContent("3", "large-heavy")
freeLbl = TextContent("ICU beds free", "small")
criticalCallout = Callout("error", "Critical patients — immediate attention", "Room 302: J. Okafor (septic shock, awaiting ICU bed) · Room 214: M. Chen (post-cardiac arrest, unstable) · Room 118: R. Alvarez (acute stroke, on thrombolysis)")
admissionsCard = Card([admissionsTitle, admissionsChart], "sunk", "column", "s")
admissionsTitle = Heading("Admissions — last 14 days", "h3")
admissionsChart = AreaChart(labels14, [admissionsSeries], "natural", "Day", "Admissions")
labels14 = ["May 30", "May 31", "Jun 1", "Jun 2", "Jun 3", "Jun 4", "Jun 5", "Jun 6", "Jun 7", "Jun 8", "Jun 9", "Jun 10", "Jun 11", "Jun 12"]
admissionsSeries = Series("Admissions", [31, 28, 33, 36, 30, 29, 35, 38, 34, 37, 41, 39, 43, 40])
deptCard = Card([deptTitle, deptChart], "sunk", "column", "s")
deptTitle = Heading("Patients per department", "h3")
deptChart = BarChart(["Emergency", "ICU", "Cardiology", "Neurology", "Surgery", "Pediatrics", "Maternity", "Oncology"], [deptSeries], "grouped", "Department", "Patients")
deptSeries = Series("Inpatients", [24, 18, 22, 15, 17, 12, 9, 11])
staffCard = Card([staffTitle, staffTable], "sunk", "column", "s")
staffTitle = Heading("Staff on shift", "h3")
staffTable = Table([staffName, staffRole, staffShift])
staffName = Col("Name", ["Dr. A. Patel", "Dr. S. Nguyen", "Nurse T. Williams", "Nurse J. Kim", "Dr. L. Rossi", "Dr. M. Haddad", "Tech D. Brooks"])
staffRole = Col("Role", ["Attending — Emergency", "Attending — ICU", "Charge Nurse — ICU", "RN — Cardiology", "Attending — Neurology", "Attending — Surgery", "Rad Tech — Imaging"])
staffShift = Col("Shift", ["Day", "Day", "Day", "Night", "Day", "Evening", "Day"])
dischargeCard = Card([dischargeTitle, dischargeList], "sunk", "column", "s")
dischargeTitle = Heading("Patients ready for discharge", "h3")
dischargeList = ListBlock([discharge1, discharge2, discharge3, discharge4])
discharge1 = ListItem("E. Novak", "Room 204 · Cardiology — awaiting pickup at 3:00 PM", null, "Discharge")
discharge2 = ListItem("T. Osei", "Room 118 · ER observation — discharge papers signed", null, "Discharge")
discharge3 = ListItem("G. Romano", "Room 331 · Surgery — follow-up scheduled in 1 week", null, "Discharge")
discharge4 = ListItem("H. Yamamoto", "Room 410 · Maternity — mother and baby stable", null, "Discharge")
orCard = Card([orTitle, orTable], "sunk", "column", "s")
orTitle = Heading("Operating room bookings — today", "h3")
orTable = Table([orTime, orRoom, orProc, orSurgeon])
orTime = Col("Time", ["07:30", "09:00", "10:30", "13:00", "15:30"])
orRoom = Col("OR", ["OR-1", "OR-2", "OR-3", "OR-1", "OR-2"])
orProc = Col("Procedure", ["Total hip replacement", "Laparoscopic cholecystectomy", "Craniotomy — tumor resection", "C-section", "ACL reconstruction"])
orSurgeon = Col("Surgeon", ["Dr. M. Haddad", "Dr. P. Singh", "Dr. L. Rossi", "Dr. F. Adeyemi", "Dr. K. Bergstrom"])
suppliesCard = Card([suppliesTitle, suppliesTable], "sunk", "column", "s")
suppliesTitle = Heading("Supplies running low", "h3")
suppliesTable = Table([supplyItem, supplyStock, supplyStatus])
supplyItem = Col("Supply", ["IV saline 1L", "N95 masks", "Heparin vials", "Surgical gloves (M)", "Propofol 20 mL"])
supplyStock = Col("Stock", ["38 bags", "4 boxes", "12 vials", "6 boxes", "15 vials"])
supplyStatus = Col("Status", ["Reorder", "Critical", "Reorder", "Reorder", "Critical"])
actionsCard = Card([actionsTitle, incidentDialog, transferDialog, dateDialog], "sunk", "column", "s")
actionsTitle = Heading("Operations actions", "h3")
incidentDialog = DialogBlock("File an incident", "File an incident report", "Complete the form to log an incident; the shift supervisor reviews every submission.", [incidentForm])
incidentForm = Form("incident-report", incidentButtons, [incidentTypeField, incidentSeverityField, incidentLocationField, incidentDescField])
incidentTypeField = FormControl("Incident type", incidentTypeSelect)
incidentTypeSelect = Select("incident_type", [incidentType1, incidentType2, incidentType3, incidentType4], "Select a type...")
incidentType1 = SelectItem("medication", "Medication error")
incidentType2 = SelectItem("fall", "Patient fall")
incidentType3 = SelectItem("equipment", "Equipment failure")
incidentType4 = SelectItem("other", "Other")
incidentSeverityField = FormControl("Severity", incidentSeverityRadio)
incidentSeverityRadio = RadioGroup("severity", [sevLow, sevMed, sevHigh], "medium")
sevLow = RadioItem("Low", "No harm to patient", "low")
sevMed = RadioItem("Medium", "Minor harm", "medium")
sevHigh = RadioItem("High", "Major harm or near miss", "high")
incidentLocationField = FormControl("Location", incidentLocationInput)
incidentLocationInput = Input("location", "e.g. ICU — Room 302")
incidentDescField = FormControl("Description", incidentDescTextarea, "Include what happened and anyone involved.")
incidentDescTextarea = TextArea("description", "Describe what happened...", 4)
incidentButtons = Buttons([incidentSubmit, incidentCancel])
incidentSubmit = Button("Submit incident", null, "primary")
incidentCancel = Button("Cancel", null, "tertiary")
transferDialog = DialogBlock("Request patient transfer", "Request a patient transfer", "Choose the patient and destination; the bed coordinator will confirm.", [transferForm])
transferForm = Form("transfer-request", transferButtons, [transferPatientField, transferDestField, transferReasonField])
transferPatientField = FormControl("Patient", transferPatientSelect)
transferPatientSelect = Select("patient", [transferP1, transferP2, transferP3], "Select patient...")
transferP1 = SelectItem("j-okafor", "J. Okafor — Room 302 (ICU)")
transferP2 = SelectItem("r-alvarez", "R. Alvarez — Room 118 (ER)")
transferP3 = SelectItem("m-chen", "M. Chen — Room 214 (ICU)")
transferDestField = FormControl("Destination department", transferDestSelect)
transferDestSelect = Select("destination", [destICU, destCardio, destNeuro, destStepdown], "Select department...")
destICU = SelectItem("icu", "ICU")
destCardio = SelectItem("cardio", "Cardiology")
destNeuro = SelectItem("neuro", "Neurology")
destStepdown = SelectItem("stepdown", "Step-down unit")
transferReasonField = FormControl("Reason", transferReasonTextarea)
transferReasonTextarea = TextArea("reason", "Clinical reason for transfer...", 3)
transferButtons = Buttons([transferSubmit, transferCancel])
transferSubmit = Button("Request transfer", null, "primary")
transferCancel = Button("Cancel", null, "tertiary")
dateDialog = DialogBlock("View another day", "View another day", "Pick a date to load that day's command view.", [dateCalendar, dateSelectButtons])
dateCalendar = CalendarBlock("single", "2025-06", 1, "dropdown")
dateSelectButtons = Buttons([viewDateBtn, cancelDateBtn])
viewDateBtn = Button("Show selected day", null, "primary")
cancelDateBtn = Button("Cancel", null, "tertiary")