Subject: [LON-CAPA-dev] RFC: XML for <imageresponse> rewrite

From: Guy Albertelli II <[email-masked]>
Date: Mon, 10 Oct 2005 18:06:57 -0400 (EDT)

Hi All,

A design idea for the XML of a  multiclick/vector/line style problems.

I'm looking for opinions

Things that need support:

1) a way to specify multiple areas that need to be clicked on and
submitted as a single answer.

2) a ways to specfy vectors that
     a) need to point from something to something else
     b) need to have a certain angle/length

3) a way to spcify lines that connect something to something else

4) try to make it not exclude later extensions,

(This proposal ignores what the interface for specifying the correct
answer looks like, I'd like to get the XML design correct before the
pitched battle over how we get the student to specify what is correct
occurs)

It seems a wrapper tag of <answer> is at least needed, and some markup
about what style of answer is required should be added (<area>,
<vector>, <line>)

So the simplfied example template of:

<imageresponse max="1">
  <foilgroup>
    <foil name="foil1">
      <image>/res/adm/includes/templates/man1.jpg</image>
      <text>Click on an eye</text>
      <rectangle>(127,139)-(186,178)</rectangle>
      <rectangle>(242,139)-(306,183)</rectangle>
    </foil>
</imageresponse>

Should become:

<imageresponse max="1">
  <foilgroup>
    <foil name="foil1">
      <image>/res/adm/includes/templates/man1.jpg</image>
      <text>Click on an eye</text>
      <answer>
        <area>
          <rectangle>(127,139)-(186,178)</rectangle>
          <rectangle>(242,139)-(306,183)</rectangle>
        </area>
      </answer>
    </foil>
</imageresponse>

Thus specifying an answer of 1 click is needed (1 <area> exists), with
multiple locations of correctness (the 2 <rectangle>s)

Multiple clicks can be required by (2 <areas>, 1 of which has multiple
correct spots, 1 of which has only 1 correct spot):

<imageresponse max="1">
  <foilgroup>
    <foil>
      <image>/res/adm/includes/templates/man1.jpg</image>
      <text>Click on an eye and on the mouth</text>
      <answer>
        <area>
          <rectangle>(127,139)-(186,178)</rectangle>
          <rectangle>(242,139)-(306,183)</rectangle>
        </area>
        <area>
          <rectangle>(142,226)-(294,293)</rectangle>
       </area>
      </answer>
    </foil>
  </foilgroup>
</imageresponse>

