示例#1
0
 def OnReport(self, event):
     flag = False
     mod = adv.advices(self.data)
     adv_dat = mod.get_advices(flag)
     schema_table = (self.getColumnText(self.currentItem, 13))
     schema_table = schema_table.split(':')
     self.schema = schema_table[0]
     self.table = schema_table[1]
     self.stat = statistic.stats(self.schema, self.table)                        
     self.ext_stat = self.stat.take_ext_stat(self.date)
     self.ext_stat = [ i for i in self.ext_stat if i is not None] 
     report_html.make_report(self.columns, self.data, self.ext_cols, self.ext_stat, self.date, adv_dat)
示例#2
0
    def RefrshHist(self):
        self.histres.destr()
        histrows = statistic.stats(self.schema, self.table).history_stat(self)
        self.histres = results.history_stat(self, self.histcols, histrows, self.schema, self.table)

        sb = wx.StaticBox(self.panelHist)
        sbs = wx.StaticBoxSizer(sb, orient=wx.VERTICAL)
        sizer = wx.BoxSizer(wx.VERTICAL)

        sizer.Add(self.histres.list, 1, wx.EXPAND)
        sbs.Add(sizer, proportion=1, flag=wx.EXPAND | wx.ALL)
        self.panelHist.SetSizer(sbs)
        self.panelHist.Layout()
示例#3
0
 def OnExtStat(self, event):
     schema_table = (self.getColumnText(self.currentItem, 13))
     schema_table = schema_table.split(':')
     self.schema = schema_table[0]
     self.table = schema_table[1]
     
     self.stat = statistic.stats(self.schema, self.table)
     orcl = oracle.WorkDB(self.main.connection)
     namecols = orcl.get_cols(self.table)
     namecols.insert(0, u'Название параметра')
     
     try:
         self.ext_list.list.DeleteAllItems()
         self.ext_list.list.Destroy()
     except Exception, info:
         pass
示例#4
0
 def __init__( self, main, rows, ext_cols): 
     self.main = main
     
     self.ext_cols = ext_cols
     
     
     self.ext_cols.insert(0, u'Название параметра')
     data = []
     
     self.list = wx.ListCtrl(self.main.panelMainStat, 0,
                              style=wx.LC_REPORT | wx.BORDER_NONE | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING | wx.LC_SINGLE_SEL)
     self.columns = self.main.main_stat_columns
     for col, text in enumerate(self.columns):
         self.list.InsertColumn(col, text) 
     for item in rows:
         info = '%s:(%s)' % (col, item)
         data.append(info)
         index = self.list.InsertStringItem(sys.maxint, item[0]) 
         for col, text in enumerate(item[1:]): 
             self.list.SetStringItem(index, col+1, text) 
             
     self.list.SetSize((900, 200))        
     self.list.SetColumnWidth(0, 120)   
     self.list.SetColumnWidth(1, 55) 
     self.list.SetColumnWidth(2, 55) 
     self.list.SetColumnWidth(3, 55)
     self.list.SetColumnWidth(4, 55)   
     self.list.SetColumnWidth(5, 55) 
     self.list.SetColumnWidth(6, 55) 
     self.list.SetColumnWidth(7, 55)
     self.list.SetColumnWidth(8, 55)   
     self.list.SetColumnWidth(9, 55) 
     self.list.SetColumnWidth(10, 55) 
     self.list.SetColumnWidth(11, 55)
     self.list.SetColumnWidth(12, 55)
     self.list.SetColumnWidth(13, 180) 
     self.list.SetColumnWidth(14, 120)
     self.list.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick, self.list)
     self.list.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightClick)
     self.list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
     self.itemDataMap = data
     listmix.ColumnSorterMixin.__init__(self, 3)
     self.stat = statistic.stats(self.main.schema, self.main.table)
示例#5
0
    def HistDQ(self, event):
        try:
            logging.info(u"open local history")
            self.panelHist = wx.Panel(self.notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL)
            hist_title = u"История оценки качества данных %s.%s" % (self.schema, self.table)
            self.notebook.AddPage(self.panelHist, hist_title, False, wx.NullBitmap)
            self.histcols = self.main_stat_columns
            histrows = statistic.stats(self.schema, self.table).history_stat(self)
            self.histres = results.history_stat(self, self.histcols, histrows, self.schema, self.table)

            sb = wx.StaticBox(self.panelHist)
            sbs = wx.StaticBoxSizer(sb, orient=wx.VERTICAL)
            sizer = wx.BoxSizer(wx.VERTICAL)

            sizer.Add(self.histres.list, 1, wx.EXPAND)
            sbs.Add(sizer, proportion=1, flag=wx.EXPAND | wx.ALL)
            self.panelHist.SetSizer(sbs)
            self.panelHist.Layout()

        except TypeError, info:
            wx.MessageBox(str(info))
            logging.error(u"error while looking history - code: 289 - %s" % str(info))
