root = Card([header, cohortForm, separator, kpiHeading, kpiTable, completionProgress, separator, engagementHeader, engagementChart, separator, coursesHeader, coursesChart, separator, riskHeader, riskList], "card", "column", "l")
header = CardHeader("Training Platform Analytics", "Spring 2025 · updated just now")
cohortForm = Form("cohort-filter", formButtons, [cohortField])
cohortField = FormControl("Cohort", cohortSelect, "Narrow metrics to one cohort")
cohortSelect = Select("cohort", [cohortAll, cohortQ1, cohortQ2, cohortQ3], "Select a cohort")
cohortAll = SelectItem("all", "All cohorts")
cohortQ1 = SelectItem("q1", "Q1 2025")
cohortQ2 = SelectItem("q2", "Q2 2025")
cohortQ3 = SelectItem("q3", "Q3 2025")
formButtons = Buttons([applyBtn, messageBtn], "row")
applyBtn = Button("Apply", null, "secondary")
messageBtn = Button("Message cohort", null, "primary")
separator = Separator("horizontal")
kpiHeading = Heading("Key metrics", "h2")
kpiTable = Table([metricCol, valueCol])
metricCol = Col("Metric", ["Active learners this week", "Course completion rate", "Average quiz score"])
valueCol = Col("Value", ["1,248", "78%", "86%"])
completionProgress = Progress(78, "Course completion rate")
engagementHeader = CardHeader("Engagement", "Active learners and sessions, last 8 weeks")
engagementChart = AreaChart(["W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8"], [activeSeries, sessionSeries], "natural", "Week", "Learners")
activeSeries = Series("Active learners", [820, 930, 1080, 1190, 1105, 1250, 1330, 1248])
sessionSeries = Series("Sessions", [1460, 1625, 1890, 2140, 2050, 2310, 2480, 2310])
coursesHeader = CardHeader("Courses ranked by enrollment", "Active enrollees per course")
coursesChart = HorizontalBarChart(["Data Analytics Fundamentals", "Leadership Essentials", "Python for Business", "Cybersecurity Basics", "Project Management"], [enrollSeries], "grouped", "Enrollments", "Course")
enrollSeries = Series("Enrolled", [342, 289, 231, 178, 122])
riskHeader = CardHeader("Learners at risk of dropping out", "Low engagement or missed deadlines")
riskList = ListBlock([risk1, risk2, risk3], "number")
risk1 = ListItem("Maya Chen", "No activity for 14 days · Quiz score 41%")
risk2 = ListItem("Jordan Patel", "Missed 3 assignments · Quiz score 58%")
risk3 = ListItem("Alex Rivera", "34% course completion · behind on deadlines")