gnumed-devel
[Top][All Lists]
Advanced

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

[Gnumed-devel] display of substance intake start


From: Karsten Hilbert
Subject: [Gnumed-devel] display of substance intake start
Date: Fri, 6 Sep 2013 22:56:52 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

GNUmed will now display substance intake start according to
this algorithm:

        def _get_medically_formatted_start(self):
                if self._payload[self._idx['started']] is None:
                        return u''

                duration_taken = gmDateTime.pydt_now_here() - 
self._payload[self._idx['started']]

                three_months = pydt.timedelta(weeks = 13, days = 3)
                if duration_taken < three_months:
                        return _('%s: %s ago') % (
                                
gmDateTime.pydt_strftime(self._payload[self._idx['started']], '%Y %b %d', 
u'utf8', gmDateTime.acc_days),
                                
gmDateTime.format_interval_medically(duration_taken)
                        )

                five_years = pydt.timedelta(weeks = 265)
                if duration_taken < five_years:
                        return _('%s: %s ago (%s)') % (
                                
gmDateTime.pydt_strftime(self._payload[self._idx['started']], '%Y %b', u'utf8', 
gmDateTime.acc_months),
                                
gmDateTime.format_interval_medically(duration_taken),
                                
gmDateTime.pydt_strftime(self._payload[self._idx['started']], '%b %d', u'utf8', 
gmDateTime.acc_days)
                        )

                return _('%s: %s ago (%s)') % (
                        
gmDateTime.pydt_strftime(self._payload[self._idx['started']], '%Y', u'utf8', 
gmDateTime.acc_years),
                        gmDateTime.format_interval_medically(duration_taken),
                        
gmDateTime.pydt_strftime(self._payload[self._idx['started']], '%b %d', u'utf8', 
gmDateTime.acc_years)
                )

        medically_formatted_start = property(_get_medically_formatted_start, 
lambda x:x)

In other words, if a drug

a) has been taken < 3 months show

        <full start date>: <duration-until-now> ago

b) has been taken < 5 years show

        <year month-abbrev>: <duration-until-now> ago (<month-abbrev day>)

        Rationale by example:
                - TBC drugs are taken for up to 1.5 (?) years
                - Bisphosphonates are taken for up to (3) 5 years

c) has been taken > 5 years show

        <year>: <duration-until-now> ago (<month-abbrev day>)

The placeholders

        current_meds
        current_meds_for_rx

gained an additional field

        medically_formatted_start

returning the above.

Karsten
-- 
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

Attachment: screenshot_001.png
Description: PNG image


reply via email to

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