emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Showing Property in headline; generating table from properties; exporting table to CSV
@ 2015-08-06 11:24 Matt Price
  2015-08-06 11:28 ` Eric S Fraga
  2015-08-06 13:52 ` John Kitchin
  0 siblings, 2 replies; 19+ messages in thread
From: Matt Price @ 2015-08-06 11:24 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 4021 bytes --]

Hello eveyrone!

I know the big guns are all working on last-minute 8.3 bugs (thank you!).

I am hoping to get some guidance before heading off on vacation.  I have
switched over to doing all grading for my courses in org.  My workflow:

- export a csv file containing student names.
- generate grading templates for each student, for each assignment
- email comments back to students
- enter marks in an official spreadsheet which can be used for final grade
submission

A sample  "Comments.org" is at the bottom of this email (it was a little
long).

So, here are my questions:

- I currently store my grades as properties of level-2 headlines. However,
I would really like to be able to see the grades when the headline is
folded, so I can have a quick visual sense of how many papers I've marked,
how well the students are doing, and so forth.  THe best would be to be
able to see the actual marks in the headlines; but if I could, say, adjust
the color of the healdine based on the property value, that would be cool
too.

- It seems silly to record the grades once in org, and then again in a
libreoffice spreadsheet.  Better would be to generate a table and/or csv
spreadsheet directly from the headlines and property values.  So, the
example below would give the table:
| Student       | Definition | Darwin |
| Student One   |          0 |      0 |
| Student Two   |          0 |      0 |
| Student Three |          0 | 0      |

and from there I guess I could generate a CSV just with org-table-export.

Had anyone done either of these tasks before? Any guidance on how to do
it?

Thanks as always,
Matt

------------------------------------------
* Definition
** TODO Student One
:PROPERTIES:
:GRADE:    0
:MAIL_TO:  student.one@utoronto.edu
:MAIL_CC:  matt.price@utoronto.ca
:MAIL_REPLY: matt.price@utoronto.ca
:MAIL_SUBJECT: Comments on Definition Assignment (Student One)
:END:
- Organization ::
- Clarity of Thesis ::
- Presentation of Evidence ::
- Grammar and Spelling ::
- Style ::
- Citations ::
- Further Comments ::
- Grade ::
** TODO Student Two
:PROPERTIES:
:GRADE:    0
:MAIL_TO:  student.two@utoronto.edu
:MAIL_CC:  matt.price@utoronto.ca
:MAIL_REPLY: matt.price@utoronto.ca
:MAIL_SUBJECT: Comments on Definition Assignment (Student Two)
:END:
- Organization ::
- Clarity of Thesis ::
- Presentation of Evidence ::
- Grammar and Spelling ::
- Style ::
- Citations ::
- Further Comments ::
- Grade ::
** TODO Student Three
:PROPERTIES:
:GRADE:    0
:MAIL_TO:  student.three@utoronto.edu
:MAIL_CC:  matt.price@utoronto.ca
:MAIL_REPLY: matt.price@utoronto.ca
:MAIL_SUBJECT: Comments on Definition Assignment (Student Three)
:END:
- Organization ::
- Clarity of Thesis ::
- Presentation of Evidence ::
- Grammar and Spelling ::
- Style ::
- Citations ::
- Further Comments ::
- Grade ::


* Darwin
** TODO Student One
:PROPERTIES:
:GRADE:    0
:MAIL_TO:  student.one@utoronto.edu
:MAIL_CC:  matt.price@utoronto.ca
:MAIL_REPLY: matt.price@utoronto.ca
:MAIL_SUBJECT: Comments on Darwin Assignment (Student One)
:END:
- Organization ::
- Clarity of Thesis ::
- Presentation of Evidence ::
- Grammar and Spelling ::
- Style ::
- Citations ::
- Further Comments ::
- Grade ::
** TODO Student Two
:PROPERTIES:
:GRADE:    0
:MAIL_TO:  student.two@utoronto.edu
:MAIL_CC:  matt.price@utoronto.ca
:MAIL_REPLY: matt.price@utoronto.ca
:MAIL_SUBJECT: Comments on Darwin Assignment (Student Two)
:END:
- Organization ::
- Clarity of Thesis ::
- Presentation of Evidence ::
- Grammar and Spelling ::
- Style ::
- Citations ::
- Further Comments ::
- Grade ::
** TODO Student Three
:PROPERTIES:
:GRADE:    0
:MAIL_TO:  student.three@utoronto.edu
:MAIL_CC:  matt.price@utoronto.ca
:MAIL_REPLY: matt.price@utoronto.ca
:MAIL_SUBJECT: Comments on Darwin Assignment (Student Three)
:END:
- Organization ::
- Clarity of Thesis ::
- Presentation of Evidence ::
- Grammar and Spelling ::
- Style ::
- Citations ::
- Further Comments ::
- Grade ::
---------------------------------------------

I have three remaining issues

[-- Attachment #2: Type: text/html, Size: 5548 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 11:24 Showing Property in headline; generating table from properties; exporting table to CSV Matt Price
@ 2015-08-06 11:28 ` Eric S Fraga
  2015-08-06 11:34   ` Nicolas Goaziou
                     ` (2 more replies)
  2015-08-06 13:52 ` John Kitchin
  1 sibling, 3 replies; 19+ messages in thread
From: Eric S Fraga @ 2015-08-06 11:28 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

On Thursday,  6 Aug 2015 at 07:24, Matt Price wrote:

[...]

> - I currently store my grades as properties of level-2 headlines. However,
> I would really like to be able to see the grades when the headline is
> folded, so I can have a quick visual sense of how many papers I've marked,

I would like something like this as well.  The nearest I have found is
to use column view.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3beta-1315-ga3b2b7

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 11:28 ` Eric S Fraga
@ 2015-08-06 11:34   ` Nicolas Goaziou
  2015-08-06 12:17     ` Eric S Fraga
  2015-08-06 12:24     ` Matt Price
  2015-08-06 13:13   ` John Kitchin
  2015-08-06 14:06   ` John Kitchin
  2 siblings, 2 replies; 19+ messages in thread
From: Nicolas Goaziou @ 2015-08-06 11:34 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

Hello,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> I would like something like this as well.  The nearest I have found is
> to use column view.

Is there anything wrong with it?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 11:34   ` Nicolas Goaziou
@ 2015-08-06 12:17     ` Eric S Fraga
  2015-08-06 12:24     ` Matt Price
  1 sibling, 0 replies; 19+ messages in thread
From: Eric S Fraga @ 2015-08-06 12:17 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

On Thursday,  6 Aug 2015 at 13:34, Nicolas Goaziou wrote:
> Hello,
>
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> I would like something like this as well.  The nearest I have found is
>> to use column view.
>
> Is there anything wrong with it?

Nothing per se.  It's just that it's "another" mode of interaction as
opposed to simply presentation so gets in the way a little.  On the
other hand, it's a good mode for editing the properties...

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3beta-1315-ga3b2b7

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 11:34   ` Nicolas Goaziou
  2015-08-06 12:17     ` Eric S Fraga
@ 2015-08-06 12:24     ` Matt Price
  2015-08-06 13:44       ` Nicolas Goaziou
  1 sibling, 1 reply; 19+ messages in thread
From: Matt Price @ 2015-08-06 12:24 UTC (permalink / raw)
  To: Matt Price, Org Mode

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

On Thu, Aug 6, 2015 at 7:34 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
> > I would like something like this as well.  The nearest I have found is
> > to use column view.
>
> Is there anything wrong with it?
>
I hadn't looked at column-view for years.  Yes, it does what I asked for,
which is great.  However, it seems like I lose the color-coding for todo
states, as well as bold for tags.  It's a shame to lose that, since I rely
on those visual cues a fair bit. I also miss indentation, but that's not as
serious.  Anyone know if it's possible to preserve those font attributes in
column-view?



>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 1348 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 11:28 ` Eric S Fraga
  2015-08-06 11:34   ` Nicolas Goaziou
@ 2015-08-06 13:13   ` John Kitchin
  2015-08-06 13:29     ` Matt Price
  2015-08-06 14:06   ` John Kitchin
  2 siblings, 1 reply; 19+ messages in thread
From: John Kitchin @ 2015-08-06 13:13 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Org Mode

How do you enter your grade? I use a function, bound to a convenient key
like s-s g, which sets the grade property. You could have that function
change the heading TODO state to DONE so you know it is done, and maybe
add a tag with the grade, or just append the grade on the end of the
headline.

I also use a function that runs org-map-entries and constructs a
temporary gradebook as an org-table in a new buffer.

Eric S Fraga writes:

> On Thursday,  6 Aug 2015 at 07:24, Matt Price wrote:
>
> [...]
>
>> - I currently store my grades as properties of level-2 headlines. However,
>> I would really like to be able to see the grades when the headline is
>> folded, so I can have a quick visual sense of how many papers I've marked,
>
> I would like something like this as well.  The nearest I have found is
> to use column view.

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 13:13   ` John Kitchin
@ 2015-08-06 13:29     ` Matt Price
  2015-08-06 14:19       ` John Kitchin
  2015-08-07  1:43       ` Richard Lawrence
  0 siblings, 2 replies; 19+ messages in thread
From: Matt Price @ 2015-08-06 13:29 UTC (permalink / raw)
  To: John Kitchin; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 1823 bytes --]

