1

I use the following to create a D2L exam from the "capital.Rmd" example (I converted the question to schoice)

exams2blackboard("capitals.Rmd", n =3, name = "testquiz" )

After I upload the testquiz.zip file, I notice that the correct answer must be manually chosen on the D2L platform.

I was wondering if there is a workaround.

Many Thanks,

Umut

Umut
  • 87
  • 6
  • There have been some recent changes in `exams2blackboard` which may have affected the behavior when importing into D2L. Did you try this with the current CRAN release version of R/exams (2.3-6) or the current development version on R-Forge (2.4-0)? Do both lead to the same problems in D2L? The R-Forge version can be installed via: `install.packages("exams", repos = "http://R-Forge.R-project.org")` – Achim Zeileis Jan 17 '21 at 00:16
  • I tried it with both versions. Same behaviour. – Umut Jan 17 '21 at 13:21
  • OK, thanks for checking. I'm not sure how to proceed, does D2L have an option to re-export the exercise in (zipped) XML format? If so: You could try to import a question, edit it in D2L by manually choosing the correct answer, and then re-export the (zipped) XML. Maybe that will tell us which XML tag is missing or needs to be modified. – Achim Zeileis Jan 18 '21 at 01:44
  • Thank you. I will check if tests are exportable to XML. Another venue I was thinking of is CSV. D2L provides CSV templates. If R/exams could export to CSV it'd be very transparent what is going on. – Umut Jan 18 '21 at 13:04
  • I've written a prototype function for that. It works ok for simple text-based questions. However, for questions with more formatting (graphics, math, code) it did not. I'm collecting all of this in a new answer now. This will not be a complete answer to your problem but at least provide you with some hints where to continue... – Achim Zeileis Jan 19 '21 at 02:04

2 Answers2

1

If you want the correct solution to be selected, do not use the Import option from the Question Library or from the Quiz itself. Use the Import/Export/Copy Components under the Course Admin tab.

If you import the questions through the following steps, BrightSpace correctly picks the right solution. It’s a bit longer but seems to correctly choose the solution.

Under the Course Admin tab of your course, go to

  • 'Import/Export/Copy Components' -> ‘Import Components’ -> Start -> (drag and drop the ZIP file)

    Choose Import

  • Click ‘Advanced Options…’

    Drop file, then click on Advanced Options...

    This step will take a few minutes for large files; if you do not click Advanced Options, then the import will automatically import the questions into the 'Question Library' and will generate a Quiz with the imported questions; you do not want this.

    This step will take a few minutes for large ZIPs

  • -> Continue -> Continue -> at this point choose 'Question Library' from the section 'Select Components to Import'

    Do not choose 'Quizzes' because it auto-creates a quiz with ALL questions

    I would not choose ‘Quizzes’ because it automatically creates a quiz and makes it available to students. It has the unfortunate side-effect of making ALL the questions available, which means all the versions of various dynamic questions; this is not something we want.

  • -> Continue -> Continue. This stage takes a few minutes for large imports.

    Correct option selected (note that plots have not imported though; still trying to figure out why)

Now the Questions are available in the Question Library and can be used to generate new quizzes. Each question has the correct answer selected already. This works for ‘schoice’ and ‘mchoice’ versions of questions. Currently, plots are not imported, though, still trying to figure out why.

Achim Zeileis
  • 15,710
  • 1
  • 39
  • 49
  • 1
    Brilliant! This worked for me. Thank you. The downside is that it takes much longer than manually choosing the correct answer. – Umut Feb 11 '21 at 18:48
  • Hi Umut. This may take longer for 1 question, but when I imported 1200 questions for 1 midterm (60 questions, 20 iterations of each question), this is significantly faster. – BrightSpace user Feb 12 '21 at 19:35
  • Great! I really appreciate your help. This will make my life so much easier. – Umut Feb 13 '21 at 21:00
  • By the way, Umut. If you decide to use plots in your tests, I have found a workable solution as well. It relies on using the 'base64' option. Line that I use: exams2blackboard(questions, n = iterations, edir = edir, name=name1, dir=dir, converter='pandoc-mathml',base64 = c("png", "rda"),verbose = T) The 'base64' option replaces creation of files and folders and instead creates a plot as a base64-encoded vector. Check out some examples here: https://community.brightspace.com/s/question/0D55W000001AfSw/importing-blackboard-quiz-questions-generated-via-rexams?t=1613230923582 – BrightSpace user Feb 13 '21 at 23:41
  • Fantastic! I do use graphs. Thank you again. – Umut Feb 15 '21 at 15:48
