Package Gnumed :: Package wxpython :: Package patient :: Module gmGP_ClinicalSummary
[frames] | no frames]

Source Code for Module Gnumed.wxpython.patient.gmGP_ClinicalSummary

  1  # -*- coding: utf-8 -*- 
  2   
  3  import wx 
  4   
  5  try: 
  6          import cDividerCaption        #panel class to display sub-headings or divider headings 
  7          import cAlertCaption          #panel to hold flashing 
  8          import gmPlugin_Patient 
  9          from gmPatientHolder import PatientHolder 
 10          import gmDispatcher 
 11   
 12  except Exception: 
 13          print  "import error" 
 14          sys.path.append('../') 
 15          sys.path.append('../../pycommon') 
 16          sys.path.append('../../business') 
 17          import gmGuiElement_DividerCaptionPanel        #panel class to display sub-headings or divider headings 
 18          import gmGuiElement_AlertCaptionPanel          #panel to hold flashing 
 19          import gmPlugin_Patient 
 20  #-------------------------------------------------------------------- 
 21  # A class for displaying a summary of patients clinical data in the 
 22  # form of a social history, family history, active problems, habits 
 23  # risk factos and an inbox 
 24  # This code is shit and needs fixing, here for gui development only 
 25  # TODO:almost everything 
 26  #-------------------------------------------------------------------- 
 27   
 28  ID_OVERVIEW = wxNewId () 
 29  ID_OVERVIEWMENU = wxNewId () 
 30   
