root = Card([header, statusStrip, kpiRow, deptStaffRow, criticalDischargeRow, orSupplyRow, actionsRow, followup], "clear", "column", "xl")
header = CardHeader("Hospital Operations Command", "Northside Medical Center · Tuesday Nov 10 · Shift B (14:00-22:00)")
statusStrip = Card([statusTag, erTag, bedsTag, shiftTag], "clear", "row", "m")
statusTag = Tag("Operational", null, null, "success")
erTag = Tag("ER wait 42 min", null, null, "warning")
bedsTag = Tag("Beds 342/400", null, null, "info")
shiftTag = Tag("42 staff on shift", null, null, "neutral")
kpiRow = Card([kpiOccupancy, kpiER, kpiAdmits], "clear", "row", "m")
kpiOccupancy = Card([occTitle, occBar, occChart], "sunk", "column", "s")
occTitle = TextContent("Bed occupancy", "small-heavy")
occBar = Progress(86, "342 of 400 beds occupied · 34 available")
occChart = SingleStackedBarChart(["Occupied", "Available"], [342, 58])
kpiER = Card([erTitle, erWait, erDetail], "sunk", "column", "s")
erTitle = TextContent("Current ER wait", "small-heavy")
erWait = Heading("42 min", "h2")
erDetail = TextContent("14 patients waiting · 3 in triage · target under 30 min", "small")
kpiAdmits = Card([admitsTitle, admitsChart], "sunk", "column", "s")
admitsTitle = TextContent("Admissions — last 14 days", "small-heavy")
admitsChart = AreaChart(["10/28", "10/29", "10/30", "10/31", "11/1", "11/2", "11/3", "11/4", "11/5", "11/6", "11/7", "11/8", "11/9", "11/10"], [admitsSeries, dischargeSeries], "natural", "Day", "Patients")
admitsSeries = Series("Admissions", [34, 41, 38, 45, 52, 47, 39, 36, 44, 49, 53, 46, 41, 44])
dischargeSeries = Series("Discharges", [30, 35, 33, 40, 44, 42, 36, 34, 39, 41, 46, 43, 38, 40])
deptStaffRow = Card([deptCard, staffCard], "clear", "row", "l")
deptCard = Card([deptTitle, deptChart], "card", "column", "s")
deptTitle = Heading("Patients per department", "h3")
deptChart = HorizontalBarChart(["ER", "ICU", "Cardiology", "Oncology", "Pediatrics", "Orthopedics", "Neurology", "Maternity"], [deptSeries], "grouped", "Patients", "Department")
deptSeries = Series("Current patients", [38, 22, 31, 26, 18, 24, 17, 29])
staffCard = Card([staffTitle, staffTable], "card", "column", "s")
staffTitle = Heading("Staff on shift", "h3")
staffTable = Table([staffNameCol, staffRoleCol, staffUnitCol, staffEndCol])
staffNameCol = Col("Staff", ["Dr. E. Vasquez", "RN M. Webb", "Dr. P. Nair", "RN S. Reyes", "PharmD J. Kim", "Dr. T. Grant"])
staffRoleCol = Col("Role", ["Attending physician", "Charge nurse", "Surgeon", "Registered nurse", "Clinical pharmacist", "Cardiologist"])
staffUnitCol = Col("Unit", ["ER", "ICU", "OR", "Pediatrics", "Pharmacy", "Cardiology"])
staffEndCol = Col("Shift ends", ["19:00", "21:00", "23:00", "19:00", "20:00", "22:00"])
criticalDischargeRow = Card([criticalCard, dischargeCard], "clear", "row", "l")
criticalCard = Card([criticalTitle, criticalCallout, criticalList], "card", "column", "s")
criticalTitle = Heading("Critical patients — action required", "h3")
criticalCallout = Callout("error", "3 critical patients", "Post-op hemorrhage · Septic shock · STEMI — all need review this hour")
criticalList = ListBlock([crit1, crit2, crit3])
crit1 = ListItem("M. Chen — Room 214", "Post-op hemorrhage · Dr. Vasquez · labs q1h")
crit2 = ListItem("J. Okafor — ICU-4", "Septic shock · on vasopressors · ID consulted")
crit3 = ListItem("R. Alvarez — ER-9", "STEMI · awaiting cath lab · Dr. Nair paged")
dischargeCard = Card([dischargeTitle, dischargeList], "card", "column", "s")
dischargeTitle = Heading("Ready for discharge", "h3")
dischargeList = ListBlock([dis1, dis2, dis3, dis4], "number")
dis1 = ListItem("A. Brooks — Room 318", "Labs cleared 14:20 · awaiting pickup", null, "Discharge")
dis2 = ListItem("L. Nguyen — Room 205", "Summary signed · meds ready", null, "Discharge")
dis3 = ListItem("G. Patel — Room 402", "Awaiting transport to SNF")
dis4 = ListItem("S. Williams — Room 221", "Education done · ride arriving 17:00")
orSupplyRow = Card([orCard, supplyCard], "clear", "row", "l")
orCard = Card([orTitle, orTable], "card", "column", "s")
orTitle = Heading("Operating room bookings — today", "h3")
orTable = Table([orTimeCol, orRoomCol, orProcCol, orSurgeonCol, orStatusCol])
orTimeCol = Col("Time", ["07:30", "09:15", "10:00", "12:30", "14:45"])
orRoomCol = Col("OR", ["OR 1", "OR 2", "OR 3", "OR 1", "OR 2"])
orProcCol = Col("Procedure", ["Total knee replacement", "Laparoscopic cholecystectomy", "C-section", "Hip arthroplasty", "Craniotomy"])
orSurgeonCol = Col("Surgeon", ["Dr. Grant", "Dr. Nair", "Dr. Osei", "Dr. Grant", "Dr. Nair"])
orStatusCol = Col("Status", ["In progress", "On time", "In progress", "Up next", "Scheduled"])
supplyCard = Card([supplyTitle, supplyAlert, supplyTable], "card", "column", "s")
supplyTitle = Heading("Supplies running low", "h3")
supplyAlert = Callout("warning", "O- blood critical", "6 units left — order placed, confirm delivery with blood bank")
supplyTable = Table([supItemCol, supStockCol, supEtaCol])
supItemCol = Col("Supply", ["N95 masks", "Propofol 50 mL", "IV saline 1 L", "Blood bags O-", "Ceftriaxone 1 g"])
supStockCol = Col("Remaining", ["12 boxes", "8 vials", "24 units", "6 units", "40 doses"])
supEtaCol = Col("Restock ETA", ["Tue 08:00", "Tue 08:00", "Wed 12:00", "URGENT — confirm", "Wed 06:00"])
actionsRow = Card([viewDayCard, incidentCard, transferCard], "clear", "row", "l")
viewDayCard = Card([dayTitle, dayPick, dayButtons], "sunk", "column", "s")
dayTitle = Heading("Look at another day", "h3")
dayPick = DatePicker("view_date", "single")
dayButtons = Buttons([prevDayBtn, nextDayBtn, todayBtn])
prevDayBtn = Button("← Previous day")
nextDayBtn = Button("Next day →")
todayBtn = Button("Today", null, "secondary")
incidentCard = Card([incidentTitle, incidentForm], "sunk", "column", "s")
incidentTitle = Heading("File an incident", "h3")
incidentForm = Form("incident-report", incidentButtons, [incTypeField, incLocField, incSeverityField, incDescField])
incTypeField = FormControl("Incident type", incTypeSelect)
incTypeSelect = Select("incident_type", [incFall, incMedErr, incEquip, incViolence], "Select type")
incFall = SelectItem("fall", "Patient fall")
incMedErr = SelectItem("med_error", "Medication error")
incEquip = SelectItem("equipment", "Equipment failure")
incViolence = SelectItem("violence", "Workplace violence")
incLocField = FormControl("Location", incLocInput)
incLocInput = Input("location", "e.g. ER bay 6, OR 2")
incSeverityField = FormControl("Severity", incSeverityRadio)
incSeverityRadio = RadioGroup("severity", [sevLow, sevMed, sevHigh], "medium")
sevLow = RadioItem("Low", "No patient harm", "low")
sevMed = RadioItem("Medium", "Minor or no lasting harm", "medium")
sevHigh = RadioItem("High", "Serious harm — page supervisor", "high")
incDescField = FormControl("Description", incDescArea, "Who was involved, what happened, witnesses")
incDescArea = TextArea("description", "Describe the incident…", 4)
incidentButtons = Buttons([incidentSubmit])
incidentSubmit = Button("Submit incident", null, "primary")
transferCard = Card([transferTitle, transferForm], "sunk", "column", "s")
transferTitle = Heading("Request a patient transfer", "h3")
transferForm = Form("transfer-request", transferButtons, [trPatientField, trDestField, trReasonField])
trPatientField = FormControl("Patient", trPatientSelect)
trPatientSelect = Select("patient", [trPat1, trPat2, trPat3], "Select patient")
trPat1 = SelectItem("a-brooks", "A. Brooks — Room 318")
trPat2 = SelectItem("l-nguyen", "L. Nguyen — Room 205")
trPat3 = SelectItem("g-patel", "G. Patel — Room 402")
trDestField = FormControl("Destination unit", trDestSelect)
trDestSelect = Select("destination", [trDestICU, trDestCardio, trDestTele], "Select unit")
trDestICU = SelectItem("icu", "ICU")
trDestCardio = SelectItem("cardiology", "Cardiology")
trDestTele = SelectItem("telemetry", "Telemetry")
trReasonField = FormControl("Reason for transfer", trReasonArea, "e.g. step-down, escalation of care")
trReasonArea = TextArea("transfer_reason", "Reason for transfer…", 3)
transferButtons = Buttons([transferSubmit, transferCancel])
transferSubmit = Button("Request transfer", null, "primary")
transferCancel = Button("Cancel", null, "tertiary")
followup = FollowUpBlock([fu1, fu2, fu3])
fu1 = FollowUpItem("Show ICU bed availability")
fu2 = FollowUpItem("Who is on call tonight?")
fu3 = FollowUpItem("Summarize yesterday's incidents")