On Thu, Aug 6, 2015 at 9:13 AM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:

> How do you enter your grade? I use a function, bound to a convenient key
> like s-s g, which sets the grade property. You could have that function
> change the heading TODO state to DONE so you know it is done, and maybe
> add a tag with the grade, or just append the grade on the end of the
> headline.
>

I just set the grade with "C- C-x p GRADE", too slow!  I would love to see
your function though I can doubtless at least write THAT myself. Yeas, then
having that same function change the todo state (to "READY" in my case -- I
change to "DONE when I email out the comments), would make a lot of sense.

Adding the grade as a tag doesn't seem quite right, as I often change
grades after a rewrite.  I'd need to get rid of the original tag.  Adding
to the headline might work, but I'd have to change some of my existing
functions which use the headline value as a proxy for the student name.
Could definitely be done.

>
> I also use a function that runs org-map-entries and constructs a
> temporary gradebook as an org-table in a new buffer.
>

please please show us? Thank you!



>
> Eric S Fraga writes:
>
> > On Thursday,  6 Aug 2015 at 07:24, Matt Price wrote:
> >
> > [...]
> >
> >> - I currently store my grades as properties of level-2 headlines.
> However,
> >> I would really like to be able to see the grades when the headline is
> >> folded, so I can have a quick visual sense of how many papers I've
> marked,
> >
> > I would like something like this as well.  The nearest I have found is
> > to use column view.
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>

[-- Attachment #2: Type: text/html, Size: 2769 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 12:24     ` Matt Price
@ 2015-08-06 13:44       ` Nicolas Goaziou
  0 siblings, 0 replies; 19+ messages in thread
From: Nicolas Goaziou @ 2015-08-06 13:44 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

Matt Price <moptop99@gmail.com> writes:

> However, it seems like I lose the color-coding for todo
> states, as well as bold for tags.  It's a shame to lose that, since I rely
> on those visual cues a fair bit.

That is now fixed in maint. Thank you.

Regards,

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 11:24 Showing Property in headline; generating table from properties; exporting table to CSV Matt Price
  2015-08-06 11:28 ` Eric S Fraga
@ 2015-08-06 13:52 ` John Kitchin
  2015-08-06 17:27   ` Matt Price
  1 sibling, 1 reply; 19+ messages in thread
From: John Kitchin @ 2015-08-06 13:52 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

This gets you pretty close to what you want. I changed some grades to
make it easier to see it is doing the right thing.

#+BEGIN_SRC emacs-lisp
(setq assignments '())
(setq students '())

;; get assignments
(org-map-entries
 (lambda ()
   (when (= 1 (nth 0 (org-heading-components)))
     (add-to-list 'assignments (nth 4 (org-heading-components)) t))))

;; get student names as list of cons cells
(org-map-entries
 (lambda ()
   (when (= 2 (nth 0 (org-heading-components)))
     (add-to-list 'students (cons  (nth 4 (org-heading-components)) '()) t))))


;;loop over entries
(dolist (assignment assignments)
  (save-excursion
    ;; jump to assignment
    (org-open-link-from-string (format "[[*%s]]" assignment))
    ;; map over entries
    (org-map-entries
     (lambda ()
       (let* ((student (car (assoc (nth 4 (org-heading-components)) students))))
         (when student
           (setf (cdr (assoc student students))
                 (append (cdr (assoc student students))
                         (list (org-entry-get (point) "GRADE")))))))
     nil 'tree)))

(setq gradebook
      (append (list  (append '("Student") assignments)
                     'hline)
              students))

(orgtbl-to-csv gradebook nil)
#+END_SRC

#+RESULTS:
: Student,Definition,Darwin
: Student One,10,40
: Student Two,20,50
: Student Three,30,60



Matt Price writes:

> Hello eveyrone!
>
> I know the big guns are all working on last-minute 8.3 bugs (thank you!).
>
> I am hoping to get some guidance before heading off on vacation.  I have
> switched over to doing all grading for my courses in org.  My workflow:
>
> - export a csv file containing student names.
> - generate grading templates for each student, for each assignment
> - email comments back to students
> - enter marks in an official spreadsheet which can be used for final grade
> submission
>
> A sample  "Comments.org" is at the bottom of this email (it was a little
> long).
>
> So, here are my questions:
>
> - I currently store my grades as properties of level-2 headlines. However,
> I would really like to be able to see the grades when the headline is
> folded, so I can have a quick visual sense of how many papers I've marked,
> how well the students are doing, and so forth.  THe best would be to be
> able to see the actual marks in the headlines; but if I could, say, adjust
> the color of the healdine based on the property value, that would be cool
> too.
>
> - It seems silly to record the grades once in org, and then again in a
> libreoffice spreadsheet.  Better would be to generate a table and/or csv
> spreadsheet directly from the headlines and property values.  So, the
> example below would give the table:
> | Student       | Definition | Darwin |
> | Student One   |          0 |      0 |
> | Student Two   |          0 |      0 |
> | Student Three |          0 | 0      |
>
> and from there I guess I could generate a CSV just with org-table-export.
>
> Had anyone done either of these tasks before? Any guidance on how to do
> it?
>
> Thanks as always,
> Matt
>
> ------------------------------------------
> * Definition
> ** TODO Student One
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.one@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Definition Assignment (Student One)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ** TODO Student Two
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.two@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Definition Assignment (Student Two)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ** TODO Student Three
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.three@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Definition Assignment (Student Three)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
>
>
> * Darwin
> ** TODO Student One
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.one@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Darwin Assignment (Student One)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ** TODO Student Two
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.two@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Darwin Assignment (Student Two)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ** TODO Student Three
> :PROPERTIES:
> :GRADE:    0
> :MAIL_TO:  student.three@utoronto.edu
> :MAIL_CC:  matt.price@utoronto.ca
> :MAIL_REPLY: matt.price@utoronto.ca
> :MAIL_SUBJECT: Comments on Darwin Assignment (Student Three)
> :END:
> - Organization ::
> - Clarity of Thesis ::
> - Presentation of Evidence ::
> - Grammar and Spelling ::
> - Style ::
> - Citations ::
> - Further Comments ::
> - Grade ::
> ---------------------------------------------
>
> I have three remaining issues

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 11:28 ` Eric S Fraga
  2015-08-06 11:34   ` Nicolas Goaziou
  2015-08-06 13:13   ` John Kitchin
@ 2015-08-06 14:06   ` John Kitchin
  2015-08-06 16:26     ` Matt Price
  2 siblings, 1 reply; 19+ messages in thread
From: John Kitchin @ 2015-08-06 14:06 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Org Mode

You could do something with overlays like this:

#+BEGIN_SRC emacs-lisp
(require 'ov)

(org-map-entries
 (lambda ()
   (when (org-entry-get (point) "GRADE")
     (setq ov (make-overlay (+ 0 (line-end-position))
                            (+ 1 (line-end-position))))
     (overlay-put
      ov 'display
      (format  " grade: %s\n" (org-entry-get (point) "GRADE"))))))
#+END_SRC

#+RESULTS:
| nil | grade: 10\n | grade: 20\n | grade: 30\n | nil | grade: 40\n | grade: 50\n | grade: 60\n |

#+BEGIN_SRC emacs-lisp
(ov-clear)
#+END_SRC


you need to run this to refresh the grades on the headlines when they
change. The TODO state is a good indication of which ones are done,
although they do not show the grades.


Eric S Fraga writes:

> On Thursday,  6 Aug 2015 at 07:24, Matt Price wrote:
>
> [...]
>
>> - I currently store my grades as properties of level-2 headlines. However,
>> I would really like to be able to see the grades when the headline is
>> folded, so I can have a quick visual sense of how many papers I've marked,
>
> I would like something like this as well.  The nearest I have found is
> to use column view.

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 13:29     ` Matt Price
@ 2015-08-06 14:19       ` John Kitchin
  2015-08-06 16:39         ` Matt Price
  2015-08-07 16:41         ` Pip Cet
  2015-08-07  1:43       ` Richard Lawrence
  1 sibling, 2 replies; 19+ messages in thread
From: John Kitchin @ 2015-08-06 14:19 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

All my gradebook related stuff is here:
https://github.com/jkitchin/jmax/tree/master/techela, and there is a lot
of it ;)

I have a whole ecosystem built around using git through emacs and
org-mode with my students, which at this point even I find complex!

For grading, I grade directly in the student's turned in org-file using
functions from here
https://github.com/jkitchin/jmax/blob/master/techela/techela-grade.el. I
define a minor-mode with a keymap to make grade entry, commenting,
etc... relatively easy for me. The grades are weighted by different
categories, and saved as a filetag (not a property). I tend to put one
problem per file so the grade is just for the one problem, and assign
2-3 of these per week.

For gradebook stuff, most of it is here:
https://github.com/jkitchin/jmax/blob/master/techela/techela-gradebook.el

The grades are stored in the student org-files which I return to them. I
lookup all the assignments from the syllabus, and then map over the
org-files for each student for each assignment getting the grades out.

I will be using it again this fall, so /maybe/ the documentation will
even improve ;)

Matt Price writes:

> On Thu, Aug 6, 2015 at 9:13 AM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>> How do you enter your grade? I use a function, bound to a convenient key
>> like s-s g, which sets the grade property. You could have that function
>> change the heading TODO state to DONE so you know it is done, and maybe
>> add a tag with the grade, or just append the grade on the end of the
>> headline.
>>
>
> I just set the grade with "C- C-x p GRADE", too slow!  I would love to see
> your function though I can doubtless at least write THAT myself. Yeas, then
> having that same function change the todo state (to "READY" in my case -- I
> change to "DONE when I email out the comments), would make a lot of sense.
>
> Adding the grade as a tag doesn't seem quite right, as I often change
> grades after a rewrite.  I'd need to get rid of the original tag.  Adding
> to the headline might work, but I'd have to change some of my existing
> functions which use the headline value as a proxy for the student name.
> Could definitely be done.

see previous email about using overlays

>
>>
>> I also use a function that runs org-map-entries and constructs a
>> temporary gradebook as an org-table in a new buffer.
>>
>
> please please show us? Thank you!
>
>
>
>>
>> Eric S Fraga writes:
>>
>> > On Thursday,  6 Aug 2015 at 07:24, Matt Price wrote:
>> >
>> > [...]
>> >
>> >> - I currently store my grades as properties of level-2 headlines.
>> However,
>> >> I would really like to be able to see the grades when the headline is
>> >> folded, so I can have a quick visual sense of how many papers I've
>> marked,
>> >
>> > I would like something like this as well.  The nearest I have found is
>> > to use column view.
>>
>> --
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>>

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 14:06   ` John Kitchin
@ 2015-08-06 16:26     ` Matt Price
  0 siblings, 0 replies; 19+ messages in thread
From: Matt Price @ 2015-08-06 16:26 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 2271 bytes --]

On Thu, Aug 6, 2015 at 10:06 AM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:

> You could do something with overlays like this:
>
> #+BEGIN_SRC emacs-lisp
> (require 'ov)
>
> (org-map-entries
>  (lambda ()
>    (when (org-entry-get (point) "GRADE")
>      (setq ov (make-overlay (+ 0 (line-end-position))
>                             (+ 1 (line-end-position))))
>      (overlay-put
>       ov 'display
>       (format  " grade: %s\n" (org-entry-get (point) "GRADE"))))))
> #+END_SRC
>
> #+RESULTS:
> | nil | grade: 10\n | grade: 20\n | grade: 30\n | nil | grade: 40\n |
> grade: 50\n | grade: 60\n |
>
> #+BEGIN_SRC emacs-lisp
> (ov-clear)
> #+END_SRC
>
>
>
The final \n in the overlay is a little irritating when the buffer is
folded, as it adds an extra line between the headlines.  I changed it this,
which doesn't seem perfect but so far works for me:

#+BEGIN_SRC emacs-lisp :results output
  (require 'ov)

  (org-map-entries
   (lambda ()
     (when (org-entry-get (point) "GRADE")
       (setq ov (make-overlay (- (line-end-position) 1)
                              (+ 0 (line-end-position))))
       (setq character (buffer-substring (- (line-end-position) 1)
(line-end-position)))
       (overlay-put
        ov 'display
        (format  "%s  GRADE: %s" character (org-entry-get (point)
"GRADE"))))))
#+END_SRC

you need to run this to refresh the grades on the headlines when they
> change. The TODO state is a good indication of which ones are done,
> although they do not show the grades.
>

so I should probably make this into a function which can be called by the
function that writes grades...

>
>
> Eric S Fraga writes:
>
> > On Thursday,  6 Aug 2015 at 07:24, Matt Price wrote:
> >
> > [...]
> >
> >> - I currently store my grades as properties of level-2 headlines.
> However,
> >> I would really like to be able to see the grades when the headline is
> >> folded, so I can have a quick visual sense of how many papers I've
> marked,
> >
> > I would like something like this as well.  The nearest I have found is
> > to use column view.
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>

[-- Attachment #2: Type: text/html, Size: 3500 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 14:19       ` John Kitchin
@ 2015-08-06 16:39         ` Matt Price
  2015-08-06 16:47           ` John Kitchin
  2015-08-07 16:41         ` Pip Cet
  1 sibling, 1 reply; 19+ messages in thread
From: Matt Price @ 2015-08-06 16:39 UTC (permalink / raw)
  To: John Kitchin; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 3718 bytes --]

I'm reading through gb-grade and grade.el, I see you do something
interesting with rubrics, could you provide a link to a syllabus document
with example rubrics?

On Thu, Aug 6, 2015 at 10:19 AM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:

> All my gradebook related stuff is here:
> https://github.com/jkitchin/jmax/tree/master/techela, and there is a lot
> of it ;)
>
> I have a whole ecosystem built around using git through emacs and
> org-mode with my students, which at this point even I find complex!
>
> For grading, I grade directly in the student's turned in org-file using
> functions from here
> https://github.com/jkitchin/jmax/blob/master/techela/techela-grade.el. I
> define a minor-mode with a keymap to make grade entry, commenting,
> etc... relatively easy for me. The grades are weighted by different
> categories, and saved as a filetag (not a property). I tend to put one
> problem per file so the grade is just for the one problem, and assign
> 2-3 of these per week.
>
> For gradebook stuff, most of it is here:
> https://github.com/jkitchin/jmax/blob/master/techela/techela-gradebook.el
>
> The grades are stored in the student org-files which I return to them. I
> lookup all the assignments from the syllabus, and then map over the
> org-files for each student for each assignment getting the grades out.
>
> I will be using it again this fall, so /maybe/ the documentation will
> even improve ;)
>
> Matt Price writes:
>
> > On Thu, Aug 6, 2015 at 9:13 AM, John Kitchin <jkitchin@andrew.cmu.edu>
> > wrote:
> >
> >> How do you enter your grade? I use a function, bound to a convenient key
> >> like s-s g, which sets the grade property. You could have that function
> >> change the heading TODO state to DONE so you know it is done, and maybe
> >> add a tag with the grade, or just append the grade on the end of the
> >> headline.
> >>
> >
> > I just set the grade with "C- C-x p GRADE", too slow!  I would love to
> see
> > your function though I can doubtless at least write THAT myself. Yeas,
> then
> > having that same function change the todo state (to "READY" in my case
> -- I
> > change to "DONE when I email out the comments), would make a lot of
> sense.
> >
> > Adding the grade as a tag doesn't seem quite right, as I often change
> > grades after a rewrite.  I'd need to get rid of the original tag.  Adding
> > to the headline might work, but I'd have to change some of my existing
> > functions which use the headline value as a proxy for the student name.
> > Could definitely be done.
>
> see previous email about using overlays
>
> >
> >>
> >> I also use a function that runs org-map-entries and constructs a
> >> temporary gradebook as an org-table in a new buffer.
> >>
> >
> > please please show us? Thank you!
> >
> >
> >
> >>
> >> Eric S Fraga writes:
> >>
> >> > On Thursday,  6 Aug 2015 at 07:24, Matt Price wrote:
> >> >
> >> > [...]
> >> >
> >> >> - I currently store my grades as properties of level-2 headlines.
> >> However,
> >> >> I would really like to be able to see the grades when the headline is
> >> >> folded, so I can have a quick visual sense of how many papers I've
> >> marked,
> >> >
> >> > I would like something like this as well.  The nearest I have found is
> >> > to use column view.
> >>
> >> --
> >> Professor John Kitchin
> >> Doherty Hall A207F
> >> Department of Chemical Engineering
> >> Carnegie Mellon University
> >> Pittsburgh, PA 15213
> >> 412-268-7803
> >> @johnkitchin
> >> http://kitchingroup.cheme.cmu.edu
> >>
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>

[-- Attachment #2: Type: text/html, Size: 5406 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 16:39         ` Matt Price
@ 2015-08-06 16:47           ` John Kitchin
  0 siblings, 0 replies; 19+ messages in thread
From: John Kitchin @ 2015-08-06 16:47 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 4712 bytes --]

Here is an example syllabus:
https://github.com/jkitchin/f15-06625/blob/master/syllabus.org

I probably misuse the word rubric a bit, it means an assignment grade is
determined by a few components, e.g. technical (70%) and presentation (30%)
which are given full letter grades independently, and a weighted average is
computed for the overall grade.

Some rubric definitions are listed here:

https://github.com/jkitchin/jmax/blob/master/techela/techela-admin.el#L49

The gb-grade function just prompts me for each grade and then computes the
weighted average.


John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


On Thu, Aug 6, 2015 at 12:39 PM, Matt Price <moptop99@gmail.com> wrote:

> I'm reading through gb-grade and grade.el, I see you do something
> interesting with rubrics, could you provide a link to a syllabus document
> with example rubrics?
>
> On Thu, Aug 6, 2015 at 10:19 AM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>> All my gradebook related stuff is here:
>> https://github.com/jkitchin/jmax/tree/master/techela, and there is a lot
>> of it ;)
>>
>> I have a whole ecosystem built around using git through emacs and
>> org-mode with my students, which at this point even I find complex!
>>
>> For grading, I grade directly in the student's turned in org-file using
>> functions from here
>> https://github.com/jkitchin/jmax/blob/master/techela/techela-grade.el. I
>> define a minor-mode with a keymap to make grade entry, commenting,
>> etc... relatively easy for me. The grades are weighted by different
>> categories, and saved as a filetag (not a property). I tend to put one
>> problem per file so the grade is just for the one problem, and assign
>> 2-3 of these per week.
>>
>> For gradebook stuff, most of it is here:
>> https://github.com/jkitchin/jmax/blob/master/techela/techela-gradebook.el
>>
>> The grades are stored in the student org-files which I return to them. I
>> lookup all the assignments from the syllabus, and then map over the
>> org-files for each student for each assignment getting the grades out.
>>
>> I will be using it again this fall, so /maybe/ the documentation will
>> even improve ;)
>>
>> Matt Price writes:
>>
>> > On Thu, Aug 6, 2015 at 9:13 AM, John Kitchin <jkitchin@andrew.cmu.edu>
>> > wrote:
>> >
>> >> How do you enter your grade? I use a function, bound to a convenient
>> key
>> >> like s-s g, which sets the grade property. You could have that function
>> >> change the heading TODO state to DONE so you know it is done, and maybe
>> >> add a tag with the grade, or just append the grade on the end of the
>> >> headline.
>> >>
>> >
>> > I just set the grade with "C- C-x p GRADE", too slow!  I would love to
>> see
>> > your function though I can doubtless at least write THAT myself. Yeas,
>> then
>> > having that same function change the todo state (to "READY" in my case
>> -- I
>> > change to "DONE when I email out the comments), would make a lot of
>> sense.
>> >
>> > Adding the grade as a tag doesn't seem quite right, as I often change
>> > grades after a rewrite.  I'd need to get rid of the original tag.
>> Adding
>> > to the headline might work, but I'd have to change some of my existing
>> > functions which use the headline value as a proxy for the student name.
>> > Could definitely be done.
>>
>> see previous email about using overlays
>>
>> >
>> >>
>> >> I also use a function that runs org-map-entries and constructs a
>> >> temporary gradebook as an org-table in a new buffer.
>> >>
>> >
>> > please please show us? Thank you!
>> >
>> >
>> >
>> >>
>> >> Eric S Fraga writes:
>> >>
>> >> > On Thursday,  6 Aug 2015 at 07:24, Matt Price wrote:
>> >> >
>> >> > [...]
>> >> >
>> >> >> - I currently store my grades as properties of level-2 headlines.
>> >> However,
>> >> >> I would really like to be able to see the grades when the headline
>> is
>> >> >> folded, so I can have a quick visual sense of how many papers I've
>> >> marked,
>> >> >
>> >> > I would like something like this as well.  The nearest I have found
>> is
>> >> > to use column view.
>> >>
>> >> --
>> >> Professor John Kitchin
>> >> Doherty Hall A207F
>> >> Department of Chemical Engineering
>> >> Carnegie Mellon University
>> >> Pittsburgh, PA 15213
>> >> 412-268-7803
>> >> @johnkitchin
>> >> http://kitchingroup.cheme.cmu.edu
>> >>
>>
>> --
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>>
>
>

[-- Attachment #2: Type: text/html, Size: 7142 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 13:52 ` John Kitchin
@ 2015-08-06 17:27   ` Matt Price
  2015-08-06 18:14     ` John Kitchin
  0 siblings, 1 reply; 19+ messages in thread
From: Matt Price @ 2015-08-06 17:27 UTC (permalink / raw)
  To: John Kitchin; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 7855 bytes --]

This is fantastic, but it turns out my use case is a little more complex
than I thought & I've now bnaged my head against it for a hwile, might as
well ask you for help!

I have non-assignment level-1 headlines in my comments.org files:

* Introduction
let me explain how this system works... and here is some code to generate
the grading templates

* Assignment 1
** Student 1
** Student 2
* Assignment 2
** Student 1
** Student 2

...etc.

Solution: add a tag to Assignment headlines :ASSIGNMENT and search that
way:

  (setq assignments '())
  (setq students '())

  ;; get assignments
  (org-map-entries
   (lambda ()
     (when  (member "ASSIGNMENT" (org-get-tags-at (point) 'local)) ;; (= 1
(nth 0 (org-heading-components)))
       (add-to-list 'assignments (nth 4 (org-heading-components)) t))))


But there are also level-2 headings that shouldn't be added to the student
list, and I have trouble with that part:

 (org-map-entries
   (lambda ()
     (when (member "ASSIGNMENT" (org-element-property :tags
(org-element-lineage (org-element-at-point) 'headline)))
       (add-to-list 'students (cons  (nth 4 (org-heading-components)) '())
t))))

does not work, for instance; nor does:

(org-map-entries
   (lambda ()
     (when (member "ASSIGNMENT" (org-get-tags-at (save-excursion
(org-up-heading-safe)) 'local))
       (add-to-list 'students (cons  (nth 4 (org-heading-components)) '())
t))))

What's the best way to check the tags of the parents of a headline from
withing org-map-entries?

On Thu, Aug 6, 2015 at 9:52 AM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:

> This gets you pretty close to what you want. I changed some grades to
> make it easier to see it is doing the right thing.
>
> #+BEGIN_SRC emacs-lisp
> (setq assignments '())
> (setq students '())
>
> ;; get assignments
> (org-map-entries
>  (lambda ()
>    (when (= 1 (nth 0 (org-heading-components)))
>      (add-to-list 'assignments (nth 4 (org-heading-components)) t))))
>
> ;; get student names as list of cons cells
> (org-map-entries
>  (lambda ()
>    (when (= 2 (nth 0 (org-heading-components)))
>      (add-to-list 'students (cons  (nth 4 (org-heading-components)) '())
> t))))
>
>
> ;;loop over entries
> (dolist (assignment assignments)
>   (save-excursion
>     ;; jump to assignment
>     (org-open-link-from-string (format "[[*%s]]" assignment))
>     ;; map over entries
>     (org-map-entries
>      (lambda ()
>        (let* ((student (car (assoc (nth 4 (org-heading-components))
> students))))
>          (when student
>            (setf (cdr (assoc student students))
>                  (append (cdr (assoc student students))
>                          (list (org-entry-get (point) "GRADE")))))))
>      nil 'tree)))
>
> (setq gradebook
>       (append (list  (append '("Student") assignments)
>                      'hline)
>               students))
>
> (orgtbl-to-csv gradebook nil)
> #+END_SRC
>
> #+RESULTS:
> : Student,Definition,Darwin
> : Student One,10,40
> : Student Two,20,50
> : Student Three,30,60
>
>
>
> Matt Price writes:
>
> > Hello eveyrone!
> >
> > I know the big guns are all working on last-minute 8.3 bugs (thank you!).
> >
> > I am hoping to get some guidance before heading off on vacation.  I have
> > switched over to doing all grading for my courses in org.  My workflow:
> >
> > - export a csv file containing student names.
> > - generate grading templates for each student, for each assignment
> > - email comments back to students
> > - enter marks in an official spreadsheet which can be used for final
> grade
> > submission
> >
> > A sample  "Comments.org" is at the bottom of this email (it was a little
> > long).
> >
> > So, here are my questions:
> >
> > - I currently store my grades as properties of level-2 headlines.
> However,
> > I would really like to be able to see the grades when the headline is
> > folded, so I can have a quick visual sense of how many papers I've
> marked,
> > how well the students are doing, and so forth.  THe best would be to be
> > able to see the actual marks in the headlines; but if I could, say,
> adjust
> > the color of the healdine based on the property value, that would be cool
> > too.
> >
> > - It seems silly to record the grades once in org, and then again in a
> > libreoffice spreadsheet.  Better would be to generate a table and/or csv
> > spreadsheet directly from the headlines and property values.  So, the
> > example below would give the table:
> > | Student       | Definition | Darwin |
> > | Student One   |          0 |      0 |
> > | Student Two   |          0 |      0 |
> > | Student Three |          0 | 0      |
> >
> > and from there I guess I could generate a CSV just with org-table-export.
> >
> > Had anyone done either of these tasks before? Any guidance on how to do
> > it?
> >
> > Thanks as always,
> > Matt
> >
> > ------------------------------------------
> > * Definition
> > ** TODO Student One
> > :PROPERTIES:
> > :GRADE:    0
> > :MAIL_TO:  student.one@utoronto.edu
> > :MAIL_CC:  matt.price@utoronto.ca
> > :MAIL_REPLY: matt.price@utoronto.ca
> > :MAIL_SUBJECT: Comments on Definition Assignment (Student One)
> > :END:
> > - Organization ::
> > - Clarity of Thesis ::
> > - Presentation of Evidence ::
> > - Grammar and Spelling ::
> > - Style ::
> > - Citations ::
> > - Further Comments ::
> > - Grade ::
> > ** TODO Student Two
> > :PROPERTIES:
> > :GRADE:    0
> > :MAIL_TO:  student.two@utoronto.edu
> > :MAIL_CC:  matt.price@utoronto.ca
> > :MAIL_REPLY: matt.price@utoronto.ca
> > :MAIL_SUBJECT: Comments on Definition Assignment (Student Two)
> > :END:
> > - Organization ::
> > - Clarity of Thesis ::
> > - Presentation of Evidence ::
> > - Grammar and Spelling ::
> > - Style ::
> > - Citations ::
> > - Further Comments ::
> > - Grade ::
> > ** TODO Student Three
> > :PROPERTIES:
> > :GRADE:    0
> > :MAIL_TO:  student.three@utoronto.edu
> > :MAIL_CC:  matt.price@utoronto.ca
> > :MAIL_REPLY: matt.price@utoronto.ca
> > :MAIL_SUBJECT: Comments on Definition Assignment (Student Three)
> > :END:
> > - Organization ::
> > - Clarity of Thesis ::
> > - Presentation of Evidence ::
> > - Grammar and Spelling ::
> > - Style ::
> > - Citations ::
> > - Further Comments ::
> > - Grade ::
> >
> >
> > * Darwin
> > ** TODO Student One
> > :PROPERTIES:
> > :GRADE:    0
> > :MAIL_TO:  student.one@utoronto.edu
> > :MAIL_CC:  matt.price@utoronto.ca
> > :MAIL_REPLY: matt.price@utoronto.ca
> > :MAIL_SUBJECT: Comments on Darwin Assignment (Student One)
> > :END:
> > - Organization ::
> > - Clarity of Thesis ::
> > - Presentation of Evidence ::
> > - Grammar and Spelling ::
> > - Style ::
> > - Citations ::
> > - Further Comments ::
> > - Grade ::
> > ** TODO Student Two
> > :PROPERTIES:
> > :GRADE:    0
> > :MAIL_TO:  student.two@utoronto.edu
> > :MAIL_CC:  matt.price@utoronto.ca
> > :MAIL_REPLY: matt.price@utoronto.ca
> > :MAIL_SUBJECT: Comments on Darwin Assignment (Student Two)
> > :END:
> > - Organization ::
> > - Clarity of Thesis ::
> > - Presentation of Evidence ::
> > - Grammar and Spelling ::
> > - Style ::
> > - Citations ::
> > - Further Comments ::
> > - Grade ::
> > ** TODO Student Three
> > :PROPERTIES:
> > :GRADE:    0
> > :MAIL_TO:  student.three@utoronto.edu
> > :MAIL_CC:  matt.price@utoronto.ca
> > :MAIL_REPLY: matt.price@utoronto.ca
> > :MAIL_SUBJECT: Comments on Darwin Assignment (Student Three)
> > :END:
> > - Organization ::
> > - Clarity of Thesis ::
> > - Presentation of Evidence ::
> > - Grammar and Spelling ::
> > - Style ::
> > - Citations ::
> > - Further Comments ::
> > - Grade ::
> > ---------------------------------------------
> >
> > I have three remaining issues
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>

[-- Attachment #2: Type: text/html, Size: 11187 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 17:27   ` Matt Price
@ 2015-08-06 18:14     ` John Kitchin
  0 siblings, 0 replies; 19+ messages in thread
From: John Kitchin @ 2015-08-06 18:14 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode


Matt Price writes:

> This is fantastic, but it turns out my use case is a little more complex
> than I thought & I've now bnaged my head against it for a hwile, might as
> well ask you for help!
>
> I have non-assignment level-1 headlines in my comments.org files:
>
> * Introduction
> let me explain how this system works... and here is some code to generate
> the grading templates
>
> * Assignment 1
> ** Student 1
> ** Student 2
> * Assignment 2
> ** Student 1
> ** Student 2
>
> ...etc.
>
You can limit the scope of org-map-entries to headlines that are tagged
or that have properties like this:

;; get assignments
(let ((org-use-tag-inheritance nil))
  (org-map-entries
   (lambda ()
     (add-to-list 'assignments (nth 4 (org-heading-components)) t))
   "assignment"))

;; get student names as list of cons cells
(let ((org-use-property-inheritance nil))
  (org-map-entries
   (lambda ()
     (add-to-list 'students (cons (nth 4 (org-heading-components)) '()) t))
 "MAIL_TO={edu}"))

here you rely on a headline being tagged an assignment, and a student
having a MAIL_TO property that has edu in it, and the level of each
headline is irrelevant now.

> Solution: add a tag to Assignment headlines :ASSIGNMENT and search that
> way:
>
>   (setq assignments '())
>   (setq students '())
>
>   ;; get assignments
>   (org-map-entries
>    (lambda ()
>      (when  (member "ASSIGNMENT" (org-get-tags-at (point) 'local)) ;; (= 1
> (nth 0 (org-heading-components)))
>        (add-to-list 'assignments (nth 4 (org-heading-components)) t))))
>
>
> But there are also level-2 headings that shouldn't be added to the student
> list, and I have trouble with that part:
>
>  (org-map-entries
>    (lambda ()
>      (when (member "ASSIGNMENT" (org-element-property :tags
> (org-element-lineage (org-element-at-point) 'headline)))
>        (add-to-list 'students (cons  (nth 4 (org-heading-components)) '())
> t))))
>
> does not work, for instance; nor does:
>
> (org-map-entries
>    (lambda ()
>      (when (member "ASSIGNMENT" (org-get-tags-at (save-excursion
> (org-up-heading-safe)) 'local))
>        (add-to-list 'students (cons  (nth 4 (org-heading-components)) '())
> t))))
>
> What's the best way to check the tags of the parents of a headline from
> withing org-map-entries?
>
> On Thu, Aug 6, 2015 at 9:52 AM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>> This gets you pretty close to what you want. I changed some grades to
>> make it easier to see it is doing the right thing.
>>
>> #+BEGIN_SRC emacs-lisp
>> (setq assignments '())
>> (setq students '())
>>
>> ;; get assignments
>> (org-map-entries
>>  (lambda ()
>>    (when (= 1 (nth 0 (org-heading-components)))
>>      (add-to-list 'assignments (nth 4 (org-heading-components)) t))))
>>
>> ;; get student names as list of cons cells
>> (org-map-entries
>>  (lambda ()
>>    (when (= 2 (nth 0 (org-heading-components)))
>>      (add-to-list 'students (cons  (nth 4 (org-heading-components)) '())
>> t))))
>>
>>
>> ;;loop over entries
>> (dolist (assignment assignments)
>>   (save-excursion
>>     ;; jump to assignment
>>     (org-open-link-from-string (format "[[*%s]]" assignment))
>>     ;; map over entries
>>     (org-map-entries
>>      (lambda ()
>>        (let* ((student (car (assoc (nth 4 (org-heading-components))
>> students))))
>>          (when student
>>            (setf (cdr (assoc student students))
>>                  (append (cdr (assoc student students))
>>                          (list (org-entry-get (point) "GRADE")))))))
>>      nil 'tree)))
>>
>> (setq gradebook
>>       (append (list  (append '("Student") assignments)
>>                      'hline)
>>               students))
>>
>> (orgtbl-to-csv gradebook nil)
>> #+END_SRC
>>
>> #+RESULTS:
>> : Student,Definition,Darwin
>> : Student One,10,40
>> : Student Two,20,50
>> : Student Three,30,60
>>
>>
>>
>> Matt Price writes:
>>
>> > Hello eveyrone!
>> >
>> > I know the big guns are all working on last-minute 8.3 bugs (thank you!).
>> >
>> > I am hoping to get some guidance before heading off on vacation.  I have
>> > switched over to doing all grading for my courses in org.  My workflow:
>> >
>> > - export a csv file containing student names.
>> > - generate grading templates for each student, for each assignment
>> > - email comments back to students
>> > - enter marks in an official spreadsheet which can be used for final
>> grade
>> > submission
>> >
>> > A sample  "Comments.org" is at the bottom of this email (it was a little
>> > long).
>> >
>> > So, here are my questions:
>> >
>> > - I currently store my grades as properties of level-2 headlines.
>> However,
>> > I would really like to be able to see the grades when the headline is
>> > folded, so I can have a quick visual sense of how many papers I've
>> marked,
>> > how well the students are doing, and so forth.  THe best would be to be
>> > able to see the actual marks in the headlines; but if I could, say,
>> adjust
>> > the color of the healdine based on the property value, that would be cool
>> > too.
>> >
>> > - It seems silly to record the grades once in org, and then again in a
>> > libreoffice spreadsheet.  Better would be to generate a table and/or csv
>> > spreadsheet directly from the headlines and property values.  So, the
>> > example below would give the table:
>> > | Student       | Definition | Darwin |
>> > | Student One   |          0 |      0 |
>> > | Student Two   |          0 |      0 |
>> > | Student Three |          0 | 0      |
>> >
>> > and from there I guess I could generate a CSV just with org-table-export.
>> >
>> > Had anyone done either of these tasks before? Any guidance on how to do
>> > it?
>> >
>> > Thanks as always,
>> > Matt
>> >
>> > ------------------------------------------
>> > * Definition
>> > ** TODO Student One
>> > :PROPERTIES:
>> > :GRADE:    0
>> > :MAIL_TO:  student.one@utoronto.edu
>> > :MAIL_CC:  matt.price@utoronto.ca
>> > :MAIL_REPLY: matt.price@utoronto.ca
>> > :MAIL_SUBJECT: Comments on Definition Assignment (Student One)
>> > :END:
>> > - Organization ::
>> > - Clarity of Thesis ::
>> > - Presentation of Evidence ::
>> > - Grammar and Spelling ::
>> > - Style ::
>> > - Citations ::
>> > - Further Comments ::
>> > - Grade ::
>> > ** TODO Student Two
>> > :PROPERTIES:
>> > :GRADE:    0
>> > :MAIL_TO:  student.two@utoronto.edu
>> > :MAIL_CC:  matt.price@utoronto.ca
>> > :MAIL_REPLY: matt.price@utoronto.ca
>> > :MAIL_SUBJECT: Comments on Definition Assignment (Student Two)
>> > :END:
>> > - Organization ::
>> > - Clarity of Thesis ::
>> > - Presentation of Evidence ::
>> > - Grammar and Spelling ::
>> > - Style ::
>> > - Citations ::
>> > - Further Comments ::
>> > - Grade ::
>> > ** TODO Student Three
>> > :PROPERTIES:
>> > :GRADE:    0
>> > :MAIL_TO:  student.three@utoronto.edu
>> > :MAIL_CC:  matt.price@utoronto.ca
>> > :MAIL_REPLY: matt.price@utoronto.ca
>> > :MAIL_SUBJECT: Comments on Definition Assignment (Student Three)
>> > :END:
>> > - Organization ::
>> > - Clarity of Thesis ::
>> > - Presentation of Evidence ::
>> > - Grammar and Spelling ::
>> > - Style ::
>> > - Citations ::
>> > - Further Comments ::
>> > - Grade ::
>> >
>> >
>> > * Darwin
>> > ** TODO Student One
>> > :PROPERTIES:
>> > :GRADE:    0
>> > :MAIL_TO:  student.one@utoronto.edu
>> > :MAIL_CC:  matt.price@utoronto.ca
>> > :MAIL_REPLY: matt.price@utoronto.ca
>> > :MAIL_SUBJECT: Comments on Darwin Assignment (Student One)
>> > :END:
>> > - Organization ::
>> > - Clarity of Thesis ::
>> > - Presentation of Evidence ::
>> > - Grammar and Spelling ::
>> > - Style ::
>> > - Citations ::
>> > - Further Comments ::
>> > - Grade ::
>> > ** TODO Student Two
>> > :PROPERTIES:
>> > :GRADE:    0
>> > :MAIL_TO:  student.two@utoronto.edu
>> > :MAIL_CC:  matt.price@utoronto.ca
>> > :MAIL_REPLY: matt.price@utoronto.ca
>> > :MAIL_SUBJECT: Comments on Darwin Assignment (Student Two)
>> > :END:
>> > - Organization ::
>> > - Clarity of Thesis ::
>> > - Presentation of Evidence ::
>> > - Grammar and Spelling ::
>> > - Style ::
>> > - Citations ::
>> > - Further Comments ::
>> > - Grade ::
>> > ** TODO Student Three
>> > :PROPERTIES:
>> > :GRADE:    0
>> > :MAIL_TO:  student.three@utoronto.edu
>> > :MAIL_CC:  matt.price@utoronto.ca
>> > :MAIL_REPLY: matt.price@utoronto.ca
>> > :MAIL_SUBJECT: Comments on Darwin Assignment (Student Three)
>> > :END:
>> > - Organization ::
>> > - Clarity of Thesis ::
>> > - Presentation of Evidence ::
>> > - Grammar and Spelling ::
>> > - Style ::
>> > - Citations ::
>> > - Further Comments ::
>> > - Grade ::
>> > ---------------------------------------------
>> >
>> > I have three remaining issues
>>
>> --
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>>

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 13:29     ` Matt Price
  2015-08-06 14:19       ` John Kitchin
@ 2015-08-07  1:43       ` Richard Lawrence
  1 sibling, 0 replies; 19+ messages in thread
From: Richard Lawrence @ 2015-08-07  1:43 UTC (permalink / raw)
  To: emacs-orgmode

Hi Matt and all,

Matt Price <moptop99@gmail.com> writes:

> On Thu, Aug 6, 2015 at 9:13 AM, John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>> How do you enter your grade? I use a function, bound to a convenient key
>> like s-s g, which sets the grade property. You could have that function
>> change the heading TODO state to DONE so you know it is done, and maybe
>> add a tag with the grade, or just append the grade on the end of the
>> headline.

> Adding the grade as a tag doesn't seem quite right, as I often change
> grades after a rewrite.  I'd need to get rid of the original tag.

Here's another idea for getting the grade into the headline: set the
grade as a priority, like

** [#A] John Doe

Pros: it's a simple hack that doesn't require you to do any additional
parsing; it's easy to change up or down either interactively or
programmatically (cf. org-priority* functions); and it's easy to sort
headlines by priority in a custom agenda view, to give you a quick
overall picture of your grade distribution.

Cons: this would only work for A/B/C/D/F grades, and even then, it
doesn't represent +/- variants.  So it's not very flexible or granular,
but it might be enough.  

Best,
Richard

P.S. Like others, I too have written my own grading system:

https://github.com/wyleyr/schoolutils

It stores grades and student data in a SQLite database, and allows you
to write end-of-term grade calculations in Python, instead of messing
with spreadsheets. (Overkill? Maybe so... :)

It currently only has a command line interface, but I have been thinking
about adding an Org interface that would do basic CRUD operations on
grades via Babel.  If anyone is interested in such a thing, let me
know...

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-06 14:19       ` John Kitchin
  2015-08-06 16:39         ` Matt Price
@ 2015-08-07 16:41         ` Pip Cet
  2015-08-10 14:41           ` Eric S Fraga
  1 sibling, 1 reply; 19+ messages in thread
From: Pip Cet @ 2015-08-07 16:41 UTC (permalink / raw)
  To: John Kitchin; +Cc: Org Mode

[-- Attachment #1: Type: text/plain, Size: 9643 bytes --]

I hesitate to share this code (it's not very pretty right now), but I
have been working on two ideas that I think combine to solve problems
like this in a nicer (and lazier) fashion than the current approach:
headline properties and reverse inheritance.

Headline properties are simply about setting properties in the
headline: no properties drawer, potentially nicer syntax (I'm
currently using :property=value: to emphasize that properties behave
like tags, but I'm thinking of moving to [property: value] (I'm
worried about collisions with other org syntax, but since this would
be effective only at the end of a headline, I think the only collision
is with footnotes, and the solution to that is "don't have a property
called FN")), and easier transition from tags to properties and back.
The problem, of course, is what happens when you try to set more than
one short property in a headline.

This is where the second idea comes in: reverse inheritance. *if* all
of a headline's children agree on what a property's value should be,
it's as though the property were specified in the master headline. In
particular, if there's only one child headline that sets a property,
it automatically migrates up a level:

* John Smith
** :email=johnsmith@example.com:

would migrate up the "email" property to apply to the top-level
headline, so columns view would look something like this:

ITEM | EMAIL |
* John Smith | johnsmith@example.com | ....

(this example doesn't quite work yet in practice, with my current code).

If there are two conflicting values for a property, the property is
not set. This is so

* Students
** John Smith
*** email :email=johnsmith@example.com:
** Jane Miller
*** email :email=janemiller@example.org:

doesn't set an email property for the "Students" line (if there's just
one student, with just one email address, there's probably no harm in
having that property set for the Students line. Also, in that case,
you have an attendance problem.)

In combination, the syntax I currently have in mind would allow you to
set properties one at a time in sub-headlines of your data item:

* Chemicals
** water
*** [smiles: O]
According to Wikipedia.
*** [molarmass: 18.01528]
Also according to Wikipedia.
*** [safety: GRAS]
I think.

(Notice how that gives you a well-defined place to put comments and
footnotes, which I imagine is useful if you need to have citable
references for your properties. I think you can currently place such
comments in the PROPERTIES drawer, but then they probably won't be
exported.)

What if the master headline already sets the property? There are two
cases here: in case it's set to an ordinary value, the child headlines
are ignored. But if it's set to a special value signifying that a
"compactor" function is to be used, that function is called to produce
the property value for the headline based on the child nodes. In the
simplest case, that means the property is set to something like
"mean(^)" (again, that syntax is likely to change to something
prettier), and the result of

* calculate this for me :v=mean(^):
** 3 :v=3:
** 4 :v=4:
** 6 :v=6:

is as though you'd written

* calculate this for me :v=4.3333:
and so on

(It's possible to do something very much like this with the columns
property; I'm not claiming it's a new feature.)

Ordinary inheritance, reverse inheritance, and compaction can be combined:

#+COLUMNS: %ITEM %8GRADE %TAGS
* Document
** defaults
*** default to compacting with the arithmetic mean function :grade=mean(^):
*** student grades
**** 1999
***** John Smith
****** test paper 1 :grade=3:
****** test paper 2 :grade=4:

will work, and with column mode produce the output attached as
students2.org.html. Note that "3.5" is John Smith's grade, the average
of all students' grades in 1999, and the average grade averaged over
all years. I've attached a more complete example as
students.org/students.org.html that demonstrates how the mean is
calculated.

I think people can imagine what the columns view would be with some of
the sub-headline levels hidden, but I'd like to point out both that it
does give you a really nice list of students with their grades and
that there's a potential problem with missing tests: there's no
default to a grade of 0 for them, so you have to be careful when
entering them to distinguish between a 0-graded missed test and a test
that's simply ignored for the average grade.

Currently the code for calculating the reverse inheritance is working,
but really slow (it doesn't cache calculations at all, so it's
probably something like O(n^3)); I don't have special code for
displaying the results yet, but columns mode followed by
org-htmlize-buffer produced the attached HTML files. At this point,
this is just to demonstrate the ideas; while I think the two ideas in
combination apply well to the student-grade problem set, I've actually
implemented them for use in a literate programming major mode.

I'd appreciate any comments (but I know the code isn't particularly
clean, fast, or anywhere near ready for inclusion right now),
particularly on the syntax questions:
1. what's a good syntax for setting properties in a headline?
 - ** headline [property=value]
   ** headline [property:value]
 - ** headline [[property: value]]
 - ** headline :property=value:
 - something else entirely
2. what's a good syntax for specifying that a property is to be
calculated from child properties?
 - ** headline [property:=mean(property)]
 - ** headline [property=mean(^)]
 - ** headline :property==mean(^):
 - something else entirely
3. is it useful to align properties to the right border like tags are
currently aligned? I must admit I don't particularly like the visuals
of that, but it would be handy for looking over your students'
grades...

Sorry that this post has gotten somewhat long and self-promoting, but
I really think the current PROPERTIES drawer syntax is very ugly and
unnecessary, so we should do _something_ about it.

Look at the code:
https://github.com/pipcet/org-mode/compare/master...pipcet:compact-properties?expand=1
Check out the code: git clone -b compact-properties
https://github.com/pipcet/org-mode.git

On Thu, Aug 6, 2015 at 2:19 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> All my gradebook related stuff is here:
> https://github.com/jkitchin/jmax/tree/master/techela, and there is a lot
> of it ;)
>
> I have a whole ecosystem built around using git through emacs and
> org-mode with my students, which at this point even I find complex!
>
> For grading, I grade directly in the student's turned in org-file using
> functions from here
> https://github.com/jkitchin/jmax/blob/master/techela/techela-grade.el. I
> define a minor-mode with a keymap to make grade entry, commenting,
> etc... relatively easy for me. The grades are weighted by different
> categories, and saved as a filetag (not a property). I tend to put one
> problem per file so the grade is just for the one problem, and assign
> 2-3 of these per week.
>
> For gradebook stuff, most of it is here:
> https://github.com/jkitchin/jmax/blob/master/techela/techela-gradebook.el
>
> The grades are stored in the student org-files which I return to them. I
> lookup all the assignments from the syllabus, and then map over the
> org-files for each student for each assignment getting the grades out.
>
> I will be using it again this fall, so /maybe/ the documentation will
> even improve ;)
>
> Matt Price writes:
>
>> On Thu, Aug 6, 2015 at 9:13 AM, John Kitchin <jkitchin@andrew.cmu.edu>
>> wrote:
>>
>>> How do you enter your grade? I use a function, bound to a convenient key
>>> like s-s g, which sets the grade property. You could have that function
>>> change the heading TODO state to DONE so you know it is done, and maybe
>>> add a tag with the grade, or just append the grade on the end of the
>>> headline.
>>>
>>
>> I just set the grade with "C- C-x p GRADE", too slow!  I would love to see
>> your function though I can doubtless at least write THAT myself. Yeas, then
>> having that same function change the todo state (to "READY" in my case -- I
>> change to "DONE when I email out the comments), would make a lot of sense.
>>
>> Adding the grade as a tag doesn't seem quite right, as I often change
>> grades after a rewrite.  I'd need to get rid of the original tag.  Adding
>> to the headline might work, but I'd have to change some of my existing
>> functions which use the headline value as a proxy for the student name.
>> Could definitely be done.
>
> see previous email about using overlays
>
>>
>>>
>>> I also use a function that runs org-map-entries and constructs a
>>> temporary gradebook as an org-table in a new buffer.
>>>
>>
>> please please show us? Thank you!
>>
>>
>>
>>>
>>> Eric S Fraga writes:
>>>
>>> > On Thursday,  6 Aug 2015 at 07:24, Matt Price wrote:
>>> >
>>> > [...]
>>> >
>>> >> - I currently store my grades as properties of level-2 headlines.
>>> However,
>>> >> I would really like to be able to see the grades when the headline is
>>> >> folded, so I can have a quick visual sense of how many papers I've
>>> marked,
>>> >
>>> > I would like something like this as well.  The nearest I have found is
>>> > to use column view.
>>>
>>> --
>>> Professor John Kitchin
>>> Doherty Hall A207F
>>> Department of Chemical Engineering
>>> Carnegie Mellon University
>>> Pittsburgh, PA 15213
>>> 412-268-7803
>>> @johnkitchin
>>> http://kitchingroup.cheme.cmu.edu
>>>
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>

[-- Attachment #2: students.org.html --]
[-- Type: text/html, Size: 4260 bytes --]

[-- Attachment #3: students2.org.html --]
[-- Type: text/html, Size: 3414 bytes --]

[-- Attachment #4: students.org --]
[-- Type: application/octet-stream, Size: 403 bytes --]

#+COLUMNS: %ITEM %8GRADE %TAGS
* Student grades                                              :grade=mean(^):
** class of 1999
*** John Smith
**** test paper 1 :grade=4:
**** test paper 2 :grade=5:
** class of 2000
*** John Smith
**** test paper 1 :grade=8:
**** test paper 2 :grade=7:
*** Joan Miller
**** test paper 1 :grade=9:
**** test paper 2 :grade=10:
*** Steven Smith
**** test paper 1 :grade=2:

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Showing Property in headline; generating table from properties; exporting table to CSV
  2015-08-07 16:41         ` Pip Cet
@ 2015-08-10 14:41           ` Eric S Fraga
  0 siblings, 0 replies; 19+ messages in thread
From: Eric S Fraga @ 2015-08-10 14:41 UTC (permalink / raw)
  To: Pip Cet; +Cc: Org Mode, John Kitchin

On Friday,  7 Aug 2015 at 16:41, Pip Cet wrote:

[...]

> Headline properties are simply about setting properties in the
> headline: no properties drawer, potentially nicer syntax (I'm
> currently using :property=value: to emphasize that properties behave

Interesting possible extension to org tags syntax... it would probably
break existing files in some cases but it would be quite nice for the
OP's initial requirement for viewing grades...

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-34-gb911f1

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-08-10 14:41 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-06 11:24 Showing Property in headline; generating table from properties; exporting table to CSV Matt Price
2015-08-06 11:28 ` Eric S Fraga
2015-08-06 11:34   ` Nicolas Goaziou
2015-08-06 12:17     ` Eric S Fraga
2015-08-06 12:24     ` Matt Price
2015-08-06 13:44       ` Nicolas Goaziou
2015-08-06 13:13   ` John Kitchin
2015-08-06 13:29     ` Matt Price
2015-08-06 14:19       ` John Kitchin
2015-08-06 16:39         ` Matt Price
2015-08-06 16:47           ` John Kitchin
2015-08-07 16:41         ` Pip Cet
2015-08-10 14:41           ` Eric S Fraga
2015-08-07  1:43       ` Richard Lawrence
2015-08-06 14:06   ` John Kitchin
2015-08-06 16:26     ` Matt Price
2015-08-06 13:52 ` John Kitchin
2015-08-06 17:27   ` Matt Price
2015-08-06 18:14     ` John Kitchin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).