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

Source Code for Module Gnumed.wxpython.patient.gmGP_ClinicalSummary

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