root = Card([header, kpiRow, chartsRow, criticalSection, dischargeSection, orSection, suppliesSection, actionsSection, dateSelector, followUps])
header = CardHeader("Hospital Operations Command Center", "Real-time capacity, flow & safety overview — updated live")
kpiRow = SnippetCardBlock([kpiBeds, kpiEr, kpiAdmissions, kpiStaff], "grid", true)
kpiBeds = SnippetCardItem("beds", kpiBedsLhs, kpiBedsRhs)
kpiBedsLhs = IconText(kpiBedsIcon, "neutral", "l", "Bed Occupancy", "312 of 380 licensed beds", false, "horizontal")
kpiBedsIcon = Icon("bed", "medical")
kpiBedsRhs = BoldText("number", "82.1%", "+3.2% vs yesterday", "metric")
kpiEr = SnippetCardItem("er-wait", kpiErLhs, kpiErRhs)
kpiErLhs = IconText(kpiErIcon, "warning", "l", "Current ER Wait", "Door-to-provider median", false, "horizontal")
kpiErIcon = Icon("clock", "time")
kpiErRhs = BoldText("number", "47 min", "Target < 30 min", "metric")
kpiAdmissions = SnippetCardItem("admissions", kpiAdmLhs, kpiAdmRhs)
kpiAdmLhs = IconText(kpiAdmIcon, "neutral", "l", "Admissions (14d)", "Rolling two-week total", false, "horizontal")
kpiAdmIcon = Icon("user-plus", "people")
kpiAdmRhs = BoldText("number", "1,247", "+8.4% vs prior 14d", "metric")
kpiStaff = SnippetCardItem("staff", kpiStaffLhs, kpiStaffRhs)
kpiStaffLhs = IconText(kpiStaffIcon, "success", "l", "Staff On Shift", "247 clinical / 89 support", false, "horizontal")
kpiStaffIcon = Icon("users", "people")
kpiStaffRhs = BoldText("number", "336 total", "94% fill rate", "metric")
chartsRow = SectionBlock([secAdmissions, secDepts], false)
secAdmissions = SectionItem("admissions-chart", "Admissions — Last 14 Days", [admissionsChart])
admissionsChart = LineChart(admLabels, [admSeries], "natural", "Date", "Admissions")
admLabels = ["May 26", "May 27", "May 28", "May 29", "May 30", "May 31", "Jun 1", "Jun 2", "Jun 3", "Jun 4", "Jun 5", "Jun 6", "Jun 7", "Jun 8"]
admSeries = Series("Daily Admissions", [78, 82, 91, 85, 94, 76, 68, 89, 93, 87, 95, 88, 92, 89])
secDepts = SectionItem("depts-chart", "Patients by Department", [deptsChart])
deptsChart = HorizontalBarChart(deptLabels, [deptSeries], "grouped", "Patient Count", "Department")
deptLabels = ["Med-Surg", "ICU", "Emergency", "Cardiology", "Orthopedics", "Oncology", "Pediatrics", "OB/GYN", "Psychiatry", "Neurology"]
deptSeries = Series("Current Census", [68, 24, 41, 32, 28, 19, 15, 12, 8, 7])
criticalSection = SectionBlock([secCritical], false)
secCritical = SectionItem("critical", "Critical Patients — Active Alerts", [criticalList])
criticalList = ListBlock([crit1, crit2, crit3, crit4], "number", "default")
crit1 = ListItem("Room 312 — MRN 884721", "Septic shock, on norepinephrine, lactate 5.2 → 3.8, ICU bed 4", null, "Escalate", { type: "continue_conversation", context: "Escalate critical patient Room 312 MRN 884721 to charge nurse and intensivist" })
crit2 = ListItem("Room 205 — MRN 910334", "Post-op bleed, Hb 6.8, 2 units PRBC transfused, OR on standby", null, "Escalate", { type: "continue_conversation", context: "Escalate critical patient Room 205 MRN 910334 for possible return to OR" })
crit3 = ListItem("ER Bay 3 — MRN 772109", "STEMI, door-to-balloon 42 min, cath lab activated, ETA 8 min", null, "Escalate", { type: "continue_conversation", context: "Track STEMI patient ER Bay 3 MRN 772109 through cath lab" })
crit4 = ListItem("Room 418 — MRN 665432", "Status epilepticus, 2nd line meds given, EEG monitoring, neuro consult", null, "Escalate", { type: "continue_conversation", context: "Escalate status epilepticus patient Room 418 MRN 665432 to neurology attending" })
dischargeSection = SectionBlock([secDischarge], false)
secDischarge = SectionItem("discharge", "Patients Ready for Discharge (Barriers Noted)", [dischargeList])
dischargeList = ListBlock([disch1, disch2, disch3, disch4, disch5], "number", "default")
disch1 = ListItem("Room 308 — MRN 552118", "Med-Surg · Pneumonia resolved · Barrier: Home health referral pending", null, "Resolve", { type: "continue_conversation", context: "Resolve discharge barrier for Room 308 MRN 552118 — contact home health agency" })
disch2 = ListItem("Room 221 — MRN 441990", "Cardiology · Post-cath stable · Barrier: Transport arranged for 14:00", null, "Resolve", { type: "continue_conversation", context: "Confirm transport for Room 221 MRN 441990 discharge at 14:00" })
disch3 = ListItem("Room 405 — MRN 338217", "Ortho · Post-op day 3 · Barrier: PT clearance received, awaiting pharmacy", null, "Resolve", { type: "continue_conversation", context: "Expedite pharmacy for Room 405 MRN 338217 discharge meds" })
disch4 = ListItem("Room 112 — MRN 229045", "Oncology · Chemo cycle complete · Barrier: PICC line removal scheduled 11:00", null, "Resolve", { type: "continue_conversation", context: "Confirm PICC removal for Room 112 MRN 229045 at 11:00" })
disch5 = ListItem("Room 501 — MRN 117834", "Neuro · TIA workup negative · Barrier: Neurology sign-off pending", null, "Resolve", { type: "continue_conversation", context: "Page neurology attending for Room 501 MRN 117834 discharge sign-off" })
orSection = SectionBlock([secOR], false)
secOR = SectionItem("or-bookings", "Today's Operating Room Bookings", [orTable])
orTable = Table([orColRoom, orColTime, orColProcedure, orColSurgeon, orColAnes, orColStatus])
orColRoom = Col("OR", ["OR 1", "OR 2", "OR 3", "OR 4", "OR 5", "OR 6", "OR 7", "OR 8"], "string")
orColTime = Col("Time", ["07:00–10:30", "07:30–11:00", "08:00–12:00", "09:00–13:30", "10:00–14:00", "11:00–15:00", "12:00–16:00", "13:00–17:00"], "string")
orColProcedure = Col("Procedure", ["CABG ×2", "Total Hip Arthroplasty", "Whipple Procedure", "Craniotomy (tumor)", "Laparoscopic Colectomy", "ACL Reconstruction", "Thyroidectomy", "Cataract ×3"], "string")
orColSurgeon = Col("Surgeon", ["Dr. Chen", "Dr. Patel", "Dr. Rodriguez", "Dr. Kim", "Dr. Okafor", "Dr. Sullivan", "Dr. Nguyen", "Dr. Gupta"], "string")
orColAnes = Col("Anesthesia", ["Dr. Brooks", "Dr. Lee", "Dr. Martinez", "Dr. Taylor", "Dr. Anderson", "Dr. White", "Dr. Harris", "Dr. Clark"], "string")
orColStatus = Col("Status", ["In Progress", "In Progress", "Pre-op", "Pre-op", "Scheduled", "Scheduled", "Scheduled", "Scheduled"], "string")
suppliesSection = SectionBlock([secSupplies], false)
secSupplies = SectionItem("supplies", "Supplies Running Low — Reorder Alerts", [suppliesTable])
suppliesTable = Table([supColItem, supColCurrent, supColPar, supColDays, supColAction])
supColItem = Col("Item", ["0.9% NaCl 1L bags", "D5W 500mL bags", "Enoxaparin 40mg syringes", "Piperacillin-tazobactam 4.5g", "N95 respirators (M)", "Surgical gloves (L)", "Foley catheters 16Fr", "Central line kits triple-lumen"], "string")
supColCurrent = Col("On Hand", [42, 38, 15, 22, 180, 240, 18, 8], "number")
supColPar = Col("Par Level", [120, 100, 50, 60, 500, 500, 40, 20], "number")
supColDays = Col("Days Supply", [1.2, 1.4, 1.8, 2.1, 2.0, 2.5, 2.4, 1.6], "number")
supColAction = Col("Action", ["URGENT reorder", "URGENT reorder", "Reorder placed", "Reorder placed", "URGENT reorder", "Reorder placed", "Reorder placed", "URGENT reorder"], "string")
actionsSection = SectionBlock([secIncident, secTransfer], false)
secIncident = SectionItem("incident", "File an Incident Report", [incidentForm])
incidentForm = Form("incident-report", incidentButtons, [fcIncType, fcIncLocation, fcIncDesc, fcIncSeverity, fcIncReporter])
incidentButtons = Buttons([btnIncSubmit, btnIncCancel], "row")
btnIncSubmit = Button("Submit Incident Report", { type: "continue_conversation", context: "Submit incident report with provided details for safety team review" }, "primary")
btnIncCancel = Button("Cancel", { type: "continue_conversation", context: "Cancel incident report form" }, "tertiary")
fcIncType = FormControl("Incident Type", incTypeSelect, "Select the category that best describes the event")
incTypeSelect = Select("incident-type", [it1, it2, it3, it4, it5, it6], "Choose incident type", { required: true })
it1 = SelectItem("fall", "Patient Fall")
it2 = SelectItem("med-error", "Medication Error")
it3 = SelectItem("equipment", "Equipment Failure")
it4 = SelectItem("pressure-injury", "Pressure Injury")
it5 = SelectItem("security", "Security / Workplace Violence")
it6 = SelectItem("other", "Other / Near Miss")
fcIncLocation = FormControl("Location", incLocInput, "Unit, room, or area (e.g., ICU Bed 4, ER Bay 2)")
incLocInput = Input("incident-location", "e.g., Med-Surg Room 308", "text", { required: true })
fcIncDesc = FormControl("Description", incDescArea, "Factual, concise description — what happened, when, who was involved")
incDescArea = TextArea("incident-description", "Describe the incident...", 4, { required: true, maxLength: 2000 })
fcIncSeverity = FormControl("Severity", incSevCards, "Select the highest applicable level")
incSevCards = OptionCards("incident-severity", "single", [sev1, sev2, sev3, sev4], { required: true })
sev1 = OptionCard("1-critical", "Level 1 — Critical", "Death or permanent harm", sev1icon)
sev1icon = Icon("alert-triangle", "alerts")
sev2 = OptionCard("2-major", "Level 2 — Major", "Significant harm, intervention required", sev2icon)
sev2icon = Icon("alert-circle", "alerts")
sev3 = OptionCard("3-moderate", "Level 3 — Moderate", "Treatment required, no lasting harm", sev3icon)
sev3icon = Icon("info", "alerts")
sev4 = OptionCard("4-minor", "Level 4 — Minor", "No harm, near miss or minor event", sev4icon)
sev4icon = Icon("circle-alert", "alerts")
fcIncReporter = FormControl("Your Role / Name", incReporterInput, "Optional — anonymous reports accepted")
incReporterInput = Input("incident-reporter", "Your name and role (optional)", "text")
secTransfer = SectionItem("transfer", "Request Patient Transfer", [transferForm])
transferForm = Form("patient-transfer", transferButtons, [fcTransMrn, fcTransFrom, fcTransTo, fcTransReason, fcTransUrgency, fcTransContact])
transferButtons = Buttons([btnTransSubmit, btnTransCancel], "row")
btnTransSubmit = Button("Request Transfer", { type: "continue_conversation", context: "Submit patient transfer request to bed management and receiving unit" }, "primary")
btnTransCancel = Button("Cancel", { type: "continue_conversation", context: "Cancel patient transfer request form" }, "tertiary")
fcTransMrn = FormControl("Patient MRN", transMrnInput, "Medical record number of the patient to transfer")
transMrnInput = Input("transfer-mrn", "e.g., 884721", "text", { required: true, pattern: "^[0-9]{6}$" })
fcTransFrom = FormControl("Current Location", transFromSelect, "Where is the patient right now?")
transFromSelect = Select("transfer-from", [tf1, tf2, tf3, tf4, tf5, tf6, tf7, tf8], "Select current unit", { required: true })
tf1 = SelectItem("er", "Emergency Department")
tf2 = SelectItem("icu", "ICU")
tf3 = SelectItem("med-surg", "Med-Surg")
tf4 = SelectItem("stepdown", "Step-Down / IMU")
tf5 = SelectItem("tele", "Telemetry")
tf6 = SelectItem("peds", "Pediatrics")
tf7 = SelectItem("nicu", "NICU")
tf8 = SelectItem("or-pacu", "OR / PACU")
fcTransTo = FormControl("Requested Destination", transToSelect, "Where does the patient need to go?")
transToSelect = Select("transfer-to", [tt1, tt2, tt3, tt4, tt5, tt6, tt7, tt8, tt9], "Select destination unit", { required: true })
tt1 = SelectItem("icu", "ICU")
tt2 = SelectItem("stepdown", "Step-Down / IMU")
tt3 = SelectItem("med-surg", "Med-Surg")
tt4 = SelectItem("tele", "Telemetry")
tt5 = SelectItem("peds", "Pediatrics")
tt6 = SelectItem("nicu", "NICU")
tt7 = SelectItem("psych", "Psychiatry")
tt8 = SelectItem("rehab", "Inpatient Rehab")
tt9 = SelectItem("external", "External Facility")
fcTransReason = FormControl("Clinical Reason", transReasonArea, "Brief clinical justification for transfer")
transReasonArea = TextArea("transfer-reason", "Clinical reason for transfer...", 3, { required: true, maxLength: 1000 })
fcTransUrgency = FormControl("Urgency", transUrgChips, "How quickly does this transfer need to happen?")
transUrgChips = Chips("transfer-urgency", "single", [urg1, urg2, urg3], { required: true }, "routine")
urg1 = ChipItem("stat", "STAT — Immediate", urg1icon)
urg1icon = Icon("alert-triangle", "alerts")
urg2 = ChipItem("urgent", "Urgent — Within 1 hour", urg2icon)
urg2icon = Icon("clock", "time")
urg3 = ChipItem("routine", "Routine — Next available bed", urg3icon)
urg3icon = Icon("calendar", "time")
fcTransContact = FormControl("Requesting Provider", transContactInput, "Your name, role, and contact number")
transContactInput = Input("transfer-contact", "Dr. Smith, Hospitalist, pager 1234", "text", { required: true })
dateSelector = SectionBlock([secDate], false)
secDate = SectionItem("date-nav", "View Another Day", [dateForm])
dateForm = Form("date-selector", dateButtons, [fcDatePick])
dateButtons = Buttons([btnDateGo, btnDateToday], "row")
btnDateGo = Button("Load Selected Date", { type: "continue_conversation", context: "Load hospital operations dashboard for the selected date" }, "primary")
btnDateToday = Button("Back to Today", { type: "continue_conversation", context: "Return to today's hospital operations dashboard" }, "secondary")
fcDatePick = FormControl("Select Date", datePicker, "Choose a date to view historical or projected operations data")
datePicker = DatePicker("view-date", "single", { required: true })
followUps = FollowUpBlock([fu1, fu2, fu3, fu4])
fu1 = FollowUpItem("Show me the bed management dashboard")
fu2 = FollowUpItem("Alert the house supervisor about critical patients")
fu3 = FollowUpItem("Generate end-of-shift handoff report")
fu4 = FollowUpItem("Review staffing plan for tomorrow")