We could also require the order of the clicks to matter (they must
make the first <area> 'click 1' and the second <area> 'click 2':

<answer ordered="yes">
  <area>
    <circle>(250,250,15)</circle>
  </area>
  <area>
    <circle>(500,500,15)</circle>
  </area>
</answer>

Onto vector answers, this example requires 3 vectors and 1 line as a
correct answer,

- vector 1 must origniate inside of the <from> <circle> and terminate
in the <to> circle

- vector 2 must originate in the <from> cirlce and terminate inside of
one of the <to> <circle>s

- line 1 must connect the <from> and <to> circles, but the order
doesn't matter

- vector 3 must exist and have a <angle> as specified (with a
tolerance of 3%) and a <length> as specified with a tolerance of 15
pixels

<answer ordered="yes">
  <vector type="location">
    <from>
      <circle>(250,250,15)</circle>
    </from>
    <to>
      <circle>(500,500,15)</circle>
    </to>
  </vector>
  <vector type="location">
    <from>
      <circle>(100,100,15)</circle>
    </from>
    <!-- either direction -->
    <to>
      <circle>(200,200,15)</circle>
      <circle>(0,0,15)</circle>
    </to>
  </vector>
  <!-- <line> uses <from> and <to> but doesn't actually care about
        order -->
  <line>
    <from>
      <circle>(100,100,15)</circle>
    </from>
    <to>
      <circle>(200,200,15)</circle>
    </to>
  </line>
  <vector type="locationless">
     <!-- radians also possible -->
     <angle unit="degrees" tolerance="3%">35</angle>
     <!-- other units % of image? If we go with the absolute
          measurement idea a unit of 'absolute' -->
     <length unit="pixel" tolerance="15">100</length>
  </vector>
</answer>

For simplying the amount typing, we could create a means to name
certain areas for easy reuse.

<answer>
  <hotspots>
    <circle name="circle1">(250,250,15)</circle>
    <rectangle name="rectangle1">(100,100)-(250,250)</rectangle>
    <polygon name="poly1">....</polygon>
  </hotspots>
  <vector>
    <from><hotspot>circle1</hotspot></from>
    <to><circle>(100,101,2)</circle></to>
  </vector>
  <area>
    <hotspot>poly1</hotspot>
  </area>
</answer>

I guess if I really want to go for the XML route it should be:
<circle>
  <x>250</x>
  <y>250</y>
  <radius>15</radius>
</circle>

etc for <rectangle> et al.

-- 
[email-masked]   0-7-2-1-27,137

---

From: Felicia Berryman <[email-masked]>
Date: Tue, 11 Oct 2005 10:31:35 -0400

Just some brainstorming....

how about <answer type="area"> or <answer type="vector">?  Maybe this 
would simplify things?

>I guess if I really want to go for the XML route it should be:

How about <circle x="250" y="250" radius ="15" />

For a vector we'd have something like:

<answer type="vector">
<circle x="250" y="250" radius ="15" name="mycircle" />
<rectangle x="0" y="100" name="myrectangle" />
<vector from="mycircle" to="myrectangle" />
</answer>

I know my style won't work for all of your example.  Just pick and 
choose what you think might work if you like it.  I was also wondering 
if <vector head="mycircle" tail="myrectangle" /> would be more appropriate.

Felicia

-- 
Felicia Berryman
LON-CAPA Support Coordinator
Michigan State University
Phone:  (517)432-9866
Technical Support Available at:
   http://www.loncapa.msu.edu - MSU Users
   http://www.help.lon-capa.org - General

---

From: Guy Albertelli II <[email-masked]>
Date: Tue, 11 Oct 2005 10:42:05 -0400 (EDT)

[ Charset ISO-8859-1 unsupported, converting... ]
> Just some brainstorming....

Seems to me you don't like the verbosity, and are willing to trade
some of the flexibility of the greater verbosity for a shorter
problem.

I personally am not concerned about verbosity too much as long as it
isn't superflous and the Edit mode has a reasonable interface.

> how about <answer type="area"> or <answer type="vector">?  Maybe this 

This means you would never want to mix a vector/click/line types of
clicking together.

> How about <circle x="250" y="250" radius ="15" />

Possibly, but with

<circle>
  <x unit="pixel">250</x>
  <y unit="percentage">30</y>
  <radius>15</radius>
</circle>

more flexbility is maintained.

> I know my style won't work for all of your example.

Which worries me, since my examples aren't really that complex.

> Just pick and

---

From: Gerd Kortemeyer <[email-masked]>
Date: Tue, 11 Oct 2005 17:21:26 -0400

Hi,

>           <rectangle>(242,139)-(306,183)</rectangle>

- so, this would not be compatible with old content?

>     <circle>(500,500,15)</circle>

I like this a lot - but it needs to accept leaving out <answer> if  
there is only one because of existing content.

I assume that all of these can be variable, e.g.,

<answer ordered="yes">
   <area>
     <circle>($x,$y,$r)</circle>
   </area>
   <area>
     <circle>(@circle)</circle>
   </area>
</answer>

- where @circle has all three.

> - line 1 must connect the <from> and <to> circles, but the order

Okay, I don't understand why this is tied to other objects. I would  
suggest

<vector>
<xlength unit="pixels">40</xlength>
<ylength unit="pixels">80</ylength>
</vector>

or

<vector>
<length unit="pixels">50</length>
<angle unit="radians">.34</angle>
</vector>

for vectors in cartesian or polar coordinates.

You might then add an origin if you want to tie to a certain location:

<vector>
<xinitial unit="pixels">30</xinitial>
<yinitialunit="pixels">60</yinitial>
<xlength unit="pixels">40</xlength>
<ylength unit="pixels">80</ylength>
</vector>

<vector>
<xinitial unit="pixels">30</xinitial>
<yinitial unit="pixels">30</yinitial>
<length unit="pixels">50</length>
<angle unit="radians">.34</angle>
</vector>

Finally, you could get the vector by giving its end point:

<vector>
<xinitial unit="pixels">30</xinitial>
<yinitial unit="pixels">60</yinitial>
<xfinal unit="pixels">80</xfinal>
<yfinal unit="pixels">90</yfinal>
</vector>

- as a physicist, I would actually like this less verbose XML-y, so I  
can plug in arrays:

<vector>
<initial unit="pixels">30,60</xinitial>
<final unit="pixels">@final</final>
</vector>

Or

<vector>
<length unit="pixels">40,$height</length>
</vector>

>      <length unit="pixel" tolerance="15">100</length>

I don't like the tolerance being packaged like that. We should use  
response parameters, just like with numerical.

>     <to><circle>(100,101,2)</circle></to>

I like, but again, I don't see the idea of tying this to objects.

How about named coordinates, which are internally treated like  

> I guess if I really want to go for the XML route it should be:

Hmmm ... I would like to plug in arrays.

- Gerd.

---

From: Guy Albertelli II <[email-masked]>
Date: Tue, 11 Oct 2005 18:01:27 -0400 (EDT)

Hey,

> - so, this would not be compatible with old content?

We could easily support existing content, no need to annoy people.

> there is only one because of existing content.

if answer exists -> new mechanism, if answer doesn't exist -> old
mechanism.

> - where @circle has all three.

Yes.

> Okay, I don't understand why this is tied to other objects. I would  

Some people don't want to draw a force diagram, they want an arrow
going from location 1 to location 2.

(For instance concept mapping.)

And as will already have areal specifiers (for click support anyway)
why not use this?

> for vectors in cartesian or polar coordinates.

These are proposed below as a second style of <vector>,
i.e. positionless vectors.

> <ylength unit="pixels">80</ylength>

How do you specify the tolerenceing on this? 

As a freaking huge mess and then you still can't easily do
circles/rectangles/polygons areas of correctness.

Really we do need to support connecting things together and I think
you would be hard pressed to find:

<vector>
  <xinitial unit="pixels">
    30
    <responseparam name="tolerance" type="tolerance" default="12" />
  </xinitial>
  <yinitial unit="pixels">
    60
    <responseparam name="tolerance" type="tolerance" default="12" />
  </yinitial>
  <xlength unit="pixels">
    40
    <responseparam name="tolerance" type="tolerance" default="12" />
  </xlength>
  <ylength unit="pixels">
    80
    <responseparam name="tolerance" type="tolerance" default="12" />
  </ylength>
</vector>

better than:

<vector>
  <from><circle>(30,60,12)</circle></from>
  <to><circle>(70,140,12)</circle></to>
</vector>

evening ignoring the fact that I can't even convey the circular area
of correctness using the <xinitial> etc. concept.

> response parameters, just like with numerical.

I'm open minded about this, but considering this mean ending up with

tolerance for partid_responseid_objectid_attributeid 

with little likelyhood that anyone would be that interested in
changing this excpet for the author, it seems a little dubious.

> _______________________________________________
> LON-CAPA-dev mailing list
> [email-masked]
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
>

---

From: Gerd Kortemeyer <[email-masked]>
Date: Wed, 12 Oct 2005 09:28:14 -0400

Hi,

> if answer exists -> new mechanism, if answer doesn't exist -> old

Sounds good.

> (For instance concept mapping.)

Okay, and some people do want force diagrams and do math with this.  
For the physics and math people, the more that a vector resamples the  
mathematical idea of a vector, the better, i.e., it has two  
components ((x,y) or (r,theta)).

I think what is currently called "vector" is more like a "connector"

I hate to introduce yet one more thingy, but maybe it makes sense to  
have a vector (which has two parameters and possibly an origin) and a  
connector (which connects two objects in a directed way - BTW, for a  
connector, "undirected" might be a good attribute, so it can go from  
A to B or B to A.

> And as will already have areal specifiers (for click support anyway)

Hmmm ... I guess I just don't think about vectors in this way, but  
for me, the word "vector" is also pretty "loaded."

> i.e. positionless vectors.

Real vectors are ALWAYS positionless.

How about <connector> connects two nailed down objects (positioned)
And <vector> is (x,y) or (r,theta) (unpositioned), but with the  
option of nailing down the starting point (could be to an object).

> How do you specify the tolerenceing on this?

Absolute in pixels:

<vector>
<initial unit="pixels">30,60</initial>
<cartesian unit="pixels">40,80</cartesian>
<responseparam name="tolerance" type="tolerance" default="5" />
</vector>

- note how the responseparam does refer to the whole vector, we don't  
need to be THAT particular.

This accepts anything within a 5-pixel radius of the starting and end  
point of the vector.

<vector>
<cartesian unit="pixels">40,$height</cartesian>
<responseparam name="tolerance" type="tolerance" default="5" />
</vector>

<vector>
<polar lengthunit="pixels" angleunit="radians">$l,$theta</polar>
<responseparam name="tolerance" type="tolerance" default="5" />
</vector>

Here the student picked the starting point, so it accepts anything  
within a 5-pixel radius of where the vector should have ended for  
their choice of starting point.

> of correctness using the <xinitial> etc. concept.

That's what I just tried to do.

> changing this excpet for the author, it seems a little dubious.

- nope! I had to change the tolerances on problems I used from other  
authors because they made it almost impossible to get the right  
answer. They give some graph and want a velocity read from it, but  
the curvature for several randomizations is too steep to get a decent  
value within the precision of the graph. Once I assigned the problem,  
I very much appreciated the chance to loosen the precision  
requirements to something every student could achieve before  
everybody gets ticked off. Happened more than once. Also, some  
authors always use too restrictive significant digit limits - it's  
good to have control when issues pop up.

- Gerd.

---

From: Jim Maxka <[email-masked]>
Date: Wed, 12 Oct 2005 08:02:21 -0700

Hello -- I have been scanning the discussion and have a couple of things 
to add.
(1)  I have been writing several graphical interpretation problems with 
gnuplot and have noticed that students with poor math skills -- maybe 
90% of my students -- really struggle with anything graphical.  Just to 
pick points on a line that would be suitable for a linear regression 
proved to be a disaster.  I found out in the process that 90% of 
students in the 2nd semester chemistry lab did not know what an 
inflection point was.
That raises this question.  Would there be a way to tie the 
vector/connector to a dynamically generated gnuplot?
(2) My other concern would there be a marker showing the students 
vectors/connectors before submitting and if the student sees something 
that is wrong, will there be a way of reseting and starting over or undoing?
--jim

---

From: Guy Albertelli II <[email-masked]>
Date: Wed, 12 Oct 2005 11:54:55 -0400 (EDT)

Hi Jim,

> vector/connector to a dynamically generated gnuplot?

You can do this today.

<imageresponse max="1">
  <foilgroup>
    <foil name="foil1">
      <image>
        <gnuplot>
        </gnuplot>
      </image>
      <text>Click on the inflection</text>
      <rectangle>$coords of the inflection</rectangle>
    </foil>
  </foilgroup>
</imageresponse>

I belive ed might have an example around somewhere.

> that is wrong, will there be a way of reseting and starting over or undoing?

I'm explicitly avoiding discussing the student interface right now.

---

From: Guy Albertelli II <[email-masked]>
Date: Wed, 12 Oct 2005 12:09:01 -0400 (EDT)

Hi Gerd,

Okay to review I orignially prooesed 3 types of line like thingees

1)

and
2)
 <vector type="location">
    <from><circle>(100,100,15)</circle></from>
    <to><circle>(200,200,15)</circle>
      <circle>(0,0,15)</circle></to>
  </vector>