0

This problem is new to me. In earlier versions of Brightspace/D2L the import of single-choice and multiple-choice exercises via exams2blackboard() worked well. Possibly, D2L changed in the meantime given that neither the current release version from CRAN nor the development version from R-Forge work for you.

D2L also supports other import formats and we did play around with some of these. See the following discussions in the R/exams forum on R-Forge:

Notably we tried to use the XML-based QTI 2.1 format that seems to be employed by D2L internally. However, D2L apparently uses a particular custom flavor of QTI 2.1. It should be possible to reverse engineer that and improve exams2qti21() correspondingly but so far (to the best of my knowledge) no one put the time and effort into this that would be needed.

For simple single/multiple choice questions a CSV-based exchange format can also be used. I have put together a very basic exams2d2l() function that was posted in the threads above and that I'm also including below. It can set up the CSV file for a single exercise like the capitals.Rmd exercise that you use above. For plain text exercises like that it seems to work well but not for more complex elements (graphics, code, math, etc.).

exams2d2l <- function(file, dir = ".", ## n = 1L, nsamp = NULL disabled for now
  name = NULL, quiet = TRUE, edir = NULL, tdir = NULL, sdir = NULL, verbose = FALSE,
  resolution = 100, width = 4, height = 4, svg = FALSE,
  encoding = "", converter = NULL, ...)
{
  ## for Rnw exercises use "ttm" converter otherwise "pandoc" converter
  if(any(tolower(tools::file_ext(unlist(file))) == "rmd")) {
    if(is.null(converter)) converter <- "pandoc"
  } else {
    if(is.null(converter)) converter <- "ttm"
  }

  ## output directory or display on the fly
  ## output name processing 
  if(is.null(name)) name <- tools::file_path_sans_ext(basename(file))
  
  ## set up .html transformer and writer function
  htmltransform <- make_exercise_transform_html(converter = converter, ...)

  ## create exam with HTML text
  rval <- xexams(file,
    driver = list(sweave = list(quiet = quiet, pdf = FALSE, png = !svg, svg = svg,
      resolution = resolution, width = width, height = height, encoding = encoding),
      read = NULL, transform = htmltransform, write = NULL),
    dir = dir, edir = edir, tdir = tdir, sdir = sdir, verbose = verbose)

  ## currently: only a single exercise
  rval <- rval[[1L]][[1L]]

  ## put together CSV
  cleanup <- function(x) gsub('"', '""', paste(x, collapse = "\n"), fixed = TRUE)
  rval <- c(
    'NewQuestion,MC,,,',
    sprintf('ID,"%s",,,', cleanup(rval$metainfo$file)),
    sprintf('Title,"%s",,,', cleanup(rval$metainfo$name)),
    sprintf('QuestionText,"%s",,,', cleanup(rval$question)),
    sprintf('Points,%s,,,', if(is.null(rval$metainfo$points)) 1 else rval$metainfo$points),
    'Difficulty,1,,,',
    'Image,,,,',
    paste0('Option,', ifelse(rval$metainfo$solution, 100, 0), ',"', cleanup(rval$questionlist), '",,"', cleanup(rval$solutionlist), '"'),
    'Hint,,,,',
    sprintf('Feedback,"%s",,,', cleanup(rval$solution))
  )
  writeLines(rval, file.path(dir, paste0(name, ".csv")))
  invisible(rval)
}
Achim Zeileis
  • 15,710
  • 1
  • 39
  • 49
  • 1
    Thank you so much. `exams2d2l()` selects the correct answer, although now all answers appear in each answer option. I will dig into your code and report back if I can make it work for me. Thank you again. – Umut Jan 20 '21 at 13:02