gnumed-devel
[Top][All Lists]
Advanced

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

Re: [Gnumed-devel] Birthday reminder now obsoleted?


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Birthday reminder now obsoleted?
Date: Thu, 16 Apr 2015 12:10:35 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Fri, Jan 30, 2015 at 12:55:43AM +0000, Jim Busser wrote:

> Given that the
> 
>       dynamic hints
> 
> can now be configured to supply a birthday reminder if this is desired, I'd 
> like to suggest that in the next release we remove from the GNUmed client
> 
>       GNUmed > Preferences > User interface > Person > Birthday reminder
> 
> and, in associated server release, provide a script that
> 
>       queries existing GNUmed preferences for any associated setting
>       creates an equivalent dynamic hint with which to populate hints
>       remove the existing GNUmed birthday preference from preferences

Only now (GNUmed 1.6.to-be) can I affirmatively answer this
question because GNUmed can now return data (rather than
True/False only) depending on whether a dynamic hint matches.

The frontend runs some calculation based on the birthdate and
supplies hints as to when the birthday actually was in
relation to today. That cannot be replaced by a simple yes-no
(nearby-or-not) dynamic hint. But it can be replaced by a
query returning appropriate text output when the birthdate is
nearby (the calculations would need to be done in the SQL).
One drawback is that translation would also need to be done
either inside the query (or else in the query definition) and
can't happen in the client gettext support any longer.

If you provide a query returning text output equivalent to
what the client reported previously I'll gladly include that.

For reference:

#------------------------------------------------------------
def _check_birthday(patient=None):

        if patient['dob'] is None:
                return

        dbcfg = gmCfg.cCfgSQL()
        dob_distance = dbcfg.get2 (
                option = u'patient_search.dob_warn_interval',
                workplace = gmPraxis.gmCurrentPraxisBranch().active_workplace,
                bias = u'user',
                default = u'1 week'
        )

        if not patient.dob_in_range(dob_distance, dob_distance):
                return

        now = gmDateTime.pydt_now_here()
        enc = gmI18N.get_encoding()
        msg = _('%(pat)s turns %(age)s on %(month)s %(day)s ! (today is 
%(month_now)s %(day_now)s)') % {
                'pat': patient.get_description_gender(),
                'age': patient.get_medical_age().strip('y'),
                'month': patient.get_formatted_dob(format = '%B', encoding = 
enc),
                'day': patient.get_formatted_dob(format = '%d', encoding = enc),
                'month_now': gmDateTime.pydt_strftime(now, '%B', enc, 
gmDateTime.acc_months),
                'day_now': gmDateTime.pydt_strftime(now, '%d', enc, 
gmDateTime.acc_days)
        }
        gmDispatcher.send(signal = 'statustext', msg = msg)
#------------------------------------------------------------

The part constructed in "msg =" needs to be returned by some
SQL. Said SQL can contain ID_ACTIVE_PATIENT which is replaced
by the ID of the active patient :-)  before running the query.

Note, also, that the above is less intrusive than the dynamic
hints (they are popup while the above is statusline).

And that's nothing to say about the hints in the top panel
itself (DOB tooltip, say).

Karsten
-- 
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346



reply via email to

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