root = Card([header, kpis, onTimeChart, flightsSection, delaysCallout, gateChanges, crewsSection, weatherSection, connectionsSection, rebookSection, hubSection, cancellationsSection, turnaroundSection], "card", "column", "l")
header = CardHeader("Hub Operations Desk", "Live status for hub KATL — Atlanta")
kpis = Card([kpiTitle, kpiTable], "sunk")
kpiTitle = Heading("Today at a glance", "h3")
kpiTable = Table([kpiMetric, kpiValue])
kpiMetric = Col("Metric", ["On-time performance", "Avg passenger load", "Avg turnaround time", "Cancellations"])
kpiValue = Col("Value", ["87.4%", "82%", "42 min", "6"])
onTimeChart = Card([onTimeTitle, onTimeLine], "sunk")
onTimeTitle = Heading("On-time performance today", "h3")
onTimeLine = LineChart(["06:00", "08:00", "10:00", "12:00", "14:00", "16:00", "18:00", "20:00"], [onTimeSeries], "linear", "Time", "% on-time")
onTimeSeries = Series("On-time %", [78, 84, 88, 90, 86, 89, 91, 87])
flightsSection = Card([flightsTitle, flightsTable], "sunk")
flightsTitle = Heading("Flights", "h3")
flightsTable = Table([flightNum, flightRoute, flightGate, flightStatus])
flightNum = Col("Flight", ["DL101", "DL204", "UA77", "AA318", "DL455", "WN902", "BA118", "AF66"])
flightRoute = Col("Route", ["ATL–LHR", "ATL–LAX", "ATL–ORD", "ATL–MIA", "ATL–SFO", "ATL–DFW", "ATL–JFK", "ATL–CDG"])
flightGate = Col("Gate", ["B12", "C34", "A08", "B27", "D11", "C05", "E19", "A22"])
flightStatus = Col("Status", ["On time", "Delayed 35m", "On time", "Delayed 50m", "On time", "On time", "Delayed 20m", "On time"])
delaysCallout = Callout("warning", "Delayed flights", "UA77, AA318 and BA118 are delayed. AA318 (ATL–MIA) is now departing Gate B27 at 14:50.")
gateChanges = Card([gateTitle, gateList], "sunk")
gateTitle = Heading("Recent gate changes", "h3")
gateList = ListBlock([gateItem1, gateItem2, gateItem3])
gateItem1 = ListItem("DL455", "ATL–SFO moved from D09 to D11")
gateItem2 = ListItem("WN902", "ATL–DFW moved from C02 to C05")
gateItem3 = ListItem("AF66", "ATL–CDG moved from A20 to A22")
crewsSection = Card([crewsTitle, crewsList], "sunk")
crewsTitle = Heading("Crews available for reassignment", "h3")
crewsList = ListBlock([crew1, crew2, crew3, crew4])
crew1 = ListItem("Crew 214", "4 pilots, 8 flight attendants — free until 18:00")
crew2 = ListItem("Crew 307", "2 pilots, 6 flight attendants — free until 20:00")
crew3 = ListItem("Crew 112", "3 pilots, 5 flight attendants — free until 16:30")
crew4 = ListItem("Crew 450", "2 pilots, 4 flight attendants — free until 22:00")
weatherSection = Card([weatherTitle, weatherCallouts], "sunk")
weatherTitle = Heading("Weather advisories at hub", "h3")
weatherCallouts = Card([weatherInfo, weatherWarning], "clear", "column", "s")
weatherInfo = TextCallout("info", "Thunderstorms", "Scattered storms near ATL 15:00–18:00, possible ground stops.")
weatherWarning = TextCallout("warning", "Wind advisory", "Crosswinds 25–30 kt on runways 8L/26R until 21:00.")
connectionsSection = Card([connTitle, connTable], "sunk")
connTitle = Heading("Connections at risk", "h3")
connTable = Table([connFlight, connRoute, connRisk])
connFlight = Col("Flight", ["DL101", "AA318", "BA118"])
connRoute = Col("Route", ["ATL–LHR", "ATL–MIA", "ATL–JFK"])
connRisk = Col("Risk", ["High — 25 min layover", "High — 20 min layover", "Medium — 40 min layover"])
rebookSection = Card([rebookTitle, rebookText, rebookButtons], "sunk")
rebookTitle = Heading("Rebook affected passengers", "h3")
rebookText = TextContent("Identify passengers on delayed flights with missed connections and move them to the next available departure.", "default")
rebookButtons = Buttons([rebookBtn, reviewBtn])
rebookBtn = Button("Rebook affected passengers", null, "primary")
reviewBtn = Button("Review connection list", null, "secondary")
hubSection = Card([hubTitle, hubText, hubButtons], "sunk")
hubTitle = Heading("Switch hub", "h3")
hubText = TextContent("Select a different hub to view its operations desk.", "default")
hubButtons = Buttons([hubKORD, hubKDFW, hubKLAX])
hubKORD = Button("Chicago (KORD)")
hubKDFW = Button("Dallas (KDFW)")
hubKLAX = Button("Los Angeles (KLAX)")
cancellationsSection = Card([cancelTitle, cancelTable], "sunk")
cancelTitle = Heading("Cancellations today", "h3")
cancelTable = Table([cancelFlight, cancelRoute, cancelReason])
cancelFlight = Col("Flight", ["DL188", "UA340", "AA227", "WN615", "DL909", "BA777"])
cancelRoute = Col("Route", ["ATL–BOS", "ATL–SEA", "ATL–PHL", "ATL–DEN", "ATL–MSP", "ATL–LGW"])
cancelReason = Col("Reason", ["Crew shortage", "Weather", "Maintenance", "Weather", "Crew shortage", "Aircraft rotation"])
turnaroundSection = Card([turnTitle, turnChart], "sunk")
turnTitle = Heading("Average turnaround time", "h3")
turnChart = HorizontalBarChart(["DL101", "DL204", "UA77", "AA318", "DL455", "WN902"], [turnSeries], "grouped", "Minutes", "Flight")
turnSeries = Series("Turnaround (min)", [38, 45, 41, 52, 39, 44])