[LON-CAPA-users] cleaning up submissions for numerical response problems

Stuart Raeburn raeburn at msu.edu
Thu Dec 11 15:39:32 EST 2014


Hi,

> Any help or comments regarding any submission handling would be appreciated.

The CAPA engine which determines correctness of submissions for  
numericalresponse items (amongst others) tries its best to extract a  
number from data submitted by the student. However, LON-CAPA  
faithfully records the learner's actual submission.

Accordingly, it is possible, as you have found, for a student to  
provide some misshapen input in an initial part in a multi-part  
problem, which LON-CAPA grades as correct, but then when you come to  
use that submission in a perl script block for a subsequent part, it  
does not behave as you might expect.

See comment #3 in bug 6614 -- http://bugs.loncapa.org/show_bug.cgi?id=6614#c3

There are three related enhancement requests: 6609, 6613 and 6614 (all  
resolved in 2.11.0), with option (b) below.

Your options are:

(a) Include a preprocessor routine. (There is a problem template:  
"Numerical Response with Pre-Processing" which is an example of this  
functionality). The "preprocess" attribute was first included in  
LON-CAPA 2.10.1

or

(b) Retrieve the student's previously submitted data using  
&submission() in place of &EXT(), and specify desired clean-up in the  
optional fifth argument in the call to &submission(). This fifth  
argument is a reference to a hash, with one or more of the following  
keys => values:

   exponent => 1, comma => 1, letterforzero => 1, spaces => 1, format => 'ns'
   (where n is an integer, i.e., number of significant digits).

An example call, where part id of first part is "one", and response ID of
numericalresponse in that part is "11" would be:

$first = &submission('one','11','','',{exponent => 1, comma => 1,  
letterforzero
=> 1, spaces => 1, format => '3s'});

with spaces => 1 included:

0. 44 in learner data would be converted to 0.44

This fifth argument in &submission() was first included in LON-CAPA 2.11.0.

If you want to try this out, but your library server is running  
2.10.1, visit: https://testdrive.loncapa.org/ and create a username  
and authoring space in the testdrive domain (not connected to the main  
LON-CAPA network) - running 2.11.0.

or

(c) Create your own clean-up routines (e.g., in a .library file) and  
import the file into your problems, and then within the script block  
call the routine you created to clean up the learner data.

or some combination of two or more of (a), (b), and (c).

Some time I ago I created a library file containing a routine:  
&cleaneq() which could be used to clean up algebraic expressions.   
This file is published source XML open, so select an author role, and  
then browse the /res/msu/raeburn/ directory in the shared repository  
with the "Source Available" checkbox checked, and you will be able to  
click on "Source Code" to pop-open a window displaying the perl  
regular expressions used in the cleaneq routine in the cleaneq.library  
file.


Stuart Raeburn
LON-CAPA Academic Consortium


Quoting Bob Gonzales <rgonzal at binghamton.edu>:

> Hi,
>
> I'd like to look at the code that Loncapa uses to clean up submissions in
> numerical response problems.  I'm referring to clean-up actions like
> converting exponents from '1x10^1' to '1e1' and removing leading '+' signs.
>
> We have some lab exercises in which we use the student's entered data  in
> some numerical response problems.  I'm getting the previously submitted
> data  via the &EXT() function.
>
> Every once in a while a student will submit their data with something  like
> a leading '+' sign, which Loncapa cleans up, and the data is accepted as
> correct.  So, it would be good for me to do the same clean up before I use
> the submission.
>
> I've looked around in the system and I see some cleanup in the
> 'implicit_multiplication' routine in 'caparesponse.pm'  but I'm not sure
> I'm even in the right place.
>
> Any help or comments regarding any submission handling would be appreciated.
>
> Thanks,
> Bob Gonzales
> Chemistry Dept
> Binghamton University



More information about the LON-CAPA-users mailing list