and
3)
  <line>
    <from><circle>(100,100,15)</circle></from>
    <to><circle>(200,200,15)</circle></to>
  </line>

Your complaints (if I can summarize) are:

A) You want instructor to be able to change to tolerances in #1
B) You would prefer that #1 be just <vector> and #2 to be named
   something else
C) You would like a cartesian style <vector> too

(I think those are the complaints at least.)

How about:

- to address A) we will need to assign id numbers to <vector> and
  <angle> and <length> as well as do:

  <vector>
     <angle unit="degrees">
       35
       <responseparam name="tolerance" type="tolerance" default="3%" />
     </angle>
     <length unit="pixel">
       100
       <responseparam name="tolerance" type="tolerance" default="3%" />
     </length>
  </vector>

- to address B), I'll add <arrow> and it takes <from> and <to> 

- to address C), <vector> gets a 'style' (cartesian, or polar) and

  <vector style="cartesian">
     <xlength unit="pixels">
       35
       <responseparam name="tolerance" type="tolerance" default="3%" />
     </xlength>
     <ylength unit="percentage">
       10
       <responseparam name="tolerance" type="tolerance" default="3%" />
     </ylength>
  </vector>

Did I miss anything?

---

From: Gerd Kortemeyer <[email-masked]>
Date: Tue, 18 Oct 2005 13:48:29 -0400

