gnumed-devel
[Top][All Lists]
Advanced

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

Re: [Gnumed-devel] how to adjust a hook script


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] how to adjust a hook script
Date: Sun, 9 Sep 2012 20:19:49 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Sep 06, 2012 at 10:39:08PM +0000, Jim Busser wrote:

> On 2012-09-06, at 1:58 PM, Karsten Hilbert <address@hidden> replied:
> 
> >> Would it be reasonable, in a praxis, to set up a GNUmed post-patient 
> >> creation trigger
> >> 
> >>    create Unattributed episode '(Prescriptions)'
> >> 
> >> recognizing that if this was done for a person who was
> >> praxis staff (but not a patient) it would have no meaning?
> > 
> > The hook script could even skip staff.
> 
> So to do this, I will need to modify my existing-by-default script
> 
>       ~/.gnumed/scripts/hook_script.py

Indeed.

> which currently says only
> 
>       def run_script(hook=None):
>               pass
> 
> so I reviewed what is available at
> 
>       http://wiki.gnumed.de/bin/view/Gnumed/GmManualCustomizingClientStartup
>       http://wiki.gnumed.de/bin/view/Gnumed/GmManualHooksFramework
>       
> and it seems I should replace
> 
>               pass

Correct.

> with what I show at the bottom of this posting (between
> the  ===), including the replacement of 'foo',  where foo
> will need to use code that is related to what is already
> contained in
> 
>       clin-episode.sql  ??

Correct.

> so I have quickly hit the point where here my programming
> ignorance shows. Venturing nevertheless into what is for me
> strange territory, what I do want is to
> 
> - create an Unattributed episode of name '(Prescriptions)'

Correct. "Unattributud" here means that the clin.episode
foreign key into clin.health_issue is set to NULL.

> - but only if it does not already exist
> - and not if the person is staff

Yes. Those are the requirements. To make it easier one might
consider ignoring the last one for a first attempt.

> So in grepping Unattributed I did find, in the file 'gmEMRStructItems.py' the 
> following
>  
>       def get_dummy_health_issue():
>               issue = {
>                       'pk_health_issue': None,
>                       'description': _('Unattributed episodes'),
>                       'age_noted': None,
>                       'laterality': u'na',
>                       'is_active': True,
>                       'clinically_relevant': True,
>                       'is_confidential': None,
>                       'is_cause_of_death': False,
>                       'is_dummy': True,
>                       'grouping': None
>               }
>               return issue

Given the above realisation (unattributed means not linked
to an issue) and the hint "issue = {...}" one may be able to
infer that while this is realated to Unattributed episodes
it is only tangentially so (to be precise this is the fake
health issue node being used in the EMR tree to hold, gasp,
unattributed episodes ;-)

> and also, I know that gmSOAPWidgets.py is involved in the
> creation of new episodes, and it contains
> 
>       # check for dupes
>       # new unassociated problem
>       if problem_to_add is None: 
> 
> so maybe the hook script needs to somehow call, and pass parameters --- 
> perhaps a label = '(Prescriptions)'  --- to
> 
>       gmSOAPWidgets.py

Given the lack of further knowledge this is actually not at
all a bad chain of reasoning.

> #===========================================================================
> 
>       if hook is None:
>               hook = _('no hook specified, please report bug')
>       print 'GNUmed invoked the hook [%s]' % hook
> 
>       if hook == u'post_person_creation':
>               on_post_person_creation()
>               foo

Indeed, that's correct.

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



reply via email to

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