retrieving number of pages of each exam

Added by S. McKay over 9 years ago

Hi,
If you've heard from me before, you know that I am working on a system that allows me to grade exams on my tablet. It works pretty well, but has some restrictions that I would like to overcome. One of the restrictions that I would like to relax is that all the exams must be the same number of pages. This is because I have written some software to split the pdf of scans into several pdfs, one for each page of the exam. That way I can grade one page at a time.

This means that I cannot randomize multiple choice questions, because that could possibly give different exams with different numbers of pages. (The free response section, the section I grade, is always the same number of pages so if I know how many pages are in the exam I can split off the part I need to grade). I am sure that somewhere in AMC is the information I need. In fact, I am sure even if I randomized the free response questions, as long as I had one question per page, it could tell me which page of which exam is that particular problem.

So, what I would like:
Some kind of association telling me what page question a is on for exam b.

What I could work with:
a list telling me the number of pages for each exam.

I'm sure AMC has both, but don't have any idea where to get them. I have perused the directory for a particular exam, but if this information is not in the database, I didn't recognize it. I can parse the second list from the log file, but that seems hard to me at first glance.

Anyway, I hope you can help me, but if not, I still have a working way to do what I want to do. It's just not that flexible.

Thanks,
S.M.


Replies (9)

RE: retrieving number of pages of each exam - Added by Alexis Bienvenüe over 9 years ago

You can get the pages for one given student number from the SQLite databases. See attached perl script as an example — it uses the subjectpageForStudent and subjectpageForStudentA SQL queries as defined in source:AMC-perl/AMC/DataModule/layout.pm.
To get the page where a particular question/answer box is located, look at the layout_box database (from the data/layout.sqlite SQLite file) to get the page inside the student's question sheet (and then layout_page database to get the corresponding page from the subject PDF file with all students' sheets if you need it).

RE: retrieving number of pages of each exam - Added by Alexis Bienvenüe over 9 years ago

I forgot the script…

getpages.pl - Perl script to get the pages corresponding to a particular student from the complete subject (593 Bytes)

RE: retrieving number of pages of each exam - Added by S. McKay over 9 years ago

Thanks! That gives me a place to start. This will tie my code more directly to AMC, so I guess I need to think about that ...
I have been splitting the pdf in a separate directory, but it makes sense to do it in the project directory also.

RE: retrieving number of pages of each exam - Added by Alexis Bienvenüe over 9 years ago

You can also force all subjects to have the same number of pages, calling one or more \clearpage at the end of each student copy if necessary (as does \AMCcleardoublepage).

RE: retrieving number of pages of each exam - Added by S. McKay over 9 years ago

Ok,
Thanks.

I guess I missed that command. I thought it was for answer sheets only. However, it is not clear it will entirely fix my problem. If the difference between sheets is only one page, it might work, but what happens when the short exam ends on an even page and some other exam needs an extra page? It seems I would still need to know the number of pages for each exam. Am I looking at this incorrectly?

RE: retrieving number of pages of each exam - Added by Alexis Bienvenüe over 9 years ago

I suggested to define another command, like AMCcleardoublepage, (say \AMCcompleteTo{n}), that adds blank pages at the end of short students sheets to give all students the same number n of pages. However, n has to be fixed manuallyat the beginning, depending on the subject (you can increase it if necessary after a first try). Perhaps this is posible to run LaTeX once to get the right value of n, and then run LaTeX again using this value as a parameter of \AMCcompleteTo, but this is more complicated to implement.

RE: retrieving number of pages of each exam - Added by S. McKay over 9 years ago

Ah. Got it. However, I prefer to figure out how to split based on the number of pages of the exam, rather than adding extra pages to some exams and not others. Thank you for your script. Its a good starting point.

I am handicapped a little by the fact that all of my scripts are in python and I don't really know perl, but maybe its time I did...

RE: retrieving number of pages of each exam - Added by Alexis Bienvenüe over 9 years ago

The perl script I provided uses only two SQL queries that you can find in the layout.pm perl file. You can use python to access the SQLite databases if you prefer.

RE: retrieving number of pages of each exam - Added by S. McKay over 9 years ago

Thank you.

I know this is delayed, but I appreciate the help. I was able to figure out how to use sqlite databases in python, and easily modified my script.

(1-9/9)