Skip to contents

Builds a set of export tables for a tutorial, optionally filtered to one registered group or one student.

Usage

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

Arguments

con

A DBI connection.

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().

Value

A list containing summary, students, attempts, scores, gradebook, questions, moodle_grades, and canvas_grades tibbles.

Examples

db_path <- tempfile(fileext = ".sqlite")
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:21Z
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)
tracking_export_data(con, tutorial_id = "module_01", group_id = "A")
#> $summary
#> # A tibble: 9 × 2
#>   metric           value      
#>   <chr>            <chr>      
#> 1 tutorial_id      "module_01"
#> 2 student_id       ""         
#> 3 group_id         "A"        
#> 4 n_students       "1"        
#> 5 n_attempts       "1"        
#> 6 n_scores         "1"        
#> 7 n_gradebook_rows "1"        
#> 8 n_questions      "2"        
#> 9 n_completed      "0"        
#> 
#> $students
#> # A tibble: 1 × 6
#>   student_id  student_label email group_id n_attempts has_attempts
#>   <chr>       <chr>         <chr> <chr>         <int> <lgl>       
#> 1 student_001 student_001   NA    A                 1 TRUE        
#> 
#> $attempts
#> # A tibble: 1 × 15
#>   student_id  student_label email group_id attempt_id session_id     tutorial_id
#>   <chr>       <chr>         <chr> <chr>         <int> <chr>          <chr>      
#> 1 student_001 student_001   NA    A                 1 session_stude… module_01  
#> # ℹ 8 more variables: question_id <chr>, attempt_number <int>,
#> #   submitted_answer <chr>, grade_status <chr>, score <dbl>, max_score <dbl>,
#> #   feedback <chr>, timestamp <chr>
#> 
#> $scores
#>    student_id student_label email group_id tutorial_id score max_score percent
#> 1 student_001   student_001  <NA>        A   module_01     1         1     100
#>   n_questions n_answered
#> 1           1          1
#> 
#> $gradebook
#> # A tibble: 1 × 12
#>   student_id  student_label email group_id tutorial_id score max_score percent
#>   <chr>       <chr>         <chr> <chr>    <chr>       <dbl>     <dbl>   <dbl>
#> 1 student_001 student_001   NA    A        module_01       1         2      50
#> # ℹ 4 more variables: n_questions <int>, n_answered <int>, n_unanswered <int>,
#> #   completed <lgl>
#> 
#> $questions
#> # 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:…
#> 
#> $moodle_grades
#> # A tibble: 1 × 2
#>   useridnumber module_01
#>   <chr>            <dbl>
#> 1 student_001         50
#> 
#> $canvas_grades
#> # A tibble: 1 × 6
#>   Student     ID    `SIS User ID` `SIS Login ID` Section module_01
#>   <chr>       <chr> <chr>         <chr>          <chr>       <dbl>
#> 1 student_001 ""    student_001   ""             A               1
#> 
DBI::dbDisconnect(con)