Accessing submitted answers' text over web service

Accessing submitted answers' text over web service

by Urmas Hoogma -
Number of replies: 0

Hello 

I am currently improving an external question engine OUnit (based on Opaque protocol)

original: https://github.com/anttix/ounit

my version: https://github.com/uhoogma/ounit

that is being used to automatically test students' submissions to assignments in Java language, and I would like to add a function that would detect plagiarism attempts. Plagiarism detection is almost solved, but for numerous reasons (mainly because Opaque protocol severely limits sending data back to Moodle) this must be a system independent from OUnit, so I can not use questions that are sent to OUnit for testing. But I need this data so I must be able to fetch students' submissions directly from Moodle. Following query would give all the data I need:

SELECT

    u.firstname,

    u.lastname,

    quiza.userid as user_id,

    quiza.id as attempt_id,

    qasd.value

FROM mdl_quiz_attempts quiza

JOIN mdl_quiz q ON q.id=quiza.quiz

JOIN mdl_question_usages qu ON qu.id = quiza.uniqueid

JOIN mdl_question_attempts qa ON qa.questionusageid = qu.id

JOIN mdl_question que ON que.id = qa.questionid

JOIN mdl_user u ON u.id = quiza.userid

JOIN mdl_question_attempt_steps qas ON qas.questionattemptid = qa.id

JOIN mdl_question_attempt_step_data qasd ON qasd.attemptstepid = qas.id

WHERE que.id = 13

AND qasd.name = "questiondiv:editors:0:editorarea" -- OUnit's codeeditor

AND qas.state = "gradedright"

ORDER BY quiza.userid, quiza.id

And here you can see the resulting dataset:

sql query results

Could such a result be achieved using Moodle Web Services? 

I found a proposal

https://docs.moodle.org/dev/Quiz_web_services and function

get_questions_by_quiz(format, quiz_id [, load_attempt [, user_id [, summary_view ]]])

would probably give the results I want, but this web service is not currently developed. Is there anything similar?

As a last resort I could fetch results from Moodle's user interface using Selenium Webdrivers, which would be slower (at least 2-3 seconds per attempt) but viable solution as I only need to fetch an attempt once, and only ~1000 new attempts are added per year. Are there any limitations for using Selenium Web drivers on Moodle (for example, certain browsers are not allowed)?

Urmas Hoogma,

student at the The Estonian Information Technology College

Average of ratings: -