Hi Guy,

> Your complaints (if I can summarize) are:

... well, suggestions, not complaints ...

> A) You want instructor to be able to change to tolerances in #1

Yep, that can save the day.

> B) You would prefer that #1 be just <vector> and #2 to be named

Yep.

> C) You would like a cartesian style <vector> too

Yep.

>        <responseparam name="tolerance" type="tolerance"  

Looks weird, somehow. Also, not sure why on that level. My earlier  
proposal was

<vector>
      <angle unit="degrees">35</angle>
      <length unit="pixel">100</length>
       <responseparam name="tolerance" type="tolerance" default="5" />
   </vector>

where it is a 5 pixel radius around the end point. I would not quite  
know how to visualize relative errors on vectors - why would I have  
more tolerance around a 60 degree angle than around a 10 degree angle?

> - to address B), I'll add <arrow> and it takes <from> and <to>

Okay.

>        <responseparam name="tolerance" type="tolerance"  

Okay. Again, I cannot quite see when I would need two tolerances, and  
it does look odd to have the tolerances folded in like that.

<numericalresponse unit="N/m" answer="15">
<responseparam name="tolerance" type="tolerance" default="3%" />
</numericalresponse>

seems to follow a different philosophy.

- Gerd.

---

From: Guy Albertelli II <[email-masked]>
Date: Tue, 18 Oct 2005 14:17:27 -0400 (EDT)

