* Re: Re: orgmode and physical fitness training
2008-11-06 16:56 ` Eric Schulte
@ 2008-11-06 21:33 ` Mikael Fornius
2008-11-07 17:54 ` Mikael Fornius
2008-11-07 20:52 ` Carsten Dominik
2 siblings, 0 replies; 12+ messages in thread
From: Mikael Fornius @ 2008-11-06 21:33 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode, David O'Toole
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Mikael Fornius <mfo@abc.se> writes:
>
>> David O'Toole <dto@gnu.org> writes:
>>
>>> Does anyone else here use org-mode for fitness and/or health tracking?
>>
>> I tried column mode but it is far too slow for 300 headings and the
>> calculations possible is only sums but I need much more.
>
> I ran into a very similar issue with column view lately while trying to
> use org-mode to collect experimental results. I created the attached
> file [...] `org-collector.el' is attached
Thanks alot!
This file is a really good inspiration for me. Especially I did not know
about the power of the function org-map-entries. I will look in to it
deeper.
Because I use a very old laptop I am extra interested in not doing any
unnecessary calculations that slow things down.
When I analyzed the problem with org-columns I noticed that it is the
function org-entry-properties, when looking for inherited tags, who is
one of the most timeconsuming tasks, because of extensive use of
outline-previous-heading.
I was planning to make use of inherited tags in my running data
structure.
So I have experimented with my own recursive headings map function who
caches inherited tags. It is almost working properly now. :-)
I am currently fantasizing about having a "fast access property mirror"
(in memory) of all of the documents headings.
I like collecting notes and numbers of things and it would be nice to
be able too keep numbers and stuff in an unordered manner and be able to
sort out nice tables and statistics about it in a simple way.
Like an agenda for data instead of dates...
Statistical diary for org-mode?
Every data object can be uniqely identified by the md5-string calculated
between points (outline-back-to-heading) and (outline-next-heading).
This to be sure about that data in memory is up to date with the org
file. (May not really be necessary for all purposes but a thougt.)
Internally the entry properties could be stored like:
((:ORG-DATA-IDENTITY . "dsf76dsliudshgah")
(:ALLTAGS . "abc:123:mytag")
(:TAGS . "123:mytag")
(:TIMESTAMP . (34234 32443))
(:DIST . 45)
(:TIME . 324)
...)
or similar structure in hashtables.
The property names is converted to elisp keyword symbols, numeric
values are converted to elisp numbers and timestamp is converted to
emacs internal time format and other time strings to seconds.
This makes it possible to keep track of different data types in an
unordered manner and later get some nice tables and statistics out of
it.
A dblock can be used to get tables of subsets of the data:
#+BEGIN: table :subset-tags (:running :september) :cols (:TIMESTAMP :DIST :TIME)
makes table of running entries in september,
or,
#+BEGIN: table :subset-tags (:temperature (20 35)) :cols (:TIMESTAMP :CELCIUS)
could make a table of all observed temperatures in between 20 and 35
celcius from org file.
This is what I have had working with my running data but in an external
(to org) elisp program.
I experienced problems when I wanted a new datatype it involved a lot of
work to incorporate it in the elisp datastructure.
With org mode properties I hope I can have a fully dynamic data object
definition made "at write time" by the properties.
A lot of thoughts here, any suggestions/reactions/questions are very
welcome!
/Mikael Fornius
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orgmode and physical fitness training
2008-11-06 16:56 ` Eric Schulte
2008-11-06 21:33 ` Mikael Fornius
@ 2008-11-07 17:54 ` Mikael Fornius
2008-11-07 18:02 ` Eric Schulte
2008-11-07 20:52 ` Carsten Dominik
2 siblings, 1 reply; 12+ messages in thread
From: Mikael Fornius @ 2008-11-07 17:54 UTC (permalink / raw)
To: Eric Schulte; +Cc: David O'Toole, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1795 bytes --]
Thanks for org-collector.el, now I have read it and tried it out.
It is very nice to have the possibility to evaluate lisp expressions as
values, that is something missing in org-columns!
But it was only a few seconds faster than column-view and column dblock
and therefore not fast enough for my slow computer ;-). I timed it to 62
seconds to insert exercise data table for one year (83 headings) with 4
columns and no calculations.
* ELP Profiling Results
|---------------------------+-------+--------------+--------------|
| org-dblock-write:propview | 1 | 62.158395 | 62.158395 |
| org-propview-collect | 1 | 60.578724 | 60.578724 |
| org-map-entries | 1 | 60.519551 | 60.519551 |
| org-scan-tags | 1 | 60.267157 | 60.267157 |
| org-entry-properties | 94 | 57.451918999 | 0.6111906276 |
| org-get-tags-at | 94 | 54.069399999 | 0.5752063829 |
| org-up-heading-all | 365 | 53.664638999 | 0.1470264082 |
| outline-up-heading | 365 | 53.647627 | 0.1469798 |
| outline-previous-heading | 29751 | 39.418412999 | 0.0013249441 |
| org-outline-level | 30306 | 6.0971540000 | 0.0002011863 |
| org-split-string | 555 | 2.0629750000 | 0.0037170720 |
|---------------------------+-------+--------------+--------------|
It is clear from above who is the time thief.
* Comment
It did not work at first because sometimes I have properties without
values, they then gets the empty string assigned, "".
I had to adjust function org-read-prop because in my emacs (GNU Emacs
23.0.60.5):
(stringp "") -> t
and
(string-to-number "") -> 0
(string-to-number "0") -> 0
and then at line 34 it tries to take substring out of "".
Attaches diff if interested :-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-collector.diff --]
[-- Type: text/x-patch, Size: 1441 bytes --]
*** /home/mfo/org/org-collector.el~ 2008-11-07 17:19:12.000000000 +0100
--- /home/mfo/org/org-collector.el 2008-11-07 18:14:23.000000000 +0100
***************
*** 27,45 ****
Otherwise if prop looks like a list (meaning it starts with a
'(') then read it as lisp, otherwise return it unmodified as a
string."
! (if (stringp prop)
! (if prop
! (let ((out (string-to-number prop)))
! (if (equal out 0)
! (if (or (equal "(" (substring prop 0 1)) (equal "'" (substring prop 0 1)))
! (read prop)
! (if (string-match "^\\(+0\\|-0\\|0\\)$" prop)
! 0
! (progn (set-text-properties 0 (length prop) nil prop)
! prop)))
! out))
! nil)
! prop))
(defun org-dblock-write:propview (params)
"collect the column specification from the #+cols line
--- 27,43 ----
Otherwise if prop looks like a list (meaning it starts with a
'(') then read it as lisp, otherwise return it unmodified as a
string."
! (if (and (stringp prop) (not (equal prop "")))
! (let ((out (string-to-number prop)))
! (if (equal out 0)
! (if (or (equal "(" (substring prop 0 1)) (equal "'" (substring prop 0 1)))
! (read prop)
! (if (string-match "^\\(+0\\|-0\\|0\\)$" prop)
! 0
! (progn (set-text-properties 0 (length prop) nil prop)
! prop)))
! out))
! prop))
(defun org-dblock-write:propview (params)
"collect the column specification from the #+cols line
[-- Attachment #3: Type: text/plain, Size: 17 bytes --]
/Mikael Fornius
[-- Attachment #4: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orgmode and physical fitness training
2008-11-07 17:54 ` Mikael Fornius
@ 2008-11-07 18:02 ` Eric Schulte
2008-11-07 20:25 ` Mikael Fornius
0 siblings, 1 reply; 12+ messages in thread
From: Eric Schulte @ 2008-11-07 18:02 UTC (permalink / raw)
To: Mikael Fornius; +Cc: David O'Toole, emacs-orgmode
Mikael Fornius <mfo@abc.se> writes:
> Thanks for org-collector.el, now I have read it and tried it out.
>
> It is very nice to have the possibility to evaluate lisp expressions as
> values, that is something missing in org-columns!
>
I'm happy someone else is finding it useful!
>
> But it was only a few seconds faster than column-view and column dblock
> and therefore not fast enough for my slow computer ;-). I timed it to 62
> seconds to insert exercise data table for one year (83 headings) with 4
> columns and no calculations.
>
> * ELP Profiling Results
>
> |---------------------------+-------+--------------+--------------|
> | org-dblock-write:propview | 1 | 62.158395 | 62.158395 |
> | org-propview-collect | 1 | 60.578724 | 60.578724 |
> | org-map-entries | 1 | 60.519551 | 60.519551 |
> | org-scan-tags | 1 | 60.267157 | 60.267157 |
> | org-entry-properties | 94 | 57.451918999 | 0.6111906276 |
> | org-get-tags-at | 94 | 54.069399999 | 0.5752063829 |
> | org-up-heading-all | 365 | 53.664638999 | 0.1470264082 |
> | outline-up-heading | 365 | 53.647627 | 0.1469798 |
> | outline-previous-heading | 29751 | 39.418412999 | 0.0013249441 |
> | org-outline-level | 30306 | 6.0971540000 | 0.0002011863 |
> | org-split-string | 555 | 2.0629750000 | 0.0037170720 |
> |---------------------------+-------+--------------+--------------|
>
> It is clear from above who is the time thief.
>
Speeding up these functions would also pay off if/when org-mode is used
on more portable handheld computers.
>
> Attaches diff if interested :-)
Thanks,
I will certainly apply this to org-collector.el. In fact if you would
be interested in collaborating on this tool --for speed, stability,
cleaner arguments and results printing-- I could upload this to worg
where we could both make changes.
Best -- Eric
>
> *** /home/mfo/org/org-collector.el~ 2008-11-07 17:19:12.000000000 +0100
> --- /home/mfo/org/org-collector.el 2008-11-07 18:14:23.000000000 +0100
> ***************
> *** 27,45 ****
> Otherwise if prop looks like a list (meaning it starts with a
> '(') then read it as lisp, otherwise return it unmodified as a
> string."
> ! (if (stringp prop)
> ! (if prop
> ! (let ((out (string-to-number prop)))
> ! (if (equal out 0)
> ! (if (or (equal "(" (substring prop 0 1)) (equal "'" (substring prop 0 1)))
> ! (read prop)
> ! (if (string-match "^\\(+0\\|-0\\|0\\)$" prop)
> ! 0
> ! (progn (set-text-properties 0 (length prop) nil prop)
> ! prop)))
> ! out))
> ! nil)
> ! prop))
>
> (defun org-dblock-write:propview (params)
> "collect the column specification from the #+cols line
> --- 27,43 ----
> Otherwise if prop looks like a list (meaning it starts with a
> '(') then read it as lisp, otherwise return it unmodified as a
> string."
> ! (if (and (stringp prop) (not (equal prop "")))
> ! (let ((out (string-to-number prop)))
> ! (if (equal out 0)
> ! (if (or (equal "(" (substring prop 0 1)) (equal "'" (substring prop 0 1)))
> ! (read prop)
> ! (if (string-match "^\\(+0\\|-0\\|0\\)$" prop)
> ! 0
> ! (progn (set-text-properties 0 (length prop) nil prop)
> ! prop)))
> ! out))
> ! prop))
>
> (defun org-dblock-write:propview (params)
> "collect the column specification from the #+cols line
>
> /Mikael Fornius
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orgmode and physical fitness training
2008-11-07 18:02 ` Eric Schulte
@ 2008-11-07 20:25 ` Mikael Fornius
2008-11-07 21:25 ` Eric Schulte
0 siblings, 1 reply; 12+ messages in thread
From: Mikael Fornius @ 2008-11-07 20:25 UTC (permalink / raw)
To: Eric Schulte; +Cc: David O'Toole, emacs-orgmode
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Speeding up these functions would also pay off if/when org-mode is used
> on more portable handheld computers.
That is a good point. I will try to see if I am able to make some
improvement and I know that without inherited tags it is about 10 times
faster.
I have my own recursive map headings function who passes inherited tags,
it is much faster, but it would be even nicer if a more general function
like org-map-entries could remember and pass inherited tags (and
properties?) in some smart way...
> I will certainly apply this to org-collector.el. In fact if you would
> be interested in collaborating on this tool --for speed, stability,
> cleaner arguments and results printing-- I could upload this to worg
> where we could both make changes.
I am registered on Worg-git but I have never committed anything just
looked around and I like it.
Yes, I am interested in collaboration. You have read my reply about my
personal goals of a all-round statistical diary. I think that this tool
can be a nice beginning.
/Mikael Fornius
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orgmode and physical fitness training
2008-11-07 20:25 ` Mikael Fornius
@ 2008-11-07 21:25 ` Eric Schulte
2008-11-10 9:29 ` Mikael Fornius
0 siblings, 1 reply; 12+ messages in thread
From: Eric Schulte @ 2008-11-07 21:25 UTC (permalink / raw)
To: Mikael Fornius; +Cc: David O'Toole, emacs-orgmode
Mikael Fornius <mfo@abc.se> writes:
> "Eric Schulte" <schulte.eric@gmail.com> writes:
[...]
> Yes, I am interested in collaboration. You have read my reply about my
> personal goals of a all-round statistical diary. I think that this tool
> can be a nice beginning.
>
Great,
I've placed org-collector.el up on worg. See the
http://legito.net/worg/org-devel.php page on Worg (which should
propagate within an hour or so) for information and links.
Note: While this seems like an appropriate use of Worg to me, if anyone
with more Worg experience thinks this is a misuse of the repo, please
let me know and I'll gladly move this somewhere else.
Tally Ho -- Eric
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: orgmode and physical fitness training
2008-11-06 16:56 ` Eric Schulte
2008-11-06 21:33 ` Mikael Fornius
2008-11-07 17:54 ` Mikael Fornius
@ 2008-11-07 20:52 ` Carsten Dominik
2008-11-07 21:52 ` Mikael Fornius
2 siblings, 1 reply; 12+ messages in thread
From: Carsten Dominik @ 2008-11-07 20:52 UTC (permalink / raw)
To: Eric Schulte; +Cc: Mikael Fornius, David O'Toole, emacs-orgmode
Hi,
if you do not need the tags, calling
(org-entry-properties nil 'standard)
will be a lot faster.
- Carsten
On Nov 6, 2008, at 5:56 PM, Eric Schulte wrote:
> Mikael Fornius <mfo@abc.se> writes:
>
>> David O'Toole <dto@gnu.org> writes:
>>
>>> Does anyone else here use org-mode for fitness and/or health
>>> tracking?
> [...]
>> Lately I have been thinking of and trying to implement a true org-
>> mode
>> running diary. Which means to use the org-mode file as raw-data file
>> (properties) instead of my parallell sexp-assoc-list-elisp-data-file.
>>
>> I tried column mode but it is far too slow for 300 headings and the
>> calculations possible is only sums but I need much more.
>>
>
> Hi Mikael,
>
> I ran into a very similar issue with column view lately while trying
> to
> use org-mode to collect experimental results. I created the attached
> file, which can be used to collect data from properties in a manner
> similar to column view, but using a simpler method meant only for
> table
> display, rather than column viewing, and allowing for the
> application of
> general elisp to the values before they are dumped into the table. I
> think it would work in your case as well.
>
> I applied it to the data you posted with the following results. The
> mechanics are working, but it could use some display cleaning. The
> file
> `org-collector.el' is attached
>
> <org-collector.el><mime-attachment.txt><mime-attachment.txt>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: orgmode and physical fitness training
2008-11-07 20:52 ` Carsten Dominik
@ 2008-11-07 21:52 ` Mikael Fornius
0 siblings, 0 replies; 12+ messages in thread
From: Mikael Fornius @ 2008-11-07 21:52 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode, David O'Toole
Carsten Dominik <dominik@science.uva.nl> writes:
> (org-entry-properties nil 'standard)
>
> will be a lot faster.
Thanks! But I have already noticed that, and that it is about 10-times
faster to get properties of a subtree without inherited tags. :-)
The problem is that I like to use inherited tags in my document
structure. I am planning to use tags and properties to generate subsets
of my heading data, for tables and statistics.
* :2008:
** :november:
*** <2008-11-05> :temperature:
*** <2008-11-07> :weight:
*** <2008-11-09> :running:interval:
*** <2008-11-10> :skiing:
:PROPERTIES:...
Wow what a ride!
I want to be able to get subset of lets say skiing in year 2008 then
"Wow what a ride!" should match if all tags are inherited.
(org-tags-at "Wow what a ride!") -> ":2008:november:skiing:"
/Mikael Fornius
^ permalink raw reply [flat|nested] 12+ messages in thread