[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnumed-devel] how to adjust a hook script
From: |
Busser, Jim |
Subject: |
[Gnumed-devel] how to adjust a hook script |
Date: |
Thu, 6 Sep 2012 22:39:08 +0000 |
was: Re: [Gnumed-devel] Workaround for prescriptions
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
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
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 ??
?????
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)'
- but only if it does not already exist
- and not if the person is staff
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
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
??
ok… here I am stuck.
-- Jim
#===========================================================================
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
return
#===========================================================================
Re: [Gnumed-devel] Workaround for prescriptions, Busser, Jim, 2012/09/06
Re: [Gnumed-devel] Workaround for prescriptions, Karsten Hilbert, 2012/09/09