emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: One thing each 3 days but maximum 10


From: Jean Louis
Subject: Re: One thing each 3 days but maximum 10
Date: Mon, 31 Oct 2022 09:08:45 +0300
User-agent: Mutt/2.2.7+37 (a90f69b) (2022-09-02)

* Ihor Radchenko <yantar92@posteo.net> [2022-10-31 08:15]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > * Renato Pontefice <renato.pontefice@gmail.com> [2022-10-30 19:11]:
> >> I have to take a pill each 3 days, but for max 10 times.
> >> So I set a TODO pill >2022-10-28 +3d> and each 3 days my calendar tell me 
> >> that I have to take the pill. But is possible to say 1/10; 2/10; 3/10 etc?
> >> I nean to show how many pill I have already take?
> >
> > Use PostgreSQL to give you schedule:
> >
> > #+BEGIN_SRC sql :engine postgresql :results value raw 
> > SELECT '** TODO Take pill again
> >   SCHEDULED: <' || generate_series('2022-10-28', '2022-11-26', '3 
> > day'::interval)::date || E'>\n' 
> >   AS "* My treatement";
> > #+END_SRC
> >
> > #+RESULTS:
> > * My treatement
> > ** TODO Take pill again
> >   SCHEDULED: <2022-10-28>
> >
> > ** TODO Take pill again
> >   SCHEDULED: <2022-10-31>
> 
> This is not a good idea for pills.

I am afraid you forgot the fact that prescriptions have variable time
periods. It is rather unusual to take pills every 3 days, and rather
common for many diseases to take pills every 8 or 12 hours.

> Without SQL, one could also use org-clone-subtree-with-time-shift, but
> AFAIK, the whole idea behind schedule of taking pills is to retain
> certain concentration of medicine in the blood flow. Hence .+3d repeater
> (3d from the last time taking the pill) is more suitable.

If we ask Org documentation what is "repeater", then I get this
information:

Timestamp with repeater interval
     A timestamp may contain a _repeater interval_, indicating that it
     applies not only on the given date, but again and again after a
     certain interval of N days (d), weeks (w), months (m), or years
     (y).  The following shows up in the agenda every Wednesday:

          * Pick up Sam at school
            <2007-05-16 Wed 12:30 +1w>

And that excludes hours, unspoken of other intervals. 

That renders the function `org-clone-subtree-with-time-shift' not
suitable for prescription notification.

In fact it is great health risk to recommend to people to use Org to
track one's medical treatment due to too many "bugs" involved.

And here is hours "repeater" by using external tool PostgreSQL:

#+BEGIN_SRC sql :engine postgresql :results value raw 
SELECT '** TODO Take pill again
  SCHEDULED: <' || generate_series('2022-10-28', '2022-11-04', '8 
hours'::interval)::timestamptz || E'>\n' 
  AS "* My treatement";
#+END_SRC

#+RESULTS:
* My treatement
** TODO Take pill again
  SCHEDULED: <2022-10-28 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-28 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-28 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-29 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-29 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-29 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-30 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-30 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-30 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-31 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-31 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-10-31 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-01 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-01 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-01 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-02 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-02 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-02 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-03 00:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-03 08:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-03 16:00:00+03>

** TODO Take pill again
  SCHEDULED: <2022-11-04 00:00:00+03>



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]