root = Card([header, statusRow, metrics, cohortFilter, cohortActions, topCourses, riskSection, engagementSection])
header = CardHeader("Learning Analytics", "Cohort performance overview")
statusRow = Card([statusTitle, statusValue], "sunk", "row", "m", "center")
statusTitle = TextContent("Active learners this week")
statusValue = TextContent("**1,284**", "large-heavy")
metrics = Card([completionMetric, quizMetric], "sunk", "row", "l")
completionMetric = Card([completionTitle, completionValue])
completionTitle = TextContent("Course completion rate")
completionValue = TextContent("**78%**", "large-heavy")
quizMetric = Card([quizTitle, quizValue])
quizTitle = TextContent("Average quiz score")
quizValue = TextContent("**86%**", "large-heavy")
cohortFilter = Card([cohortHeading, cohortSelect])
cohortHeading = Heading("Narrow to a cohort", "h3")
cohortSelect = Select("cohort", [cohortAll, cohortJan, cohortFeb, cohortMar], "Select a cohort", null, null, "medium")
cohortAll = SelectItem("all", "All cohorts")
cohortJan = SelectItem("jan", "January 2025")
cohortFeb = SelectItem("feb", "February 2025")
cohortMar = SelectItem("mar", "March 2025")
cohortActions = Buttons([messageCohortBtn, exportBtn])
messageCohortBtn = Button("Message this cohort", null, "primary")
exportBtn = Button("Export report", null, "secondary")
topCourses = Card([topHeading, courseTable])
topHeading = Heading("Courses ranked by enrollment", "h3")
courseTable = Table([courseCol, enrolledCol, completionCol])
courseCol = Col("Course", ["Python Fundamentals", "Data Analysis", "Machine Learning", "SQL for Analysts", "Web Development"])
enrolledCol = Col("Enrolled", [412, 356, 298, 245, 198])
completionCol = Col("Completion", ["81%", "74%", "69%", "77%", "63%"])
riskSection = Card([riskHeading, riskList])
riskHeading = Heading("Learners at risk of dropping out", "h3")
riskList = ListBlock([risk1, risk2, risk3, risk4])
risk1 = ListItem("Aisha Khan", "No activity in 14 days · quiz score 41%")
risk2 = ListItem("Marcus Reid", "Missed 3 consecutive assignments")
risk3 = ListItem("Sofia Alvarez", "Completion 22% · last login 10 days ago")
risk4 = ListItem("Daniel Park", "Quiz average 38% · low engagement")
engagementSection = Card([engagementHeading, engagementChart])
engagementHeading = Heading("Engagement across the past eight weeks", "h3")
engagementChart = AreaChart(["W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8"], [engagementSeries], "natural", "Week", "Active learners")
engagementSeries = Series("Active learners", [1120, 1180, 1240, 1210, 1290, 1330, 1284, 1356])