示例#6
0
    def __init__(self, parent, columns, rows, schema, table): 
        self.main = parent
        self.schema = schema
        self.table = table
        self.stat = statistic.stats(self.schema, self.table)
    
        self.list = wx.ListCtrl(self.main.panelHist, 0,
                                 style=wx.LC_REPORT
                                 | wx.BORDER_NONE
                                 | wx.LC_EDIT_LABELS
                                 | wx.LC_SORT_ASCENDING
                                 | wx.LC_SINGLE_SEL, pos=(1,1)
                                 )
        self.columns = columns          
        for col, text in enumerate(columns):
            self.list.InsertColumn(col, text) 
        for item in rows:   
            index = self.list.InsertStringItem(sys.maxint, item[0]) 
            for col, text in enumerate(item[1:]): 
                self.list.SetStringItem(index, col+1, text) 
        self.list.SetColumnWidth(0, 120)   
        self.list.SetColumnWidth(1, 55) 
        self.list.SetColumnWidth(2, 55) 
        self.list.SetColumnWidth(3, 55)
        self.list.SetColumnWidth(4, 55) 
        self.list.SetColumnWidth(5, 55)
        self.list.SetColumnWidth(6, 55) 
        self.list.SetColumnWidth(7, 55)
        self.list.SetColumnWidth(8, 55) 
        self.list.SetColumnWidth(9, 55)
        self.list.SetColumnWidth(10, 55) 
        self.list.SetColumnWidth(11, 55)
        self.list.SetColumnWidth(12, 55) 
        self.list.SetColumnWidth(13, 180)
        self.list.SetColumnWidth(14, 55)

        self.list.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.OnRightClick)
        self.list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
示例#7
0
	def mathDQ(self, weights, using_params, user_choice_catalog, user_number_allfields, user_number_composite_fileds, user_days_can_be, list_of_fields, schema, table):
		self.table = table
		self.schema = schema
		logging.info(u'starting calculation data quality model')
		self.data = []
		dt = datetime.now()
		timedq = dt.strftime('%Y.%m.%d-%H-%M-%S')
		self.data.append(timedq)
		sql = sqlite.sqliteDB(self.schema, self.table)
		stat = statistic.stats(self.schema, self.table)
		orcl = oracle.WorkDB(self.connection)
		self.countall = orcl.get_all_count(self.schema, self.table)
		self.weights = weights
		self.using_params = using_params
		if self.weights is None or self.weights == []:
			wx.MessageBox(u'Выберите параметры оценки прежде чем запускать оценку качества данных.')
			return None
		for i in range(len(self.weights)):
			self.weights[i] = float(self.weights[i])

		self.namecols = orcl.get_cols(self.table)
		
		# Пустые значения
		if self.using_params[0] == 1:
			# Количество значений подпадающих под критерий
			count0 = orcl.get_empty_values(self.schema, self.table)
			count0 = count0 * self.weights[0]
			emptyvalues = count0 / self.countall * 100
			emptyvalues = str(round(emptyvalues, 2))
			self.data.append(emptyvalues)
		else:
			emptyvalues = 100
			self.data.append(u'-')

		self.extend_stat = []


		# Не несущие информации значения
		try:
			if self.using_params[1] == 1:
				count1 = []
				param = 'no_information'
				regexp = sql.take_regexps(param)
				for col in self.namecols:
					count1.append(0.0)
					for reg in regexp:
						if col in reg:
							col_index = self.namecols.index(col)
							count1[col_index] = orcl.get_regexp_count(self.schema, self.table, reg)
				avgnoinf = (sum(count1) / len(count1)) * self.weights[1]
				avgnoinf = float(avgnoinf)
				avgnoinf = avgnoinf / self.countall * 100
				avgnoinf = str(round(avgnoinf, 2))
				self.data.append(avgnoinf)
				
				
				# Расчет расширенной статистики по колонкам
				ext_stat = []
				info = [u'Не несущие значения']
				for i in count1:
					if i == 0.0 and type(i) is float:
						ext_stat.append('-')
					else:
						ext_stat.append(str(round((float(i) / self.countall * 100),2)))
				
				for i in ext_stat:
					info.append(i)
				self.extend_stat.append(info)
				logging.info(u'not informable parameter calculation successfully')
			else:
				avgnoinf = 100
				self.data.append(u'-')
				self.extend_stat.append(None)
		except Exception, info:
			logging.error(u'not informable parameter calculation failed: %s' % str(info))