Package Gnumed :: Package wxpython :: Module gmVaccWidgets
[frames] | no frames]

Source Code for Module Gnumed.wxpython.gmVaccWidgets

   1  """GNUmed immunisation/vaccination widgets. 
   2   
   3  Modelled after Richard Terry's design document. 
   4   
   5  copyright: authors 
   6  """ 
   7  #====================================================================== 
   8  __version__ = "$Revision: 1.36 $" 
   9  __author__ = "R.Terry, S.J.Tan, K.Hilbert" 
  10  __license__ = "GPL v2 or later (details at http://www.gnu.org)" 
  11   
  12  import sys, time, logging, webbrowser 
  13   
  14   
  15  import wx 
  16   
  17   
  18  if __name__ == '__main__': 
  19          sys.path.insert(0, '../../') 
  20  from Gnumed.pycommon import gmDispatcher, gmMatchProvider, gmTools, gmI18N 
  21  from Gnumed.pycommon import gmCfg, gmDateTime 
  22  from Gnumed.business import gmPerson, gmVaccination, gmSurgery 
  23  from Gnumed.wxpython import gmPhraseWheel, gmTerryGuiParts, gmRegetMixin, gmGuiHelpers 
  24  from Gnumed.wxpython import gmEditArea, gmListWidgets 
  25   
  26   
  27  _log = logging.getLogger('gm.vaccination') 
  28  _log.info(__version__) 
  29   
  30  #====================================================================== 
  31  # vaccination indication related widgets 
  32  #---------------------------------------------------------------------- 