Hi Gerd,
> more tolerance around a 60 degree angle than around a 10 degree angle?

Well my thinking is you might want different tolerances on the angle
versus the lenght.

I honestly don't know what you example means when I see it. (5 what?
pixels or degrees? What if I want 0.1 radians and 10 pixel tolerance?)

Which is why I'll need to make the tol apply to the number, of the
object, of the answer, of the response, of the part.

> seems to follow a different philosophy.

Because it right now only (in most usage) accepts a single number.
-- 
[email-masked]   0-7-2-1-27,137

---

From: "Guy Ashkenazi" <[email-masked]>
Date: Wed, 19 Oct 2005 14:02:02 +0200

> Because it right now only (in most usage) accepts a single number.

I think what Gerd is trying to say is that although a vector is 
characterized by two numbers, the input accepts a single click on an 
image. Gerd's tolerance refers to the click coordinates, while Guy's 
tolerance refers to the interpreted result.
I'm with Gerd on this one - we should be tolerant to the user's mode 
of response. The student does not calculate the angle and length of 
the vector separately and reports it as two numbers, but graphically 
appreciates where the vector's head should be in relation to the 
diagram, and should be graded on this.

    Guy.

---

From: Guy Albertelli II <[email-masked]>
Date: Wed, 19 Oct 2005 18:03:44 -0400 (EDT)

Hi Guy,

> of response.

Either mode would be tolerant to users response and equally
transparnet to the user about it. The difference is in
how the instructor thinks about it.

When he wants a vector, (which now is position independent and thus
not tied to any particualr locale on the screen). Does he think 

"I want a vector that looks like this one, but the head could be off
by this much."

Or

"I want a vector of this kinda angle and this kinda length."

Additionally. the instructor might care about the angle alot, but
length very little, and thus want to allow the user to draw a vector
of artibtraryish length but with a fairly accurate angle. (or vice
versa).

> The student does not calculate the angle and length of 

This would be an <arrow> not a <vector> (arrows care about absolute
position in the diagram vectors are positionless and thus arrows have
untweakable tolerances specified in the objects that underly their
<from> and <to>)

---

From: "Guy Ashkenazi" <[email-masked]>
Date: Thu, 20 Oct 2005 16:26:36 +0200

> of artibtraryish length but with a fairly accurate angle. (or vice

I'm very impressionable... I'm siding with Guy now :)
Questions like "draw a vector which represents a planet's velocity at 
point A of its orbit" could benefit from a separation of the tolerance 
for the angle and length.

Click position tolerance is better left to arrows and lines.

    Guy.