-
Notifications
You must be signed in to change notification settings - Fork 4
/
course_info.R
100 lines (87 loc) · 3.32 KB
/
course_info.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
######## Course info ########
library(tidyverse)
# Start of semester
start_semester <- "2024-07-22"
# Week of mid-semester break
mid_semester_break <- "2024-09-23"
# Schedule
schedule <- tribble(
~Week, ~Topic, ~Reference, ~Reference_URL,
1, "Basic communication theory and practice", "", "",
2, "Guest lecture: Narrative structure and reporting", "", "",
3, "Captivating statistical presentations", "", "",
4, "Data storytelling on the web", "", "", # Assignment 1 due
5, "Statistical model outputs and data tables", "", "",
6, "Effective data visualisation", "", "",
7, "Introduction to web technologies and styling", "", "", # Assignment 2 due
8, "R packages and documentation", "", "",
9, "Communicating data with interactive web apps", "", "",
10, "Automated systems for code communication", "", "", # Assignment 3 due
11, "Guest lecture: Communicating risk in a natural disaster", "", "",
12, "Course recap", "", "", # Assignment 4 due in Week 13
)
# Assignment 1: Breaking down published articles
# Assignment 2: Writing their own article then breaking it down
# Assignment 3: Creating a blog including styling and content
# Assignment 4: Turning their article into a dashboard + reflection
# Add mid-semester break
calendar <- tibble(
Date = seq(as.Date(start_semester), by = "1 week", length.out = 13)
) |>
mutate(
Week = row_number(),
Week = if_else(Date < mid_semester_break, Week, Week - 1),
# Week =
)
# Add calendar to schedule
schedule <- schedule |>
left_join(calendar, by = "Week") |>
mutate(
Week = if_else(Date == mid_semester_break, NA, Week),
Topic = if_else(Date == mid_semester_break, "Mid-semester break", Topic),
# Reference = if_else(Date == mid_semester_break, NA, Reference),
# Reference_URL = if_else(Date == mid_semester_break, NA, Reference_URL)
) |>
select(Week, Date, everything())
# Add assignment details
lastmon <- function(x) {
7 * floor(as.numeric(x - 1 + 4) / 7) + as.Date(1 - 4, origin = "1970-01-01")
}
assignments <- read_csv(here::here("assignments.csv")) |>
mutate(
Date = lastmon(Due),
Moodle = paste0("https://learning.monash.edu/mod/assign/view.php?id=", Moodle),
File = paste0("assignments/", File)
)
schedule <- schedule |>
full_join(assignments, by = "Date") |>
mutate(Week = if_else(is.na(Week) & Date > "2024-05-20", 13, Week))
show_assignments <- function(week) {
ass <- schedule |>
filter(
Week >= week & (week > Week - 3 | week > 8),
!is.na(Assignment),
) |>
select(Assignment:File)
if (NROW(ass) > 0) {
cat("\n\n## Assignments\n\n")
for (i in seq(NROW(ass))) {
cat("* [", ass$Assignment[i], "](../", ass$File[i], ") is due on ",
format(ass$Due[i], "%A %d %B.\n"),
sep = ""
)
}
}
}
submit <- function(schedule, assignment) {
ass <- schedule |>
filter(Assignment == assignment)
due <- format(ass$Due, "%e %B %Y") |> stringr::str_trim()
url <- ass$Moodle
button <- paste0(
"<br><br><hr><b>Due: ", due, "</b><br>",
"<a href=", url, " class = 'badge badge-large badge-blue'>",
"<font size='+2'> <b>Submit</b> </font><br></a>"
)
cat(button)
}