Skip to contents

Reads a YAML or CSV-directory tracking configuration and registers courses, tutorials, students, and questions in the tracking database.

Usage

load_tracking_config(
  con,
  path,
  overwrite_questions = FALSE,
  timestamp = Sys.time()
)

Arguments

con

A DBI connection.

path

Path to a YAML file or a directory containing configuration CSV files.

overwrite_questions

If TRUE, replace existing registered questions for tutorials included in the configuration. If FALSE, upsert supplied questions and keep other registered questions.

timestamp

Creation timestamp for inserted rows. Defaults to Sys.time().

Value

A list with registered courses, tutorials, students, and questions tibbles.

Examples

config_dir <- tempfile()
dir.create(config_dir)
readr::write_csv(
  data.frame(course_id = "stat101"),
  file.path(config_dir, "courses.csv")
)

db_path <- tempfile(fileext = ".sqlite")
con <- init_tracking_db(db_path, overwrite = TRUE)
load_tracking_config(con, config_dir)
#> $courses
#> # A tibble: 1 × 4
#>   course_id course_label semester created_at          
#>   <chr>     <chr>        <chr>    <chr>               
#> 1 stat101   stat101      NA       2026-06-24T12:25:17Z
#> 
#> $tutorials
#> # A tibble: 0 × 5
#> # ℹ 5 variables: tutorial_id <chr>, course_id <chr>, tutorial_label <chr>,
#> #   version <chr>, created_at <chr>
#> 
#> $students
#> # A tibble: 0 × 5
#> # ℹ 5 variables: student_id <chr>, student_label <chr>, email <chr>,
#> #   group_id <chr>, created_at <chr>
#> 
#> $questions
#> # A tibble: 0 × 6
#> # ℹ 6 variables: question_id <chr>, tutorial_id <chr>, question_label <chr>,
#> #   question_type <chr>, max_score <dbl>, created_at <chr>
#> 
DBI::dbDisconnect(con)