Skip to contents

Writes several CSV files for a tutorial: summary, students, attempts, scores, gradebook, questions, Moodle-ready grades, and Canvas Gradebook grades. The export can be filtered by registered group or by student.

Usage

export_tracking_bundle(
  con,
  path,
  tutorial_id,
  student_id = NULL,
  group_id = NULL,
  rule = c("last", "best", "first"),
  include_unregistered = TRUE,
  prefix = NULL
)

Arguments

con

A DBI connection.

path

Output directory. It is created if it does not exist.

tutorial_id

Tutorial identifier. Required.

student_id

Optional student identifier.

group_id

Optional registered student group identifier.

rule

Scoring rule passed to gradebook().

include_unregistered

If TRUE, include attempted questions that were not registered with register_questions().

prefix

Optional file prefix. Defaults to tutorial_id plus the selected group or student filter.

Value

A tibble with export table names and file paths, invisibly.

Examples

db_path <- tempfile(fileext = ".sqlite")
out_dir <- tempfile()
con <- init_tracking_db(db_path, overwrite = TRUE)
register_students(con, data.frame(student_id = "student_001", group_id = "A"))
#> # A tibble: 1 × 5
#>   student_id  student_label email group_id created_at          
#>   <chr>       <chr>         <chr> <chr>    <chr>               
#> 1 student_001 student_001   NA    A        2026-06-24T12:25:14Z
register_questions(con, "module_01", c("q1", "q2"))
#> # A tibble: 2 × 6
#>   question_id tutorial_id question_label question_type max_score created_at     
#>   <chr>       <chr>       <chr>          <chr>             <dbl> <chr>          
#> 1 q1          module_01   q1             NA                    1 2026-06-24T12:…
#> 2 q2          module_01   q2             NA                    1 2026-06-24T12:…
track_attempt(con, "student_001", "module_01", "q1", "mean(x)", score = 1, max_score = 1)
export_tracking_bundle(con, out_dir, tutorial_id = "module_01", group_id = "A")
DBI::dbDisconnect(con)