emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Burt <tcburt@rochester.rr.com>
To: Colin Hall <colinghall@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Gather properties for use by babel source block?
Date: Tue, 08 May 2012 06:42:00 -0400	[thread overview]
Message-ID: <m3pqaflzt3.fsf@fluorine.burtket> (raw)
In-Reply-To: <loom.20120507T175055-302@post.gmane.org> (Colin Hall's message of "Mon, 7 May 2012 15:52:04 +0000 (UTC)")

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

Colin Hall <colinghall@gmail.com> writes:

> Tim Burt <tcburt <at> rochester.rr.com> writes:
>>
>> I want to gather data from properties into something that can be used by
>> a babel source block (e.g. plot the data).  Searches in the manual,
>> worg, and gmane have not yielded the method, but my best guess is that
>> I've missed it.  If so, this is simply a request for a pointer to the
>> documentation I should read.
>
> Any luck with this, Tim? I'm trying to do something very similar.

After the hints of Darlan and Suvayu last August I cobbled a workflow
described below.  Errors and instability in the early weeks have been
resolved into the current set of workable blemishes described below the
workflow.  The attachment is an org file that should be a working example
if gnuplot is installed and configured for org-babel.

Thank you Colin for asking the question about progress, because I should
have shared it with the mailing list long ago warts and all.



This is an example file for gathering and plotting health data (some of
which has been fudged to protect the guilty ;-).  The workflow is this:
 1. DAILY: Use capture templates to query for data into a datetree under
    the heading '2011' which has an ID property.  Each data headline is
    marked with tags for the data class (e.g. weight, blood sugar) that is
    used as a hook for collection.
 2. ONE-TIME: Define the plots, in this case using gnuplot (thanks to
    Suvayu for the noweb example), under the heading 'Calculation and
    Visualization'.  Another one-time setup is to define propview blocks that
    org-collector will populate for each data class (e.g. weight).  Both
    the ID and tags are used to extract the information.
 3. ONE-TIME: Another one-time setup is to define propview blocks that
    org-collector will populate for each data class (e.g. weight).  Both
    the ID and tags are used to extract the information and this is under
    the 'Summaries' heading.
    - A #+tblname is placed after the #+BEGIN to provide a hook for the
      babel blocks for plotting.
 4. ON-DEMAND: Refresh each collector block (in this case 4 separate ones),
    then org-babel-execute-buffer to generate the plots.

This method has been mostly working but it has a few weaknesses, borne mostly from
my ignorance. I haven't thought about the problem in several months, so
maybe the act of writing the questions will spur me to the act of making it
better.  Here are my observations and questions: 
 - At various times in the past year the ON-DEMAND step has not worked
   consistently, especially in regards to the #+tblname within the
   collector block.  Sometimes the refresh would fail, often by wiping out
   the existing static view and replacing with an empty line under
   the #+tblname.  No matter what happened in the past, it is stable enough
   for this post.
   - The problem could have been one of configuration (e.g. org-collector
     not loaded) or data (e.g. error in the date tree) or something else
     entirely.  I have not done sufficiently thorough troubleshooting to
     really identify the different problems.
 - Collection is done by matching the tags in the data headlines, but the
   same type of information can be gleaned from the properties themselves.
   How can a match invocation be crafted to use the properties?
   - This weakness comes straight from my ignorance of lisp.
 - Collection is done for each separate table which does not scale well as
   the number of tables increases.  Scaling itself is not the issue with
   just 4 tables, but forgetting to update each table is a slight problem.
   - Is there a way to automate the org-collector step so that one action
     updates all tables?
   - Of course, for the current story another solution would be to create
     one single data table with org-collector then modify the plotting
     routines to extract only the necessary columns.  I'd like the ability
     to do monolithic or separate then decide which to use for which
     problems. 
 - The capture templates yield blank properties that simply clutter the
   drawer and make data extraction logic slightly more complicated since
   existence alone is not a complete test.
   - Can a capture template be written to ask all the questions, but not
     yield a property if the answer is 'null'?



[-- Attachment #2: TCBHealth-Example.org --]
[-- Type: application/vnd.lotus-organizer, Size: 21674 bytes --]

[-- Attachment #3: Type: text/plain, Size: 147 bytes --]


>
> Cheers,
> Colin.
>
>
>
>
>
>

-- 
Tim Burt
www.rketburt.org
"It is healthful to every sane man to utter the art within him;" -- GK Chesterton

  parent reply	other threads:[~2012-05-08 10:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 23:57 Gather properties for use by babel source block? Tim Burt
2011-08-03 14:00 ` darcamo
2011-08-03 14:35   ` tcburt
2011-08-03 15:53     ` suvayu ali
2012-05-07 15:52 ` Colin Hall
2012-05-07 14:16   ` Eric Schulte
2012-05-07 21:30     ` Colin Hall
2012-05-08 10:42   ` Tim Burt [this message]
2012-05-09 19:30     ` Colin Hall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3pqaflzt3.fsf@fluorine.burtket \
    --to=tcburt@rochester.rr.com \
    --cc=colinghall@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).