33 -def manage_vaccination_indications(parent=None):
34 35 if parent is None: 36 parent = wx.GetApp().GetTopWindow() 37 #------------------------------------------------------------ 38 def refresh(lctrl): 39 inds = gmVaccination.get_indications(order_by = 'description') 40 41 items = [ [ 42 i['description'], 43 gmTools.coalesce ( 44 i['atcs_single_indication'], 45 u'', 46 u'%s' 47 ), 48 gmTools.coalesce ( 49 i['atcs_combi_indication'], 50 u'', 51 u'%s' 52 ), 53 u'%s' % i['id'] 54 ] for i in inds ] 55 56 lctrl.set_string_items(items) 57 lctrl.set_data(inds)
58 #------------------------------------------------------------ 59 gmListWidgets.get_choices_from_list ( 60 parent = parent, 61 msg = _('\nConditions preventable by vaccination as currently known to GNUmed.\n'), 62 caption = _('Showing vaccination preventable conditions.'), 63 columns = [ _('Condition'), _('ATCs: single-condition vaccines'), _('ATCs: multi-condition vaccines'), u'#' ], 64 single_selection = True, 65 refresh_callback = refresh 66 ) 67 #---------------------------------------------------------------------- 68 from Gnumed.wxGladeWidgets import wxgVaccinationIndicationsPnl 69
70 -class cVaccinationIndicationsPnl(wxgVaccinationIndicationsPnl.wxgVaccinationIndicationsPnl):
71
72 - def __init__(self, *args, **kwargs):
73 74 wxgVaccinationIndicationsPnl.wxgVaccinationIndicationsPnl.__init__(self, *args, **kwargs) 75 76 self.__indication2field = { 77 u'coxiella burnetii (Q fever)': self._CHBOX_coxq, 78 u'salmonella typhi (typhoid)': self._CHBOX_typhoid, 79 u'varicella (chickenpox, shingles)': self._CHBOX_varicella, 80 u'influenza (seasonal)': self._CHBOX_influenza, 81 u'bacillus anthracis (Anthrax)': self._CHBOX_anthrax, 82 u'human papillomavirus': self._CHBOX_hpv, 83 u'rotavirus': self._CHBOX_rota, 84 u'tuberculosis': self._CHBOX_tuberculosis, 85 u'variola virus (smallpox)': self._CHBOX_smallpox, 86 u'influenza (H1N1)': self._CHBOX_h1n1, 87 u'cholera': self._CHBOX_cholera, 88 u'diphtheria': self._CHBOX_diphtheria, 89 u'haemophilus influenzae b': self._CHBOX_hib, 90 u'hepatitis A': self._CHBOX_hepA, 91 u'hepatitis B': self._CHBOX_hepB, 92 u'japanese B encephalitis': self._CHBOX_japanese, 93 u'measles': self._CHBOX_measles, 94 u'meningococcus A': self._CHBOX_menA, 95 u'meningococcus C': self._CHBOX_menC, 96 u'meningococcus W': self._CHBOX_menW, 97 u'meningococcus Y': self._CHBOX_menY, 98 u'mumps': self._CHBOX_mumps, 99 u'pertussis': self._CHBOX_pertussis, 100 u'pneumococcus': self._CHBOX_pneumococcus, 101 u'poliomyelitis': self._CHBOX_polio, 102 u'rabies': self._CHBOX_rabies, 103 u'rubella': self._CHBOX_rubella, 104 u'tetanus': self._CHBOX_tetanus, 105 u'tick-borne meningoencephalitis': self._CHBOX_fsme, 106 u'yellow fever': self._CHBOX_yellow_fever, 107 u'yersinia pestis': self._CHBOX_yersinia_pestis 108 }
109 #------------------------------------------------------------------
110 - def enable_all(self):
111 for field in self.__dict__.keys(): 112 if field.startswith('_CHBOX_'): 113 self.__dict__[field].Enable() 114 self.Enable()
115 #------------------------------------------------------------------
116 - def disable_all(self):
117 for field in self.__dict__.keys(): 118 if field.startswith('_CHBOX_'): 119 self.__dict__[field].Disable() 120 self.Disable()
121 #------------------------------------------------------------------
122 - def clear_all(self):
123 for field in self.__dict__.keys(): 124 if field.startswith('_CHBOX_'): 125 self.__dict__[field].SetValue(False)
126 #------------------------------------------------------------------
127 - def select(self, indications=None):
128 for indication in indications: 129 try: 130 self.__indication2field[indication].SetValue(True) 131 except KeyError: 132 pass
133 #------------------------------------------------------------------
134 - def _get_selected_indications(self):
135 indications = [] 136 for indication in self.__indication2field.keys(): 137 if self.__indication2field[indication].IsChecked(): 138 indications.append(indication) 139 return indications
140 141 selected_indications = property(_get_selected_indications, lambda x:x) 142 #------------------------------------------------------------------
143 - def _get_has_selection(self):
144 for indication in self.__indication2field.keys(): 145 if self.__indication2field[indication].IsChecked(): 146 return True 147 return False
148 149 has_selection = property(_get_has_selection, lambda x:x)
150 151 #====================================================================== 152 # vaccines related widgets 153 #----------------------------------------------------------------------
154 -def edit_vaccine(parent=None, vaccine=None, single_entry=True):
155 ea = cVaccineEAPnl(parent = parent, id = -1) 156 ea.data = vaccine 157 ea.mode = gmTools.coalesce(vaccine, 'new', 'edit') 158 dlg = gmEditArea.cGenericEditAreaDlg2(parent = parent, id = -1, edit_area = ea, single_entry = single_entry) 159 dlg.SetTitle(gmTools.coalesce(vaccine, _('Adding new vaccine'), _('Editing vaccine'))) 160 if dlg.ShowModal() == wx.ID_OK: 161 dlg.Destroy() 162 return True 163 dlg.Destroy() 164 return False
165 #----------------------------------------------------------------------
166 -def manage_vaccines(parent=None):
167 168 if parent is None: 169 parent = wx.GetApp().GetTopWindow() 170 #------------------------------------------------------------ 171 def delete(vaccine=None): 172 deleted = gmVaccination.delete_vaccine(vaccine = vaccine['pk_vaccine']) 173 if deleted: 174 return True 175 176 gmGuiHelpers.gm_show_info ( 177 _( 178 'Cannot delete vaccine\n' 179 '\n' 180 ' %s - %s (#%s)\n' 181 '\n' 182 'It is probably documented in a vaccination.' 183 ) % ( 184 vaccine['vaccine'], 185 vaccine['preparation'], 186 vaccine['pk_vaccine'] 187 ), 188 _('Deleting vaccine') 189 ) 190 191 return False
192 #------------------------------------------------------------ 193 def edit(vaccine=None): 194 return edit_vaccine(parent = parent, vaccine = vaccine, single_entry = True) 195 #------------------------------------------------------------ 196 def refresh(lctrl): 197 vaccines = gmVaccination.get_vaccines(order_by = 'vaccine') 198 199 items = [ [ 200 u'%s' % v['pk_brand'], 201 u'%s%s' % ( 202 v['vaccine'], 203 gmTools.bool2subst ( 204 v['is_fake_vaccine'], 205 u' (%s)' % _('fake'), 206 u'' 207 ) 208 ), 209 v['preparation'], 210 #u'%s (%s)' % (v['route_abbreviation'], v['route_description']), 211 #gmTools.bool2subst(v['is_live'], gmTools.u_checkmark_thin, u'', u'?'), 212 gmTools.coalesce(v['atc_code'], u''), 213 u'%s%s' % ( 214 gmTools.coalesce(v['min_age'], u'?'), 215 gmTools.coalesce(v['max_age'], u'?', u' - %s'), 216 ), 217 gmTools.coalesce(v['comment'], u'') 218 ] for v in vaccines ] 219 lctrl.set_string_items(items) 220 lctrl.set_data(vaccines) 221 #------------------------------------------------------------ 222 gmListWidgets.get_choices_from_list ( 223 parent = parent, 224 msg = _('\nThe vaccines currently known to GNUmed.\n'), 225 caption = _('Showing vaccines.'), 226 #columns = [ u'#', _('Brand'), _('Preparation'), _(u'Route'), _('Live'), _('ATC'), _('Age range'), _('Comment') ], 227 columns = [ u'#', _('Brand'), _('Preparation'), _('ATC'), _('Age range'), _('Comment') ], 228 single_selection = True, 229 refresh_callback = refresh, 230 edit_callback = edit, 231 new_callback = edit, 232 delete_callback = delete 233 ) 234 #----------------------------------------------------------------------
235 -class cBatchNoPhraseWheel(gmPhraseWheel.cPhraseWheel):
236
237 - def __init__(self, *args, **kwargs):
238 239 gmPhraseWheel.cPhraseWheel.__init__(self, *args, **kwargs) 240 241 context = { 242 u'ctxt_vaccine': { 243 u'where_part': u'AND pk_vaccine = %(pk_vaccine)s', 244 u'placeholder': u'pk_vaccine' 245 } 246 } 247 248 query = u""" 249 SELECT data, field_label, list_label FROM ( 250 251 SELECT distinct on (field_label) 252 data, 253 field_label, 254 list_label, 255 rank 256 FROM (( 257 -- batch_no by vaccine 258 SELECT 259 batch_no AS data, 260 batch_no AS field_label, 261 batch_no || ' (' || vaccine || ')' AS list_label, 262 1 as rank 263 FROM 264 clin.v_pat_vaccinations 265 WHERE 266 batch_no %(fragment_condition)s 267 %(ctxt_vaccine)s 268 ) UNION ALL ( 269 -- batch_no for any vaccine 270 SELECT 271 batch_no AS data, 272 batch_no AS field_label, 273 batch_no || ' (' || vaccine || ')' AS list_label, 274 2 AS rank 275 FROM 276 clin.v_pat_vaccinations 277 WHERE 278 batch_no %(fragment_condition)s 279 ) 280 281 ) AS matching_batch_nos 282 283 ) as unique_matches 284 285 ORDER BY rank, list_label 286 LIMIT 25 287 """ 288 mp = gmMatchProvider.cMatchProvider_SQL2(queries = query, context = context) 289 mp.setThresholds(1, 2, 3) 290 self.matcher = mp 291 292 self.unset_context(context = u'pk_vaccine') 293 self.SetToolTipString(_('Enter or select the batch/lot number of the vaccine used.')) 294 self.selection_only = False
295 #----------------------------------------------------------------------
296 -class cVaccinePhraseWheel(gmPhraseWheel.cPhraseWheel):
297
298 - def __init__(self, *args, **kwargs):
299 300 gmPhraseWheel.cPhraseWheel.__init__(self, *args, **kwargs) 301 302 # consider ATCs in ref.branded_drug and vacc_indication 303 query = u""" 304 SELECT data, list_label, field_label FROM ( 305 306 SELECT DISTINCT ON (data) 307 data, 308 list_label, 309 field_label 310 FROM (( 311 -- fragment -> vaccine 312 SELECT 313 pk_vaccine AS data, 314 vaccine || ' (' || array_to_string(l10n_indications, ', ') || ')' AS list_label, 315 vaccine AS field_label 316 FROM 317 clin.v_vaccines 318 WHERE 319 vaccine %(fragment_condition)s 320 321 ) union all ( 322 323 -- fragment -> localized indication -> vaccines 324 SELECT 325 pk_vaccine AS data, 326 vaccine || ' (' || array_to_string(l10n_indications, ', ') || ')' AS list_label, 327 vaccine AS field_label 328 FROM 329 clin.v_indications4vaccine 330 WHERE 331 l10n_indication %(fragment_condition)s 332 333 ) union all ( 334 335 -- fragment -> indication -> vaccines 336 SELECT 337 pk_vaccine AS data, 338 vaccine || ' (' || array_to_string(indications, ', ') || ')' AS list_label, 339 vaccine AS field_label 340 FROM 341 clin.v_indications4vaccine 342 WHERE 343 indication %(fragment_condition)s 344 ) 345 ) AS distinct_total 346 347 ) AS total 348 349 ORDER by list_label 350 LIMIT 25 351 """ 352 mp = gmMatchProvider.cMatchProvider_SQL2(queries = query) 353 mp.setThresholds(1, 2, 3) 354 self.matcher = mp 355 356 self.selection_only = True
357 #------------------------------------------------------------------
358 - def _data2instance(self):
359 return gmVaccination.cVaccine(aPK_obj = self.GetData())
360 #---------------------------------------------------------------------- 361 from Gnumed.wxGladeWidgets import wxgVaccineEAPnl 362
363 -class cVaccineEAPnl(wxgVaccineEAPnl.wxgVaccineEAPnl, gmEditArea.cGenericEditAreaMixin):
364
365 - def __init__(self, *args, **kwargs):
366 367 try: 368 data = kwargs['vaccine'] 369 del kwargs['vaccine'] 370 except KeyError: 371 data = None 372 373 wxgVaccineEAPnl.wxgVaccineEAPnl.__init__(self, *args, **kwargs) 374 gmEditArea.cGenericEditAreaMixin.__init__(self) 375 376 self.mode = 'new' 377 self.data = data 378 if data is not None: 379 self.mode = 'edit' 380 381 self.__init_ui()
382 #----------------------------------------------------------------
383 - def __init_ui(self):
384 385 # route 386 query = u""" 387 SELECT DISTINCT ON (abbreviation) 388 id, 389 abbreviation || ' (' || _(description) || ')' 390 FROM 391 clin.vacc_route 392 WHERE 393 abbreviation %(fragment_condition)s 394 OR 395 description %(fragment_condition)s 396 ORDER BY 397 abbreviation 398 """ 399 mp = gmMatchProvider.cMatchProvider_SQL2(queries=query) 400 mp.setThresholds(1, 2, 3) 401 self._PRW_route.matcher = mp 402 self._PRW_route.selection_only = True 403 404 #self._PRW_age_min = gmPhraseWheel.cPhraseWheel(self, -1, "", style=wx.NO_BORDER) 405 #self._PRW_age_max = gmPhraseWheel.cPhraseWheel(self, -1, "", style=wx.NO_BORDER) 406 407 self.Layout() 408 self.Fit()
409 #---------------------------------------------------------------- 410 # generic Edit Area mixin API 411 #----------------------------------------------------------------
412 - def _valid_for_save(self):
413 414 has_errors = False 415 416 if self._PRW_brand.GetValue().strip() == u'': 417 has_errors = True 418 self._PRW_brand.display_as_valid(False) 419 else: 420 self._PRW_brand.display_as_valid(True) 421 422 if self._PRW_route.GetData() is None: 423 has_errors = True 424 self._PRW_route.display_as_valid(False) 425 else: 426 self._PRW_route.display_as_valid(True) 427 428 if not self._PNL_indications.has_selection: 429 has_errors = True 430 431 if self._PRW_atc.GetValue().strip() in [u'', u'J07']: 432 self._PRW_atc.display_as_valid(True) 433 else: 434 if self._PRW_atc.GetData() is None: 435 self._PRW_atc.display_as_valid(True) 436 else: 437 has_errors = True 438 self._PRW_atc.display_as_valid(False) 439 440 val = self._PRW_age_min.GetValue().strip() 441 if val == u'': 442 self._PRW_age_min.display_as_valid(True) 443 else: 444 if gmDateTime.str2interval(val) is None: 445 has_errors = True 446 self._PRW_age_min.display_as_valid(False) 447 else: 448 self._PRW_age_min.display_as_valid(True) 449 450 val = self._PRW_age_max.GetValue().strip() 451 if val == u'': 452 self._PRW_age_max.display_as_valid(True) 453 else: 454 if gmDateTime.str2interval(val) is None: 455 has_errors = True 456 self._PRW_age_max.display_as_valid(False) 457 else: 458 self._PRW_age_max.display_as_valid(True) 459 460 # are we editing ? 461 ask_user = (self.mode == 'edit') 462 # is this vaccine in use ? 463 ask_user = (ask_user and self.data.is_in_use) 464 # a change ... 465 ask_user = ask_user and ( 466 # ... of brand ... 467 (self.data['pk_brand'] != self._PRW_route.GetData()) 468 or 469 # ... or indications ? 470 (self.data['indications'] != self._PNL_indications.selected_indications) 471 ) 472 473 if ask_user: 474 do_it = gmGuiHelpers.gm_show_question ( 475 aTitle = _('Saving vaccine'), 476 aMessage = _( 477 u'This vaccine is already in use:\n' 478 u'\n' 479 u' "%s"\n' 480 u' (%s)\n' 481 u'\n' 482 u'Are you absolutely positively sure that\n' 483 u'you really want to edit this vaccine ?\n' 484 '\n' 485 u'This will change the vaccine name and/or target\n' 486 u'conditions in each patient this vaccine was\n' 487 u'used in to document a vaccination with.\n' 488 ) % ( 489 self._PRW_brand.GetValue().strip(), 490 u', '.join(self.data['l10n_indications']) 491 ) 492 ) 493 if not do_it: 494 has_errors = True 495 496 return (has_errors is False)
497 #----------------------------------------------------------------
498 - def _save_as_new(self):
499 # save the data as a new instance 500 data = gmVaccination.create_vaccine ( 501 pk_brand = self._PRW_brand.GetData(), 502 brand_name = self._PRW_brand.GetValue(), 503 indications = self._PNL_indications.selected_indications 504 ) 505 506 # data['pk_route'] = self._PRW_route.GetData() 507 # data['is_live'] = self._CHBOX_live.GetValue() 508 val = self._PRW_age_min.GetValue().strip() 509 if val != u'': 510 data['min_age'] = gmDateTime.str2interval(val) 511 val = self._PRW_age_max.GetValue().strip() 512 if val != u'': 513 data['max_age'] = gmDateTime.str2interval(val) 514 val = self._TCTRL_comment.GetValue().strip() 515 if val != u'': 516 data['comment'] = val 517 518 data.save() 519 520 drug = data.brand 521 drug['is_fake'] = self._CHBOX_fake.GetValue() 522 val = self._PRW_atc.GetData() 523 if val is not None: 524 if val != u'J07': 525 drug['atc_code'] = val.strip() 526 drug.save() 527 528 # must be done very late or else the property access 529 # will refresh the display such that later field 530 # access will return empty values 531 self.data = data 532 533 return True
534 #----------------------------------------------------------------
535 - def _save_as_update(self):
536 537 drug = self.data.brand 538 drug['description'] = self._PRW_brand.GetValue().strip() 539 drug['is_fake'] = self._CHBOX_fake.GetValue() 540 val = self._PRW_atc.GetData() 541 if val is not None: 542 if val != u'J07': 543 drug['atc_code'] = val.strip() 544 drug.save() 545 546 # the validator already asked for changes so just do it 547 self.data.set_indications(indications = self._PNL_indications.selected_indications) 548 549 # self.data['pk_route'] = self._PRW_route.GetData() 550 # self.data['is_live'] = self._CHBOX_live.GetValue() 551 val = self._PRW_age_min.GetValue().strip() 552 if val != u'': 553 self.data['min_age'] = gmDateTime.str2interval(val) 554 if val != u'': 555 self.data['max_age'] = gmDateTime.str2interval(val) 556 val = self._TCTRL_comment.GetValue().strip() 557 if val != u'': 558 self.data['comment'] = val 559 560 self.data.save() 561 return True
562 #----------------------------------------------------------------
563 - def _refresh_as_new(self):
564 self._PRW_brand.SetText(value = u'', data = None, suppress_smarts = True) 565 self._PRW_route.SetText(value = u'intramuscular') 566 # self._CHBOX_live.SetValue(True) 567 self._CHBOX_fake.SetValue(False) 568 self._PNL_indications.clear_all() 569 self._PRW_atc.SetText(value = u'', data = None, suppress_smarts = True) 570 self._PRW_age_min.SetText(value = u'', data = None, suppress_smarts = True) 571 self._PRW_age_max.SetText(value = u'', data = None, suppress_smarts = True) 572 self._TCTRL_comment.SetValue(u'') 573 574 self._PRW_brand.SetFocus()
575 #----------------------------------------------------------------
576 - def _refresh_from_existing(self):
577 self._PRW_brand.SetText(value = self.data['vaccine'], data = self.data['pk_brand']) 578 # self._PRW_route.SetText(value = self.data['route_description'], data = self.data['pk_route']) 579 # self._CHBOX_live.SetValue(self.data['is_live']) 580 self._CHBOX_fake.SetValue(self.data['is_fake_vaccine']) 581 self._PNL_indications.select(self.data['indications']) 582 self._PRW_atc.SetText(value = self.data['atc_code'], data = self.data['atc_code']) 583 if self.data['min_age'] is None: 584 self._PRW_age_min.SetText(value = u'', data = None, suppress_smarts = True) 585 else: 586 self._PRW_age_min.SetText ( 587 value = gmDateTime.format_interval(self.data['min_age'], gmDateTime.acc_years), 588 data = self.data['min_age'] 589 ) 590 if self.data['max_age'] is None: 591 self._PRW_age_max.SetText(value = u'', data = None, suppress_smarts = True) 592 else: 593 self._PRW_age_max.SetText ( 594 value = gmDateTime.format_interval(self.data['max_age'], gmDateTime.acc_years), 595 data = self.data['max_age'] 596 ) 597 self._TCTRL_comment.SetValue(gmTools.coalesce(self.data['comment'], u'')) 598 599 self._PRW_brand.SetFocus()
600 #----------------------------------------------------------------
602 self._refresh_as_new()
603 #====================================================================== 604 # vaccination related widgets 605 #----------------------------------------------------------------------
606 -def edit_vaccination(parent=None, vaccination=None, single_entry=True):
607 ea = cVaccinationEAPnl(parent = parent, id = -1) 608 ea.data = vaccination 609 ea.mode = gmTools.coalesce(vaccination, 'new', 'edit') 610 dlg = gmEditArea.cGenericEditAreaDlg2(parent = parent, id = -1, edit_area = ea, single_entry = single_entry) 611 dlg.SetTitle(gmTools.coalesce(vaccination, _('Adding new vaccinations'), _('Editing vaccination'))) 612 if dlg.ShowModal() == wx.ID_OK: 613 dlg.Destroy() 614 return True 615 dlg.Destroy() 616 if not single_entry: 617 return True 618 return False
619 #----------------------------------------------------------------------
620 -def manage_vaccinations(parent=None):
621 622 pat = gmPerson.gmCurrentPatient() 623 emr = pat.get_emr() 624 625 if parent is None: 626 parent = wx.GetApp().GetTopWindow() 627 #------------------------------------------------------------ 628 def browse2schedules(vaccination=None): 629 dbcfg = gmCfg.cCfgSQL() 630 url = dbcfg.get2 ( 631 option = 'external.urls.vaccination_plans', 632 workplace = gmSurgery.gmCurrentPractice().active_workplace, 633 bias = 'user', 634 default = u'http://www.bundesaerztekammer.de/downloads/ImpfempfehlungenRKI2009.pdf' 635 ) 636 637 webbrowser.open ( 638 url = url, 639 new = False, 640 autoraise = True 641 ) 642 return False
643 #------------------------------------------------------------ 644 def edit(vaccination=None): 645 return edit_vaccination(parent = parent, vaccination = vaccination, single_entry = (vaccination is not None)) 646 #------------------------------------------------------------ 647 def delete(vaccination=None): 648 gmVaccination.delete_vaccination(vaccination = vaccination['pk_vaccination']) 649 return True 650 #------------------------------------------------------------ 651 def refresh(lctrl): 652 653 vaccs = emr.get_vaccinations(order_by = 'date_given DESC, pk_vaccination') 654 655 items = [ [ 656 v['date_given'].strftime('%Y %B %d').decode(gmI18N.get_encoding()), 657 v['vaccine'], 658 u', '.join(v['l10n_indications']), 659 v['batch_no'], 660 gmTools.coalesce(v['site'], u''), 661 gmTools.coalesce(v['reaction'], u''), 662 gmTools.coalesce(v['comment'], u'') 663 ] for v in vaccs ] 664 665 lctrl.set_string_items(items) 666 lctrl.set_data(vaccs) 667 #------------------------------------------------------------ 668 gmListWidgets.get_choices_from_list ( 669 parent = parent, 670 msg = _('\nComplete vaccination history for this patient.\n'), 671 caption = _('Showing vaccinations.'), 672 columns = [ _('Date'), _('Vaccine'), _(u'Intended to protect from'), _('Batch'), _('Site'), _('Reaction'), _('Comment') ], 673 single_selection = True, 674 refresh_callback = refresh, 675 new_callback = edit, 676 edit_callback = edit, 677 delete_callback = delete, 678 left_extra_button = (_('Vaccination Plans'), _('Open a browser showing vaccination schedules.'), browse2schedules) 679 ) 680 #---------------------------------------------------------------------- 681 from Gnumed.wxGladeWidgets import wxgVaccinationEAPnl 682
683 -class cVaccinationEAPnl(wxgVaccinationEAPnl.wxgVaccinationEAPnl, gmEditArea.cGenericEditAreaMixin):
684 """ 685 - warn on apparent duplicates 686 - ask if "missing" (= previous, non-recorded) vaccinations 687 should be estimated and saved (add note "auto-generated") 688 689 Batch No (http://www.fao.org/docrep/003/v9952E12.htm) 690 """
691 - def __init__(self, *args, **kwargs):
692 693 try: 694 data = kwargs['vaccination'] 695 del kwargs['vaccination'] 696 except KeyError: 697 data = None 698 699 wxgVaccinationEAPnl.wxgVaccinationEAPnl.__init__(self, *args, **kwargs) 700 gmEditArea.cGenericEditAreaMixin.__init__(self) 701 702 self.mode = 'new' 703 self.data = data 704 if data is not None: 705 self.mode = 'edit' 706 707 self.__init_ui()
708 #----------------------------------------------------------------
709 - def __init_ui(self):
710 # adjust phrasewheels etc 711 self._PRW_vaccine.add_callback_on_lose_focus(self._on_PRW_vaccine_lost_focus) 712 self._PRW_provider.selection_only = False 713 # self._PRW_batch.unset_context(context = 'pk_vaccine') # done in PRW init() 714 self._PRW_reaction.add_callback_on_lose_focus(self._on_PRW_reaction_lost_focus)
715 #----------------------------------------------------------------
716 - def _on_PRW_vaccine_lost_focus(self):
717 718 vaccine = self._PRW_vaccine.GetData(as_instance=True) 719 720 # if we are editing we do not allow using indications rather than a vaccine 721 if self.mode == u'edit': 722 self._PNL_indications.clear_all() 723 if vaccine is None: 724 self._PRW_batch.unset_context(context = 'pk_vaccine') 725 else: 726 self._PRW_batch.set_context(context = 'pk_vaccine', val = vaccine['pk_vaccine']) 727 self._PNL_indications.select(indications = vaccine['indications']) 728 self._PNL_indications.disable_all() 729 730 # we are entering a new vaccination 731 else: 732 if vaccine is None: 733 self._PRW_batch.unset_context(context = 'pk_vaccine') 734 self._PNL_indications.enable_all() 735 else: 736 self._PRW_batch.set_context(context = 'pk_vaccine', val = vaccine['pk_vaccine']) 737 self._PNL_indications.clear_all() 738 self._PNL_indications.select(indications = vaccine['indications']) 739 self._PNL_indications.disable_all()
740 #----------------------------------------------------------------
742 if self._PRW_reaction.GetValue().strip() == u'': 743 self._BTN_report.Enable(False) 744 else: 745 self._BTN_report.Enable(True)
746 #---------------------------------------------------------------- 747 # generic Edit Area mixin API 748 #----------------------------------------------------------------
749 - def _valid_for_save(self):
750 751 has_errors = False 752 753 if not self._PRW_date_given.is_valid_timestamp(allow_empty = False): 754 has_errors = True 755 756 vaccine = self._PRW_vaccine.GetData(as_instance = True) 757 758 # we are editing, require vaccine rather than indications 759 if self.mode == u'edit': 760 if vaccine is None: 761 has_errors = True 762 self._PRW_vaccine.display_as_valid(False) 763 else: 764 self._PRW_vaccine.display_as_valid(True) 765 self._PNL_indications.clear_all() 766 self._PNL_indications.select(indications = vaccine['indications']) 767 self._PNL_indications.disable_all() 768 # we are creating, allow either vaccine or indications 769 else: 770 if vaccine is None: 771 if self._PNL_indications.has_selection: 772 self._PRW_vaccine.display_as_valid(True) 773 else: 774 has_errors = True 775 self._PRW_vaccine.display_as_valid(False) 776 else: 777 self._PRW_vaccine.display_as_valid(True) 778 779 if self._PRW_batch.GetValue().strip() == u'': 780 has_errors = True 781 self._PRW_batch.display_as_valid(False) 782 else: 783 self._PRW_batch.display_as_valid(True) 784 785 if self._PRW_episode.GetValue().strip() == u'': 786 self._PRW_episode.SetText(value = _('prevention')) 787 788 return (has_errors is False)
789 #----------------------------------------------------------------
790 - def _save_as_new(self):
791 792 vaccine = self._PRW_vaccine.GetData() 793 if vaccine is None: 794 data = self.__save_new_from_indications() 795 else: 796 data = self.__save_new_from_vaccine(vaccine = vaccine) 797 798 # must be done very late or else the property access 799 # will refresh the display such that later field 800 # access will return empty values 801 self.data = data 802 803 return True
804 #----------------------------------------------------------------
806 807 inds = self._PNL_indications.selected_indications 808 vaccine = gmVaccination.map_indications2generic_vaccine(indications = inds) 809 810 if vaccine is None: 811 for ind in inds: 812 vaccine = gmVaccination.map_indications2generic_vaccine(indications = [ind]) 813 data = self.__save_new_from_vaccine(vaccine = vaccine['pk_vaccine']) 814 else: 815 data = self.__save_new_from_vaccine(vaccine = vaccine['pk_vaccine']) 816 817 return data
818 #----------------------------------------------------------------
819 - def __save_new_from_vaccine(self, vaccine=None):
820 821 emr = gmPerson.gmCurrentPatient().get_emr() 822 823 data = emr.add_vaccination ( 824 episode = self._PRW_episode.GetData(can_create = True, is_open = False), 825 vaccine = vaccine, 826 batch_no = self._PRW_batch.GetValue().strip() 827 ) 828 829 if self._CHBOX_anamnestic.GetValue() is True: 830 data['soap_cat'] = u's' 831 else: 832 data['soap_cat'] = u'p' 833 834 data['date_given'] = self._PRW_date_given.GetData() 835 data['site'] = self._PRW_site.GetValue().strip() 836 data['pk_provider'] = self._PRW_provider.GetData() 837 data['reaction'] = self._PRW_reaction.GetValue().strip() 838 data['comment'] = self._TCTRL_comment.GetValue().strip() 839 840 data.save() 841 842 return data
843 #----------------------------------------------------------------
844 - def _save_as_update(self):
845 846 if self._CHBOX_anamnestic.GetValue() is True: 847 self.data['soap_cat'] = u's' 848 else: 849 self.data['soap_cat'] = u'p' 850 851 self.data['date_given'] = self._PRW_date_given.GetData() 852 self.data['pk_vaccine'] = self._PRW_vaccine.GetData() 853 self.data['batch_no'] = self._PRW_batch.GetValue().strip() 854 self.data['pk_episode'] = self._PRW_episode.GetData(can_create = True, is_open = False) 855 self.data['site'] = self._PRW_site.GetValue().strip() 856 self.data['pk_provider'] = self._PRW_provider.GetData() 857 self.data['reaction'] = self._PRW_reaction.GetValue().strip() 858 self.data['comment'] = self._TCTRL_comment.GetValue().strip() 859 860 self.data.save() 861 862 return True
863 #----------------------------------------------------------------
864 - def _refresh_as_new(self):
865 self._PRW_date_given.SetText(data = gmDateTime.pydt_now_here()) 866 self._CHBOX_anamnestic.SetValue(False) 867 self._PRW_vaccine.SetText(value = u'', data = None, suppress_smarts = True) 868 869 self._PNL_indications.clear_all() 870 self._PRW_batch.unset_context(context = 'pk_vaccine') 871 self._PRW_batch.SetValue(u'') 872 873 self._PRW_episode.SetText(value = u'', data = None, suppress_smarts = True) 874 self._PRW_site.SetValue(u'') 875 self._PRW_provider.SetData(data = None) 876 self._PRW_reaction.SetText(value = u'', data = None, suppress_smarts = True) 877 self._BTN_report.Enable(False) 878 self._TCTRL_comment.SetValue(u'') 879 880 self._PRW_date_given.SetFocus()
881 #----------------------------------------------------------------
882 - def _refresh_from_existing(self):
883 self._PRW_date_given.SetText(data = self.data['date_given']) 884 if self.data['soap_cat'] == u's': 885 self._CHBOX_anamnestic.SetValue(True) 886 else: 887 self._CHBOX_anamnestic.SetValue(False) 888 self._PRW_vaccine.SetText(value = self.data['vaccine'], data = self.data['pk_vaccine']) 889 890 self._PNL_indications.clear_all() 891 self._PNL_indications.select(indications = self.data['indications']) 892 self._PNL_indications.disable_all() 893 894 self._PRW_batch.SetValue(self.data['batch_no']) 895 self._PRW_episode.SetData(data = self.data['pk_episode']) 896 self._PRW_site.SetValue(gmTools.coalesce(self.data['site'], u'')) 897 self._PRW_provider.SetData(self.data['pk_provider']) 898 self._PRW_reaction.SetValue(gmTools.coalesce(self.data['reaction'], u'')) 899 if self.data['reaction'] is None: 900 self._BTN_report.Enable(False) 901 else: 902 self._BTN_report.Enable(True) 903 self._TCTRL_comment.SetValue(gmTools.coalesce(self.data['comment'], u'')) 904 905 self._PRW_date_given.SetFocus()
906 #----------------------------------------------------------------
908 self._PRW_date_given.SetText(data = self.data['date_given']) 909 #self._CHBOX_anamnestic.SetValue(False) 910 self._PRW_vaccine.SetText(value = self.data['vaccine'], data = self.data['pk_vaccine']) 911 912 self._PNL_indications.clear_all() 913 self._PNL_indications.select(indications = self.data['indications']) 914 self._PNL_indications.disable_all() 915 916 self._PRW_batch.set_context(context = 'pk_vaccine', val = self.data['pk_vaccine']) 917 self._PRW_batch.SetValue(u'') 918 919 self._PRW_episode.SetData(data = self.data['pk_episode']) 920 self._PRW_site.SetValue(gmTools.coalesce(self.data['site'], u'')) 921 self._PRW_provider.SetData(self.data['pk_provider']) 922 self._PRW_reaction.SetValue(u'') 923 self._BTN_report.Enable(False) 924 self._TCTRL_comment.SetValue(u'') 925 926 self._PRW_date_given.SetFocus()
927 #---------------------------------------------------------------- 928 # event handlers 929 #----------------------------------------------------------------
930 - def _on_report_button_pressed(self, event):
931 932 event.Skip() 933 934 dbcfg = gmCfg.cCfgSQL() 935 936 url = dbcfg.get2 ( 937 option = u'external.urls.report_vaccine_ADR', 938 workplace = gmSurgery.gmCurrentPractice().active_workplace, 939 bias = u'user', 940 default = u'http://www.pei.de/cln_042/SharedDocs/Downloads/fachkreise/uaw/meldeboegen/b-ifsg-meldebogen,templateId=raw,property=publicationFile.pdf/b-ifsg-meldebogen.pdf' 941 ) 942 943 if url.strip() == u'': 944 url = dbcfg.get2 ( 945 option = u'external.urls.report_ADR', 946 workplace = gmSurgery.gmCurrentPractice().active_workplace, 947 bias = u'user' 948 ) 949 950 webbrowser.open(url = url, new = False, autoraise = True)
951 #----------------------------------------------------------------
952 - def _on_add_vaccine_button_pressed(self, event):
953 edit_vaccine(parent = self, vaccine = None, single_entry = False)
954 # FIXME: could set newly generated vaccine here 955 #====================================================================== 956 #======================================================================
957 -class cImmunisationsPanel(wx.Panel, gmRegetMixin.cRegetOnPaintMixin):
958
959 - def __init__(self, parent, id):
960 wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize, wx.RAISED_BORDER) 961 gmRegetMixin.cRegetOnPaintMixin.__init__(self) 962 self.__pat = gmPerson.gmCurrentPatient() 963 # do this here so "import cImmunisationsPanel from gmVaccWidgets" works 964 self.ID_VaccinatedIndicationsList = wx.NewId() 965 self.ID_VaccinationsPerRegimeList = wx.NewId() 966 self.ID_MissingShots = wx.NewId() 967 self.ID_ActiveSchedules = wx.NewId() 968 self.__do_layout() 969 self.__register_interests() 970 self.__reset_ui_content()
971 #----------------------------------------------------
972 - def __do_layout(self):
973 #----------------------------------------------- 974 # top part 975 #----------------------------------------------- 976 pnl_UpperCaption = gmTerryGuiParts.cHeadingCaption(self, -1, _(" IMMUNISATIONS ")) 977 self.editarea = cVaccinationEditArea(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER) 978 979 #----------------------------------------------- 980 # middle part 981 #----------------------------------------------- 982 # divider headings below editing area 983 indications_heading = gmTerryGuiParts.cDividerCaption(self, -1, _("Indications")) 984 vaccinations_heading = gmTerryGuiParts.cDividerCaption(self, -1, _("Vaccinations")) 985 schedules_heading = gmTerryGuiParts.cDividerCaption(self, -1, _("Active Schedules")) 986 szr_MiddleCap = wx.BoxSizer(wx.HORIZONTAL) 987 szr_MiddleCap.Add(indications_heading, 4, wx.EXPAND) 988 szr_MiddleCap.Add(vaccinations_heading, 6, wx.EXPAND) 989 szr_MiddleCap.Add(schedules_heading, 10, wx.EXPAND) 990 991 # left list: indications for which vaccinations have been given 992 self.LBOX_vaccinated_indications = wx.ListBox( 993 parent = self, 994 id = self.ID_VaccinatedIndicationsList, 995 choices = [], 996 style = wx.LB_HSCROLL | wx.LB_NEEDED_SB | wx.SUNKEN_BORDER 997 ) 998 self.LBOX_vaccinated_indications.SetFont(wx.Font(12,wx.SWISS, wx.NORMAL, wx.NORMAL, False, '')) 999 1000 # right list: when an indication has been selected on the left 1001 # display the corresponding vaccinations on the right 1002 self.LBOX_given_shots = wx.ListBox( 1003 parent = self, 1004 id = self.ID_VaccinationsPerRegimeList, 1005 choices = [], 1006 style = wx.LB_HSCROLL | wx.LB_NEEDED_SB | wx.SUNKEN_BORDER 1007 ) 1008 self.LBOX_given_shots.SetFont(wx.Font(12,wx.SWISS, wx.NORMAL, wx.NORMAL, False, '')) 1009 1010 self.LBOX_active_schedules = wx.ListBox ( 1011 parent = self, 1012 id = self.ID_ActiveSchedules, 1013 choices = [], 1014 style = wx.LB_HSCROLL | wx.LB_NEEDED_SB | wx.SUNKEN_BORDER 1015 ) 1016 self.LBOX_active_schedules.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False, '')) 1017 1018 szr_MiddleLists = wx.BoxSizer(wx.HORIZONTAL) 1019 szr_MiddleLists.Add(self.LBOX_vaccinated_indications, 4, wx.EXPAND) 1020 szr_MiddleLists.Add(self.LBOX_given_shots, 6, wx.EXPAND) 1021 szr_MiddleLists.Add(self.LBOX_active_schedules, 10, wx.EXPAND) 1022 1023 #--------------------------------------------- 1024 # bottom part 1025 #--------------------------------------------- 1026 missing_heading = gmTerryGuiParts.cDividerCaption(self, -1, _("Missing Immunisations")) 1027 szr_BottomCap = wx.BoxSizer(wx.HORIZONTAL) 1028 szr_BottomCap.Add(missing_heading, 1, wx.EXPAND) 1029 1030 self.LBOX_missing_shots = wx.ListBox ( 1031 parent = self, 1032 id = self.ID_MissingShots, 1033 choices = [], 1034 style = wx.LB_HSCROLL | wx.LB_NEEDED_SB | wx.SUNKEN_BORDER 1035 ) 1036 self.LBOX_missing_shots.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False, '')) 1037 1038 szr_BottomLists = wx.BoxSizer(wx.HORIZONTAL) 1039 szr_BottomLists.Add(self.LBOX_missing_shots, 1, wx.EXPAND) 1040 1041 # alert caption 1042 pnl_AlertCaption = gmTerryGuiParts.cAlertCaption(self, -1, _(' Alerts ')) 1043 1044 #--------------------------------------------- 1045 # add all elements to the main background sizer 1046 #--------------------------------------------- 1047 self.mainsizer = wx.BoxSizer(wx.VERTICAL) 1048 self.mainsizer.Add(pnl_UpperCaption, 0, wx.EXPAND) 1049 self.mainsizer.Add(self.editarea, 6, wx.EXPAND) 1050 self.mainsizer.Add(szr_MiddleCap, 0, wx.EXPAND) 1051 self.mainsizer.Add(szr_MiddleLists, 4, wx.EXPAND) 1052 self.mainsizer.Add(szr_BottomCap, 0, wx.EXPAND) 1053 self.mainsizer.Add(szr_BottomLists, 4, wx.EXPAND) 1054 self.mainsizer.Add(pnl_AlertCaption, 0, wx.EXPAND) 1055 1056 self.SetAutoLayout(True) 1057 self.SetSizer(self.mainsizer) 1058 self.mainsizer.Fit(self)
1059 #----------------------------------------------------
1060 - def __register_interests(self):
1061 # wxPython events 1062 wx.EVT_SIZE(self, self.OnSize) 1063 wx.EVT_LISTBOX(self, self.ID_VaccinatedIndicationsList, self._on_vaccinated_indication_selected) 1064 wx.EVT_LISTBOX_DCLICK(self, self.ID_VaccinationsPerRegimeList, self._on_given_shot_selected) 1065 wx.EVT_LISTBOX_DCLICK(self, self.ID_MissingShots, self._on_missing_shot_selected) 1066 # wx.EVT_RIGHT_UP(self.lb1, self.EvtRightButton) 1067 1068 # client internal signals 1069 gmDispatcher.connect(signal= u'post_patient_selection', receiver=self._schedule_data_reget) 1070 gmDispatcher.connect(signal= u'vaccinations_updated', receiver=self._schedule_data_reget)
1071 #---------------------------------------------------- 1072 # event handlers 1073 #----------------------------------------------------
1074 - def OnSize (self, event):
1075 w, h = event.GetSize() 1076 self.mainsizer.SetDimension (0, 0, w, h)
1077 #----------------------------------------------------
1078 - def _on_given_shot_selected(self, event):
1079 """Paste previously given shot into edit area. 1080 """ 1081 self.editarea.set_data(aVacc=event.GetClientData())
1082 #----------------------------------------------------
1083 - def _on_missing_shot_selected(self, event):
1084 self.editarea.set_data(aVacc = event.GetClientData())
1085 #----------------------------------------------------
1086 - def _on_vaccinated_indication_selected(self, event):
1087 """Update right hand middle list to show vaccinations given for selected indication.""" 1088 ind_list = event.GetEventObject() 1089 selected_item = ind_list.GetSelection() 1090 ind = ind_list.GetClientData(selected_item) 1091 # clear list 1092 self.LBOX_given_shots.Set([]) 1093 emr = self.__pat.get_emr() 1094 shots = emr.get_vaccinations(indications = [ind]) 1095 # FIXME: use Set() for entire array (but problem with client_data) 1096 for shot in shots: 1097 if shot['is_booster']: 1098 marker = 'B' 1099 else: 1100 marker = '#%s' % shot['seq_no'] 1101 label = '%s - %s: %s' % (marker, shot['date'].strftime('%m/%Y'), shot['vaccine']) 1102 self.LBOX_given_shots.Append(label, shot)
1103 #----------------------------------------------------
1104 - def __reset_ui_content(self):
1105 # clear edit area 1106 self.editarea.set_data() 1107 # clear lists 1108 self.LBOX_vaccinated_indications.Clear() 1109 self.LBOX_given_shots.Clear() 1110 self.LBOX_active_schedules.Clear() 1111 self.LBOX_missing_shots.Clear()
1112 #----------------------------------------------------
1113 - def _populate_with_data(self):
1114 # clear lists 1115 self.LBOX_vaccinated_indications.Clear() 1116 self.LBOX_given_shots.Clear() 1117 self.LBOX_active_schedules.Clear() 1118 self.LBOX_missing_shots.Clear() 1119 1120 emr = self.__pat.get_emr() 1121 1122 t1 = time.time() 1123 # populate vaccinated-indications list 1124 # FIXME: consider adding virtual indication "most recent" to 1125 # FIXME: display most recent of all indications as suggested by Syan 1126 status, indications = emr.get_vaccinated_indications() 1127 # FIXME: would be faster to use Set() but can't 1128 # use Set(labels, client_data), and have to know 1129 # line position in SetClientData :-( 1130 for indication in indications: 1131 self.LBOX_vaccinated_indications.Append(indication[1], indication[0]) 1132 # self.LBOX_vaccinated_indications.Set(lines) 1133 # self.LBOX_vaccinated_indications.SetClientData(data) 1134 print "vaccinated indications took", time.time()-t1, "seconds" 1135 1136 t1 = time.time() 1137 # populate active schedules list 1138 scheds = emr.get_scheduled_vaccination_regimes() 1139 if scheds is None: 1140 label = _('ERROR: cannot retrieve active vaccination schedules') 1141 self.LBOX_active_schedules.Append(label) 1142 elif len(scheds) == 0: 1143 label = _('no active vaccination schedules') 1144 self.LBOX_active_schedules.Append(label) 1145 else: 1146 for sched in scheds: 1147 label = _('%s for %s (%s shots): %s') % (sched['regime'], sched['l10n_indication'], sched['shots'], sched['comment']) 1148 self.LBOX_active_schedules.Append(label) 1149 print "active schedules took", time.time()-t1, "seconds" 1150 1151 t1 = time.time() 1152 # populate missing-shots list 1153 missing_shots = emr.get_missing_vaccinations() 1154 print "getting missing shots took", time.time()-t1, "seconds" 1155 if missing_shots is None: 1156 label = _('ERROR: cannot retrieve due/overdue vaccinations') 1157 self.LBOX_missing_shots.Append(label, None) 1158 return True 1159 # due 1160 due_template = _('%.0d weeks left: shot %s for %s in %s, due %s (%s)') 1161 overdue_template = _('overdue %.0dyrs %.0dwks: shot %s for %s in schedule "%s" (%s)') 1162 for shot in missing_shots['due']: 1163 if shot['overdue']: 1164 years, days_left = divmod(shot['amount_overdue'].days, 364.25) 1165 weeks = days_left / 7 1166 # amount_overdue, seq_no, indication, regime, vacc_comment 1167 label = overdue_template % ( 1168 years, 1169 weeks, 1170 shot['seq_no'], 1171 shot['l10n_indication'], 1172 shot['regime'], 1173 shot['vacc_comment'] 1174 ) 1175 self.LBOX_missing_shots.Append(label, shot) 1176 else: 1177 # time_left, seq_no, regime, latest_due, vacc_comment 1178 label = due_template % ( 1179 shot['time_left'].days / 7, 1180 shot['seq_no'], 1181 shot['indication'], 1182 shot['regime'], 1183 shot['latest_due'].strftime('%m/%Y'), 1184 shot['vacc_comment'] 1185 ) 1186 self.LBOX_missing_shots.Append(label, shot) 1187 # booster 1188 lbl_template = _('due now: booster for %s in schedule "%s" (%s)') 1189 for shot in missing_shots['boosters']: 1190 # indication, regime, vacc_comment 1191 label = lbl_template % ( 1192 shot['l10n_indication'], 1193 shot['regime'], 1194 shot['vacc_comment'] 1195 ) 1196 self.LBOX_missing_shots.Append(label, shot) 1197 print "displaying missing shots took", time.time()-t1, "seconds" 1198 1199 return True
1200 #----------------------------------------------------
1201 - def _on_post_patient_selection(self, **kwargs):
1202 return 1
1203 # FIXME: 1204 # if has_focus: 1205 # wxCallAfter(self.__reset_ui_content) 1206 # else: 1207 # return 1 1208 #----------------------------------------------------
1209 - def _on_vaccinations_updated(self, **kwargs):
1210 return 1
1211 # FIXME: 1212 # if has_focus: 1213 # wxCallAfter(self.__reset_ui_content) 1214 # else: 1215 # is_stale == True 1216 # return 1 1217 #====================================================================== 1218 # main 1219 #---------------------------------------------------------------------- 1220 if __name__ == "__main__": 1221 1222 if len(sys.argv) < 2: 1223 sys.exit() 1224 1225 if sys.argv[1] != u'test': 1226 sys.exit() 1227 1228 app = wx.PyWidgetTester(size = (600, 600)) 1229 app.SetWidget(cATCPhraseWheel, -1) 1230 app.MainLoop() 1231 #====================================================================== 1232