Skip to contents

Runs a compact set of consistency checks before using tracked tutorial data for a controlled pilot or LMS-oriented export. The checks focus on registered students, registered questions, unexpected learners, unregistered attempted questions, incomplete gradebook rows, and Moodle/Canvas export row consistency.

Usage

check_pilot_readiness(
  con,
  tutorial_id,
  group_id = NULL,
  rule = c("last", "best", "first"),
  include_unregistered = TRUE,
  require_attempts = FALSE,
  require_all_students_attempted = FALSE,
  stop_on_error = FALSE
)

Arguments

con

A DBI connection.

tutorial_id

Tutorial identifier. Required.

group_id

Optional registered student group identifier. If supplied, checks and export counts are scoped to that group.

rule

Scoring rule passed to gradebook() and export helpers.

include_unregistered

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

require_attempts

If TRUE, no recorded attempt in the selected scope is reported as an error. If FALSE, it is reported as a warning.

require_all_students_attempted

If TRUE, registered students without attempts in the selected scope are reported as an error. If FALSE, they are reported as a warning.

stop_on_error

If TRUE, throw an error when any check has status "error".

Value

A tibble with one row per check and columns check, status, n, message, and details.

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:11Z
register_questions(con, "module_01", "q1")
#> # A tibble: 1 × 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:…
track_attempt(con, "student_001", "module_01", "q1", "mean(x)", score = 1, max_score = 1)
check_pilot_readiness(con, tutorial_id = "module_01", group_id = "A")
#> # A tibble: 13 × 5
#>    check                      status     n message                       details
#>    <chr>                      <chr>  <int> <chr>                         <chr>  
#>  1 group_filter               ok         1 The selected group exists in… "A"    
#>  2 registered_students        ok         1 Registered students are avai… ""     
#>  3 registered_questions       ok         1 Registered questions are ava… ""     
#>  4 recorded_attempts          ok         1 Recorded attempts are availa… ""     
#>  5 unexpected_students        ok         0 All attempted student identi… ""     
#>  6 unregistered_questions     ok         0 All attempted questions in s… ""     
#>  7 students_without_attempts  ok         0 Every registered student in … ""     
#>  8 questions_without_attempts ok         0 Every registered question ha… ""     
#>  9 incomplete_gradebook_rows  ok         0 Every gradebook row is compl… ""     
#> 10 moodle_export_rows         ok         1 Moodle export row count is 1… ""     
#> 11 canvas_export_rows         ok         1 Canvas export row count is 1… ""     
#> 12 moodle_identifier_values   ok         0 Moodle identifier values are… ""     
#> 13 canvas_identifier_values   ok         0 Canvas SIS User ID values ar… ""     
DBI::dbDisconnect(con)