31 -class ClinicalSummary(wxPanel, PatientHolder):
32 - def __init__(self, parent,id):
33 wxPanel.__init__(self,parent,id,wxDefaultPosition,wxDefaultSize,style = wxRAISED_BORDER) 34 PatientHolder.__init__(self) 35 #------------------------------------------------------------------------ 36 #import social history if available this will be the top item on the page 37 #------------------------------------------------------------------------ 38 try: 39 import gmGP_SocialHistory 40 self.socialhistory = gmGP_SocialHistory.SocialHistory(self,-1) 41 except Exception: 42 pass 43 #------------------------------------------------------------------------ 44 #import social history if available this will be the top item on the page 45 #------------------------------------------------------------------------ 46 try: 47 import gmGP_FamilyHistorySummary 48 self.familyhistorysummary = gmGP_FamilyHistorySummary.FamilyHistorySummary(self,-1) 49 except Exception: 50 pass 51 #--------------------------------------- 52 #import active problem list if available 53 #--------------------------------------- 54 try: 55 import gmGP_ActiveProblems 56 self.activeproblemlist = gmGP_ActiveProblems.ActiveProblems(self,-1) 57 except Exception: 58 pass 59 #------------------------------ 60 #import habits and risk factors 61 #------------------------------ 62 try: 63 import gmGP_HabitsRiskFactors 64 self.habitsriskfactors = gmGP_HabitsRiskFactors.HabitsRiskFactors(self,-1) 65 except Exception: 66 pass 67 #------------ 68 #import inbox 69 #------------ 70 try: 71 import gmGP_Inbox 72 self.inbox = gmGP_Inbox.Inbox(self,-1) 73 except Exception: 74 sys.exit(0) 75 pass 76 77 self.heading1 = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Active Problems" )) 78 self.heading2 = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_(" Habits Risk Factors")) 79 self.heading3 = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Inbox")) 80 self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1,_(" Alerts ")) 81 #------------------------------------------------------------ 82 #now that we have all the elements, construct the whole panel 83 #------------------------------------------------------------ 84 # FIXME: NO !! maybe we DON'T have all the elements ... 85 self.sizer = wxBoxSizer(wxVERTICAL) 86 self.sizer.Add(self.socialhistory,5,wxEXPAND) 87 self.sizer.Add(self.familyhistorysummary,5,wxEXPAND) 88 self.sizer.Add(self.heading1,0,wxEXPAND) 89 self.sizer.Add(self.activeproblemlist,8,wxEXPAND) 90 self.sizer.Add(self.heading2,0,wxEXPAND) 91 self.sizer.Add(self.habitsriskfactors,5,wxEXPAND) 92 self.sizer.Add(self.heading3,0,wxEXPAND) 93 self.sizer.Add(self.inbox,5,wxEXPAND) 94 self.sizer.Add(self.alertpanel,0,wxEXPAND) 95 self.SetSizer(self.sizer) #set the sizer 96 self.sizer.Fit(self) #set to minimum size as calculated by sizer 97 self.SetAutoLayout(True) #tell frame to use the sizer 98 self.Show(True) 99 gmDispatcher.connect(self._updateActiveProblemsUI, 'clin_history_updated')
100
101 - def _updateUI(self):
102 self._updateActiveProblemsUI()
103
104 - def _updateActiveProblemsUI(self):
105 # remember wxCallAfter 106 clinical = self.patient.emr.get_past_history() 107 list = clinical.get_active_history() 108 newList = [] 109 for id, v in list: 110 newList.append( [id, clinical.short_format( v) ]) 111 self.activeproblemlist.SetData(newList, fitClientSize = 1)
112 113 #============================================================
114 -class gmGP_ClinicalSummary (gmPlugin_Patient.wxPatientPlugin):
115 """Plugin to encapsulate the clinical summary. 116 """ 117 118 __icons = { 119 """icon_clinical_summary""": "x\xda]\x93IS\xab@\x14\x85\xf7\xfe\n\xaaP\xf3J4\x05\xf4\x88SIC\xe3\xca\xb8H\ 120 \x95e\xb9s\xc0Y\x89q\xf6\xd7?\xee\xb9mLrO6\xdfI\xf7\x9d\x80\x7f\x8f\x93le<\ 121 \xc8t\xd4\xff\xb4\x8a\xb2\xc1\xca\xf9x\xf0\x19]F\xb1\xb7F\xa6\xcco\xc4\x95\ 122 \xd5*\xcd\xc15q\x99\x15\xc22g\xc4\xb2&\x81\x87\xc4i\x1f2\x05\xdf\x10\x9b\\\ 123 \x17\xca\x83\xbfq\xbf0B0\x9f\x11\x17N\xe9\x8c\xeb\xe5\xc4H'\xc1\x15\xcek]\n\ 124 \xce\xb7Ol\x9d\x15\xa6\x04\x9f\xe0~\xa5lf\xc0/8_\x93\xc0-q\xd3\x98&\xe5\xfb\ 125 \x92\x99\x02\xdc\x81\xbd\xd7\x15\xe7\xdb\n\xf9{\x81\xd70\x7f\xe3\xaaR\x83\r\ 126 \xd8\xe8\xdf\xfd|\xa1\xbe\xb4\xd6p\xbd+\xb0\xd6Y\xce\xf3\x8d\x89\x1d\x02|\ 127 \x8ez\xda\xb8\xd0\xcf3X\xd5\xbe\xe2y-\xea{\xd9d\x02\xdc\x10+\xa7\xa4\xe4\xfb\ 128 \xab\xf8\xbf\xb0}A\xf0-\xf6\xe5u\x13\xfa\xb9\x04[]\x05\xde@\xfe\xda\xab\xaa\ 129 \x00\xaf\xcf\x98\xe7\xfd@>%Ex\xbe%\xfa-I`\x85yj\x128\xc6\xf9\x94\x04\xbe\xe3\ 130 \xfed!8\x7f\x8a\xe7\xedH\xe0{\xf4\xe3\xb4\x0f\xfd\x8cx\x9f\xda\x86z\xa7x\xdf\ 131 D\xe5\x9d\x02\xef\"\xbf0\xde\xf0|\x9b\xa8\x9fZm8\xff#\xee\xa7\xa5/\x98w\x88\ 132 \x85!\x81\x0b\xe4KI\xe0\x0b\xcc\x9b\xd6e\xc5\xfc\x84|\xb9\xcd\r\xd7w\xfc\xfc\ 133 g\xef\xc7!\xe6\xf7$\xb0@?\x92\x04\x8ez\x1eu\xcf-\xe0 ,S\x87\xe5\x1e\xcf\x98\ 134 \x97w\x8ddU\xe9\n\x1e\xee\x1d\xff\x0b\x12\xf8\x07\xcd\x14\xf6wY\xaf\xfc\xf2\ 135 \xeb2,\xeb\x01\xcb\xec\x97\xa5\x98\x13,\xdb\x92\xc0{8\xdf\x90\xc0\x1a\xcd\"\ 136 \xc0\x13^\xae\xc9C\xbe)\xf7g|\x18v\x1b\xf9\xad1\x86_\xee#\xfex\xb4\x0f\x1f[\ 137 \xb4\x14\x7f\xe6\xb0\x8fesx\xdau\xc7\xc9\xb2y\xd0u]\xbcd\xae\xae\xadw\x1b\ 138 \x8b'\xf7\xb6v\xb6\xf77w\xb3y3\x17Ri)\xfb\x0e\xe3bf\x0e\xa5\x94\xe9K\xfc\xd9\ 139 \xb6\xd3\xb7\xef?\xf3]\xca\xbbI\xdb\xb6\xe7\xafW3\xf3\xfaF\xc6\xb7\xbdw\xff\ 140 \xf0\x98\xcc\xcc\xe3\x9f\xaf\xcb\xdek?.\x9e\xe7\xcd\xa7\xa3\xd1\xd4\xb9\x93$\ 141 \x89\xe6\xcc\xbev\\\x9d\xc9\xa4\\4\x11\xc9\xf8\xcf\xac\x9b$\xc4\xe1\xc2\x96\ 142 \x16W7\xfc\x0f\xc1\x87.\xac" 143 } 144
145 - def name (self):
146 return 'Clinical Summary'
147
148 - def MenuInfo (self):
149 return ('view', _('&Summary'))
150
151 - def GetIconData(self, anIconID = None):
152 if anIconID == None: 153 return self.__icons[_("""icon_clinical_summary""")] 154 else: 155 if anIconID in self.__icons: 156 return self.__icons[anIconID] 157 else: 158 return self.__icons[_("""icon_clinical_summary""")]
159
160 - def GetWidget (self, parent):
161 return ClinicalSummary (parent, -1)
162
163 - def register (self):
164 gmPlugin_Patient.wxPatientPlugin.register (self) 165 self.gb['clinical.manager'].SetDefault(self.__class__.__name__)
166 #---------------------------------------------------------------------- 167 if __name__ == "__main__": 168 sys.path.append('../../wxpython') 169 app = wxPyWidgetTester(size = (400, 500)) 170 app.SetWidget(ClinicalSummary, -1) 171 app.MainLoop() 172