## Forum archive 2000-2006

### Jason Farmer - Mining Data

by Arnold Pizer -
Number of replies: 0
 Mining Data topic started 11/3/2002; 2:05:35 PMlast post 11/6/2002; 5:28:21 AM
 Jason Farmer - Mining Data  11/3/2002; 2:05:35 PM (reads: 1250, responses: 6) Hello all! I have been searching for a while to see where the answers submitted by a student are actually stored. I have a feeling that they must be stored somewhere inside the "Courses" directory in order for them to be re-displayed in the future if a student wants to see previous answers. Could someone clue me in as to where or even if this data can be found? If so, can it be read by a text viewer? Thanks! Jason <| Post or View Comments |>

 Arnold K. Pizer - Re: Mining Data  11/4/2002; 2:28:54 AM (reads: 1434, responses: 0) Hi Jason, There are three ways to mine data. The easiest is to just view the student's submitted answers. As a professor go to the prof page, item 3, and click on the student. The second way is the one you mention. The most recent student answer is saved in the main database, e.g. mth100_webwork_DB. This file is located in e.g. mth100/DATA/. The answers are encoded to protect special characters and so that they correspond to the correct answer_rule in a multi-part question. The answers can be accessed by the getProblemStudentAnswer function. For example near line 225 of processProblem8.pl, you will find: # If answers have not been submitted and previous answers have been saved, patch them in unless ($answers_submitted or !$show_old_answers) { my $student_answers = getProblemStudentAnswer($probNum,$psvn); if (defined$student_answers) { my $rh_answer_hash = decode_submitted_answers($student_answers); my %answer_hash = %$rh_answer_hash; my ($label, $value); foreach$label (keys %answer_hash) {$inputs{$label} = $answer_hash{$label};} } } You could write your own script to display answers. Of course, for a general application these answers would probably be meaningless if displayed independently from the problem. So usually the first method would be more useful. The third way to mine data is to set \$logAccessData = 1; in Global.pm or (for a single course in webworkCourse.ph). This will cause everything a student does to be recorded and saved in the access_log with the exception that student's passwords are not saved. Thus for example all student answers will be recored and saved. The access file will become huge and we have not writen scripts to mine it, but if you want, all the data is there. For example you could trace all the answers a student submits in progressing to the correct answer. Arnie <| Post or View Comments |>

 Bill Ziemer - Re: Mining Data  11/4/2002; 3:48:58 AM (reads: 1427, responses: 0) If you do the logAccessData approach, I have written a script to extract data. In http://www.csulb.edu/%7Ewziemer/webworkTools.html Extract Answers from Webwork Logfile. Syntax: getAnswersFromLog.pl courseID userName problemNumber setName Example: getAnswersFromLog.pl demoCourse jdoe 6 Week1 If no arguments are supplied, it will prompt the user for them. <| Post or View Comments |>

 Jason Farmer - Re: Mining Data  11/4/2002; 7:14:24 AM (reads: 1403, responses: 0) Great!! Thanks guys! That is exactly what I needed! Take care, Jason <| Post or View Comments |>

 Jason Farmer - Re: Mining Data  11/5/2002; 8:45:00 AM (reads: 1427, responses: 0) Bill, I tried your script but I am getting several errors. I double checked all of my paths at the top of the script and all are correct. I haven't changed anything else either. Any ideas? Thanks! Errors: Uncaught exception from user code: Uncaught exception from user code: Uncaught exception from user code: Uncaught exception from user code: Uncaught exception from user code: Uncaught exception from user code: Can't locate webworkInit.pm in @INC (@INC contains: . /home/webwork2/webwork/system/lib /home/webwork2/local/lib/perl5/5.6.1/sun4-solaris /home/webwork2/local/lib/perl5/5.6.1 /home/webwork2/local/lib/perl5/site_perl/5.6.1/sun4-solaris /home/webwork2/local/lib/perl5/site_perl/5.6.1 /home/webwork2/local/lib/perl5/site_perl) at /home/webwork2/webwork/system/lib/PGtranslator.pm line 12. Global::BEGIN() called at webworkInit.pm line 12 eval {...} called at webworkInit.pm line 12 require PGtranslator.pm called at /home/webwork2/webwork/system/lib/Global.pm line 132 Global::BEGIN() called at webworkInit.pm line 12 eval {...} called at webworkInit.pm line 12 require Global.pm called at getAnswersFromLog.pl line 9 main::BEGIN() called at webworkInit.pm line 12 eval {...} called at webworkInit.pm line 12 BEGIN failed--compilation aborted at /home/webwork2/webwork/system/lib/PGtranslator.pm line 12. require PGtranslator.pm called at /home/webwork2/webwork/system/lib/Global.pm line 132 Global::BEGIN() called at /home/webwork2/webwork/system/lib/PGtranslator.pm line 12 eval {...} called at /home/webwork2/webwork/system/lib/PGtranslator.pm line 12 require Global.pm called at getAnswersFromLog.pl line 9 main::BEGIN() called at /home/webwork2/webwork/system/lib/PGtranslator.pm line 12 eval {...} called at /home/webwork2/webwork/system/lib/PGtranslator.pm line 12 Compilation failed in require at /home/webwork2/webwork/system/lib/Global.pm line 132. Global::BEGIN() called at /home/webwork2/webwork/system/lib/PGtranslator.pm line 132 eval {...} called at /home/webwork2/webwork/system/lib/PGtranslator.pm line 132 require Global.pm called at getAnswersFromLog.pl line 9 main::BEGIN() called at /home/webwork2/webwork/system/lib/PGtranslator.pm line 132 eval {...} called at /home/webwork2/webwork/system/lib/PGtranslator.pm line 132 BEGIN failed--compilation aborted at /home/webwork2/webwork/system/lib/Global.pm line 132. require Global.pm called at getAnswersFromLog.pl line 9 main::BEGIN() called at /home/webwork2/webwork/system/lib/Global.pm line 132 eval {...} called at /home/webwork2/webwork/system/lib/Global.pm line 132 Compilation failed in require at getAnswersFromLog.pl line 9. main::BEGIN() called at /home/webwork2/webwork/system/lib/Global.pm line 9 eval {...} called at /home/webwork2/webwork/system/lib/Global.pm line 9 BEGIN failed--compilation aborted at getAnswersFromLog.pl line 9. <| Post or View Comments |>

 Bill Ziemer - Re: Mining Data  11/6/2002; 4:00:54 AM (reads: 1445, responses: 0) webworkInit.pm is in the system/scripts directory (and other system subdirectories). I had the unwritten assumption that the script would be put there. Is that where you put it? <| Post or View Comments |>

 Jason Farmer - Re: Mining Data  11/6/2002; 5:28:21 AM (reads: 1406, responses: 0) No, that is not where I had originally put it. I moved it there and it works great! Thanks! <| Post or View Comments |>