Exemplo n.º 1
0
def covar_handle5():
    covarlned = {'columns': None}
    covarlned['columns'] = string_to_list('TEMP, TAG')
    covarini = ini.InputHandler(name='covarinfo',
                                tablename='covartable',
                                lnedentry=covarlned)
    return covarini
Exemplo n.º 2
0
def covar_handle_3_biomass():
    covarlned = {'columns': None}
    covarlned['columns'] = string_to_list('temp')
    covarini = ini.InputHandler(name='covarinfo',
                                tablename='covartable',
                                lnedentry=covarlned)
    return covarini
    def submit_change(self):
        sender = self.sender()
        self.cbindlned = {
            'column_1': self.lnedColumn1.text().strip(),
            'column_2': self.lnedColumn2.text().strip()
        }
        self.cbindini = ini.InputHandler(name='cbind',
                                         lnedentry=self.cbindlned)
        self.facade.input_register(self.cbindini)
        self.facade.create_log_record('cbind')
        self._log = self.facade._tablelog['cbind']

        if self.previous_click is True:
            self.viewEdit = view.PandasTableModelEdit(None)
        else:
            pass

        try:
            self.cbindtable = hlp.cbind(self.facade._data,
                                        self.cbindlned['column_1'],
                                        self.cbindlned['column_2'])
        except Exception as e:
            print(str(e))
            self.error.showMessage('Could combine column values: ' + str(e))

        hlp.write_column_to_log(self.cbindlned, self._log, 'cbind')

        if sender is self.btnPreview:
            self.viewEdit.set_data(self.cbindtable)
            self.preview.tabviewPreview.setModel(self.viewEdit)
            self.preview.show()
        elif sender is self.btnSaveClose:
            self.facade._data = self.cbindtable
            self.update_data.emit('update')
            self.close()
Exemplo n.º 4
0
        def meta_handler(self):
            '''
            Method to pass the user input about metadata to the mainwindow
            (where the facade class is instantiated).
            '''
            entries = {
                'globalid': int(self.lnedGlobalId.text().strip()),
                'metaurl': self.lnedMetadataUrl.text().strip(),
                'lter': self.cboxLTERloc.currentText().strip()
            }
            self.metaini = ini.InputHandler(name='metacheck',
                                            tablename=None,
                                            lnedentry=entries,
                                            verify=self.verify)

            self.facade.input_register(self.metaini)

            try:
                print(self.metaini.lnedentry['metaurl'])
                self.facade.meta_verify()
                self.webview_url.emit(self.metaini.lnedentry['metaurl'])
                self.message.about(self, 'Status', 'Entries recorded')

            except Exception as e:
                print(str(e))
                self.error.showMessage('Invalid entries: ' + str(e))
                raise LookupError('Invalid metadata entries')
Exemplo n.º 5
0
def covar_handle_2_density():
    covarlned = {'columns': None}
    covarlned['columns'] = string_to_list('AREA, VIS, OBS_CODE')
    covarini = ini.InputHandler(name='covarinfo',
                                tablename='covartable',
                                lnedentry=covarlned)
    return covarini
Exemplo n.º 6
0
def project_handle_1_count():

    studytype = namedtuple('studytype', 'checked entry unit')
    # derived
    derived = namedtuple('derived', 'checked entry unit')
    # treatments
    treatments = namedtuple('treatments', 'checked entry unit')
    # Contacts: author, contact email
    contacts = namedtuple('contacts', 'checked entry unit')
    # Community
    community = namedtuple('community', 'checked entry unit')
    # SamplingFreq
    sampfreq = namedtuple('sampfreq', 'checked entry unit')
    # Datatype/units
    dtype = namedtuple('dtype', 'checked entry unit')
    # organism structure
    structure = namedtuple('structure', 'checked entry unit')
    # Spatial extent
    ext = namedtuple('spatial_ext', 'checked entry unit')

    form_dict = OrderedDict(
        (('samplingunits', dtype(False,
                                 '', None)), ('datatype',
                                              dtype(True, 'count', None)),
         ('structured_type_1', structure(True, 'size',
                                         'cm')), ('structured_type_2',
                                                  structure(False, '', '')),
         ('structured_type_3',
          structure(False, '',
                    '')), ('samplefreq', sampfreq(True, 'month:yr', None)),
         ('studytype', studytype(True, 'obs',
                                 None)), ('community',
                                          community(True, True, None)),
         ('spatial_replication_level_1_extent',
          ext(True, '100',
              'm2')), ('spatial_replication_level_2_extent',
                       ext(True, '10',
                           'm2')), ('spatial_replication_level_3_extent',
                                    ext(False, '', '')),
         ('spatial_replication_level_4_extent',
          ext(False, '', '')), ('spatial_replication_level_5_extent',
                                ext(False, '',
                                    '')), ('treatment_type_1',
                                           treatments(False, 'NULL', None)),
         ('treatment_type_2',
          treatments(False, 'NULL',
                     None)), ('treatment_type_3',
                              treatments(False, 'NULL',
                                         None)), ('derived',
                                                  derived(True, 'no', None)),
         ('authors',
          contacts(True, 'AJ Bibian, TEX Miller',
                   None)), ('authors_contact',
                            contacts(True, '[email protected], [email protected]',
                                     None))))

    main_input = ini.InputHandler(name='maininfo',
                                  tablename='project_table',
                                  lnedentry=form_dict)
    return main_input
Exemplo n.º 7
0
        def file_handler(self):
            '''
            Method to pass  the user input about the file to load
            '''
            lned = {
                'sheet': self.lnedExcelSheet.text().strip(),
                'delim': self.lnedDelimiter.text().strip(),
                'tskip': self.lnedSkipTop.text().strip(),
                'bskip': self.lnedSkipBottom.text().strip(),
                'header': ''
            }
            rbtn = {
                'csv': self.rbtnCsv.isChecked(),
                'xlsx': self.rbtnExcel.isChecked(),
                'txt': self.rbtnTxt.isChecked()
            }
            name = QtGui.QFileDialog.getOpenFileName(self, 'Select File')
            headers = self.ckHeader.isChecked()
            self.fileini = ini.InputHandler(name='fileoptions',
                                            tablename=None,
                                            rbtns=rbtn,
                                            lnedentry=lned,
                                            filename=name,
                                            checks=headers)
            self.facade.input_register(self.fileini)

            try:
                self.facade.load_data()
                self.raw_data_model.emit('loaded_data')
            except Exception as e:
                self.filetypeReceive.emit(str(e))
    def meta_handler(self):
        '''
        Method to verify the user input regarding the metadata
        record (globalid/url) they'll be working from.
        Url is passed to main window up verification.Note,
        take user input and wraps it in a InputHandler class.
        '''
        entries = {
            'globalid': int(self.lnedGlobalId.text().strip()),
            'metaurl': self.lnedMetadataUrl.text().strip(),
            'lter': self.cboxLTERloc.currentText().strip()
        }
        self.metaini = ini.InputHandler(name='metacheck',
                                        tablename=None,
                                        lnedentry=entries,
                                        verify=self.verify)

        self.facade.input_register(self.metaini)

        try:
            print(self.metaini.lnedentry['metaurl'])
            self.facade.meta_verify()
            self.webview_url.emit(self.metaini.lnedentry['metaurl'])
            self.message.about(self, 'Status', 'Entries recorded')

        except Exception as e:
            print(str(e))
            self.error.showMessage('Invalid entries: ' + str(e))
            raise LookupError('Invalid metadata entries')
    def file_handler(self):
        '''
        Method to pass the user input about the file to load.
        Note this is only tested for CSV file: Still have
        to run more test to make it more flexible. Note,
        takes user input and wraps it in a InputHandler class.
        '''
        lned = {
            'sheet': str(self.lnedExcelSheet.text().strip()),
            'delim': str(self.lnedDelimiter.text().strip()),
            'tskip': str(self.lnedSkipTop.text().strip()),
            'bskip': str(self.lnedSkipBottom.text().strip()),
            'header': ''
        }
        rbtn = {
            'csv': self.rbtnCsv.isChecked(),
            'xlsx': self.rbtnExcel.isChecked(),
            'txt': self.rbtnTxt.isChecked()
        }
        name = str(QtGui.QFileDialog.getOpenFileName(self, 'Select File'))
        headers = self.ckHeader.isChecked()
        self.fileini = ini.InputHandler(name='fileoptions',
                                        tablename=None,
                                        rbtns=rbtn,
                                        lnedentry=lned,
                                        filename=name,
                                        checks=headers)
        self.facade.input_register(self.fileini)

        try:
            self.facade.load_data()
            self.raw_data_model.emit('loaded_data')

        except Exception as e:
            raise IOError('Could not load data')
def count_handle2():
    obslned = OrderedDict(
        (('spatial_replication_level_2', 'transect'),
         ('spatial_replication_level_3', ''), ('spatial_replication_level_4',
                                               ''), ('structured_type_1', ''),
         ('structured_type_2', ''), ('structured_type_3', ''),
         ('treatment_type_1', ''), ('treatment_type_2', ''),
         ('treatment_type_3', ''), ('unitobs', 'count')))

    obsckbox = OrderedDict(
        (('spatial_replication_level_2', True), ('spatial_replication_level_3',
                                                 False),
         ('spatial_replication_level_4', False), ('structured_type_1', False),
         ('structured_type_2', False), ('structured_type_3', False),
         ('treatment_type_1', False), ('treatment_type_2', False),
         ('treatment_type_3', False), ('unitobs', True)))
    available = [
        x for x, y in zip(list(obslned.keys()), list(obsckbox.values()))
        if y is True
    ]

    countini = ini.InputHandler(name='rawinfo',
                                tablename='count_table',
                                lnedentry=extract(obslned, available),
                                checks=obsckbox)

    return countini
def taxa_handle2():
    taxalned = OrderedDict(
        (('sppcode', ''), ('kingdom', ''), ('subkingdom', ''),
         ('infrakingdom', ''), ('superdivision', ''), ('divsion', ''),
         ('subdivision', ''), ('superphylum', ''), ('phylum', ''),
         ('subphylum', ''), ('clss', ''), ('subclass', ''), ('ordr', ''),
         ('family', ''), ('genus', 'genus'), ('species', 'species')))

    taxackbox = OrderedDict(
        (('sppcode', False), ('kingdom', False), ('subkingdom', False),
         ('infrakingdom', False), ('superdivision', False), ('divsion', False),
         ('subdivision', False), ('superphylum', False), ('phylum', False),
         ('subphylum', False), ('clss', False), ('subclass', False),
         ('ordr', False), ('family', False), ('genus', True), ('species',
                                                               True)))

    taxacreate = {'taxacreate': False}

    available = [
        x for x, y in zip(list(taxalned.keys()), list(taxackbox.values()))
        if y is True
    ]

    taxaini = ini.InputHandler(name='taxainfo',
                               tablename='taxa_table',
                               lnedentry=extract(taxalned, available),
                               checks=taxacreate)
    return taxaini
Exemplo n.º 12
0
def covar_handle_4_percent_cover():
    covarlned = {'columns': None}
    covarlned['columns'] = string_to_list('Precip')
    covarini = ini.InputHandler(name='covarinfo',
                                tablename='covartable',
                                lnedentry=covarlned)
    return covarini
Exemplo n.º 13
0
def metahandle_bad():
    lentry = {'globalid': 2, 'metaurl': 'http://test', 'lter': 'SBC'}
    ckentry = {}
    metainput = ini.InputHandler(name='metacheck',
                                 tablename=None,
                                 lnedentry=lentry,
                                 checks=ckentry)
    return metainput
Exemplo n.º 14
0
        def submit_change(self):
            self.lter = self.facade._valueregister['lterid']

            # Registering information to facade class
            self.sitelned = {'siteid': self.lnedSiteID.text().strip()}
            self.siteloc['siteid'] = self.lnedSiteID.text().strip()
            self.facade.create_log_record('climatesite')

            self._log = self.facade._tablelog['climatesite']

            if self.ckCreate.isChecked() is True:
                print('Box is checked')
                print('Site line entry: ', self.siteloc['siteid'])
                print('facade data (before): ', self.facade._data)
                self.facade._data[self.siteloc[
                    'study_site_key']] = self.siteloc['study_site_key']
                print('facade data (after): ', self.facade._data)

            else:
                pass

            try:
                self.facade._data[self.siteloc['siteid']]

            except Exception as e:
                print(str(e))
                self._log.debug(str(e))
                self.error.showMessage(self.siteloc['siteid'] +
                                       ' not in dataframe')
                raise KeyError(self.siteloc['siteid'] + ' not in dataframe')

            self.siteini = ini.InputHandler(name='siteinfo',
                                            tablename='sitetable',
                                            lnedentry=self.sitelned,
                                            verify=self.verify)
            self.facade.input_register(self.siteini)

            self.facade._valueregister['siteid'] = self.siteloc['siteid']
            self.message.about(self, 'Status', 'Information recorded')

            # Make table and Register site levels with facade
            self.sitedirector = self.facade.make_table('siteinfo')
            self.rawdata = (self.sitedirector._availdf.sort_values(
                by='siteid'))
            self.facade.register_site_levels(
                self.rawdata['siteid'].drop_duplicates().values.tolist())

            # Performing query
            self.sitelevels = self.facade._valueregister['sitelevels']
            self._log.debug('sitelevels (submit): ' +
                            ' '.join(self.sitelevels))

            # Setting Table Model View
            self.sitetablemodel = self.viewEdit(self.rawdata)
            self.listviewSiteLabels.setModel(self.sitetablemodel)
            self.btnSiteID.setEnabled(False)
def real_data():
    rbtn = {'csv': False, 'xlsx': False, 'txt': True}
    lned = {'sheet': '', 'delim': '\t', 'tskip': '', 'bskip': '', 'header': ''}
    fname = (rootpath + end + 'data' + end + 'SGS_LTER_Humus_canopyCover.txt')
    user_input = ini.InputHandler(name='fileoptions',
                                  lnedentry=lned,
                                  rbtns=rbtn,
                                  filename=fname,
                                  checks=False)
    return user_input
Exemplo n.º 16
0
        def submit_change(self):
            sender = self.sender()
            self.widetolonglned = {
                'value_columns':
                hlp.string_to_list(self.lnedValuecolumns.text()),
                'datatype_name': self.cboxDatatypecolumn.currentText(),
                'panel_data': self.ckPaneldata.isChecked()
            }

            self.widetolongini = ini.InputHandler(
                name='widetolong', lnedentry=self.widetolonglned)
            self.facade.input_register(self.widetolongini)
            self.facade.create_log_record('widetolong')
            self._log = self.facade._tablelog['widetolong']

            try:
                if self.widetolonglned['panel_data'] is False:
                    self.widetolongtable = hlp.wide_to_long(
                        self.facade._data,
                        value_columns=self.widetolonglned['value_columns'],
                        value_column_name=self.widetolonglned['datatype_name'])
                else:
                    temp = self.facade._data.copy()
                    temp['id'] = temp.index
                    self.widetolongtable = wide_to_long(
                        temp,
                        self.widetolonglned['value_columns'],
                        i="id",
                        j=self.widetolonglned['datatype_name'])
                    self.widetolongtable[self.widetolonglned[
                        'datatype_name']] = self.widetolongtable.index.get_level_values(
                            self.widetolonglned['datatype_name'])
                    self.widetolongtable.reset_index(drop=True, inplace=True)
            except Exception as e:
                print(str(e))
                self.error.showMessage('Could not melt data: ', str(e))

            try:
                assert self.widetolonglned['datatype_name'] != 'NULL'
            except Exception as e:
                print(str(e))
                self.error.showMessage('Invalid datatype column: ' + str(e))
                return

            if sender is self.btnPreview:
                self.widetolongmodel = view.PandasTableModel(
                    self.widetolongtable)
                self.preview.tabviewPreview.setModel(self.widetolongmodel)
                self.preview.show()
            elif sender is self.btnSaveClose:
                hlp.write_column_to_log(self.widetolonglned, self._log,
                                        'widetolong')
                self.facade._data = self.widetolongtable
                self.update_data.emit('update')
                self.close()
def user_input():
    rbtn = {'csv': True, 'xlsx': False, 'txt': False}
    lned = {'sheet': '', 'delim': '', 'tskip': '', 'bskip': '', 'header': ''}
    fname = (rootpath + end + 'Datasets_manual_test' + end +
             'raw_data_test_1.csv')
    user_input = ini.InputHandler(name='fileoptions',
                                  lnedentry=lned,
                                  rbtns=rbtn,
                                  filename=fname,
                                  checks=False)
    return user_input
Exemplo n.º 18
0
def file_handle_free():
    ckentry = {}
    rbtn = {'.csv': True, '.txt': False, '.xlsx': False}
    lned = {'sheet': '', 'delim': '', 'tskip': '', 'bskip': '', 'header': ''}
    fileinput = ini.InputHandler(name='fileoptions',
                                 tablename=None,
                                 lnedentry=lned,
                                 rbtns=rbtn,
                                 checks=ckentry,
                                 session=True,
                                 filename=(rootpath + end + 'data' + end +
                                           'PLT-OTH-1509-Garden_1_0.csv'))
    return fileinput
Exemplo n.º 19
0
def file_handle5():
    ckentry = {}
    rbtn = {'.csv': True, '.txt': False, '.xlsx': False}
    lned = {'sheet': '', 'delim': '', 'tskip': '', 'bskip': '', 'header': ''}
    fileinput = ini.InputHandler(
        name='fileoptions',
        tablename=None,
        lnedentry=lned,
        rbtns=rbtn,
        checks=ckentry,
        session=True,
        filename=(rootpath + end + 'test' + end + 'Datasets_manual_test' +
                  end + 'raw_data_test_5.csv'))
    return fileinput
Exemplo n.º 20
0
    def submit_change(self):
        sender = self.sender()
        self.replacevaluelned = {
            'column_name': self.lnedColumnname.text().strip(),
            'value_from': self.lnedFrom.text(),
            'value_to': self.lnedTo.text().strip(),
            'all_columns': self.ckAllcolumns.isChecked()
        }
        self.replacevalueini = ini.InputHandler(
            name='replacevalue', lnedentry=self.replacevaluelned)
        self.facade.input_register(self.replacevalueini)
        self.facade.create_log_record('replacevalue')
        self._log = self.facade._tablelog['replacevalue']

        if self.previous_click is True:
            self.viewEdit = view.PandasTableModelEdit(None)
        else:
            pass

        try:
            if self.replacevaluelned['all_columns'] is True:
                self.replacevaluetable = self.facade._data.replace({
                    self.replacevaluelned['value_from']:
                    self.replacevaluelned['value_to']
                })
            else:
                columntochange = self.replacevaluelned['column_name']
                assert (columntochange is not '') is True
                self.replacevaluetable = self.facade._data.replace({
                    columntochange: {
                        self.replacevaluelned['value_from']:
                        self.replacevaluelned['value_to']
                    }
                })
            self.previous_click = True
        except Exception as e:
            print(str(e))
            self.error.showMessage('Could not replace values: ' + str(e))

        hlp.write_column_to_log(self.replacevaluelned, self._log,
                                'replacevalue')

        if sender is self.btnPreview:
            self.viewEdit.set_data(self.replacevaluetable)
            self.preview.tabviewPreview.setModel(self.viewEdit)
            self.preview.show()
        elif sender is self.btnSaveClose:
            self.facade._data = self.replacevaluetable
            self.update_data.emit('replace_mod')
            self.close()
Exemplo n.º 21
0
def filehandle():
    ckentry = {}
    rbtn = {'.csv': True, '.txt': False, '.xlsx': False}
    lned = {'sheet': '', 'delim': '', 'tskip': '', 'bskip': ''}
    fileinput = ini.InputHandler(
        name='fileoptions',
        tablename=None,
        lnedentry=lned,
        rbtns=rbtn,
        checks=ckentry,
        session=True,
        filename='Datasets_manual_test/raw_data_test_2.csv')

    return fileinput
Exemplo n.º 22
0
def metahandle():
    lentry = {
        'globalid':
        1,
        'metaurl': ('http://sbc.lternet.edu/cgi-bin/showDataset' +
                    '.cgi?docid=knb-lter-sbc.18'),
        'lter':
        'SBC'
    }
    metainput = ini.InputHandler(name='metacheck',
                                 tablename=None,
                                 lnedentry=lentry,
                                 checks=True)
    return metainput
Exemplo n.º 23
0
def time_handle_1_count():
    d = {
        'dayname': 'date',
        'dayform': 'dd-mm-YYYY (Any Order)',
        'monthname': 'date',
        'monthform': 'dd-mm-YYYY (Any Order)',
        'yearname': 'date',
        'yearform': 'dd-mm-YYYY (Any Order)',
        'jd': False,
        'hms': False
    }
    timeini = ini.InputHandler(name='timeinfo',
                               tablename='timetable',
                               lnedentry=d)
    return timeini
Exemplo n.º 24
0
 def commit_data(self):
     ''' Method to call the upload to database command '''
     commithandle = ini.InputHandler(name='updateinfo',
                                     tablename='updatetable')
     self.facade.input_register(commithandle)
     try:
         self.facade.push_merged_data()
         self.actionCommit.setEnabled(False)
         self.message.about(self, 'Status', 'Database transaction complete')
     except Exception as e:
         print(str(e))
         self.facade._tablelog['project_table'].debug(str(e))
         self.error.showMessage('Datbase transaction error: ' + str(e) +
                                '. May need to alter site abbreviations.')
         raise ValueError(str(e))
Exemplo n.º 25
0
def time_handle5():
    d = {
        'dayname': '',
        'dayform': 'NULL',
        'monthname': '',
        'monthform': 'NULL',
        'yearname': 'YEAR',
        'yearform': 'YYYY',
        'jd': False,
        'hms': False
    }
    timeini = ini.InputHandler(name='timeinfo',
                               tablename='timetable',
                               lnedentry=d)
    return timeini
Exemplo n.º 26
0
def meta_handle_free():
    lentry = {
        'globalid':
        312,
        'metaurl':
        ('http://gce-lter.marsci.uga.edu/public/app/dataset_details.asp?accession=PLT-GCES-0706'
         ),
        'lter':
        'GCE'
    }
    ckentry = {}
    metainput = ini.InputHandler(name='metacheck',
                                 tablename=None,
                                 lnedentry=lentry,
                                 checks=ckentry)
    return metainput
Exemplo n.º 27
0
def filehandle():
    ckentry = {}
    rbtn = {'.csv': False, '.txt': False, '.xlsx': True}
    lned = {'sheet': '', 'delim': '', 'tskip': '', 'bskip': ''}
    fileinput = ini.InputHandler(name='fileoptions',
                                 tablename=None,
                                 lnedentry=lned,
                                 rbtns=rbtn,
                                 checks=ckentry,
                                 session=True,
                                 verify='climatesite',
                                 filename=str(os.getcwd()) +
                                 '/Datasets_manual_test/' +
                                 'climate_precip.txt')

    return fileinput
Exemplo n.º 28
0
    def submit_change(self):
        sender = self.sender()
        self.covarlned['columns'] = hlp.string_to_list(self.lnedColumns.text())

        self.covarini = ini.InputHandler(name='covarinfo',
                                         tablename='covartable',
                                         lnedentry=self.covarlned)

        self.facade.input_register(self.covarini)
        self.facade.create_log_record('covartable')
        self._log = self.facade._tablelog['covartable']

        if self.covarlned['columns'][0] == '':
            print('in pass')
            pass
        else:
            try:
                self.facade._data[self.covarlned['columns']]
            except Exception as e:
                print(str(e))
                self._log.debug(str(e))
                self.error.showMessage(
                    'Column names not valid: Check spacing ' + 'and headers.')
                raise ValueError('Column names are incorrect')

        try:
            self.covardata = ddf.DictionaryDataframe(
                self.facade._data,
                self.covarlned['columns']).convert_records()
        except Exception as e:
            print(str(e))
            self._log.debug(str(e))
            self.error.showMessage('Could not concatenate columns')
            raise TypeError('Could not concatenate columns')

        self.facade.push_tables['covariates'] = self.covardata

        if sender is self.btnColumns:
            self.message.about(self, 'Status', 'Columns recorded')
        elif sender is self.btnPreview:
            self.covarmodel = views.PandasTableModelEdit(self.covardata)
            self.preview.tabviewPreview.setModel(self.covarmodel)
            self.preview.show()
        elif sender is self.btnSaveClose:
            hlp.write_column_to_log(self.covarlned, self._log, 'covartable')
            self.close()
Exemplo n.º 29
0
        def submit_change(self):
            sender = self.sender()
            self.addsitecolumn = {'addsite': self.lnedAddsite.text()}

            # Input handler
            self.addsiteini = ini.InputHandler(name='addsite',
                                               lnedentry=self.addsitecolumn)
            self.facade.input_register(self.addsiteini)

            self.sitelabel = self.addsitecolumn['addsite']

            # Logger
            self.facade.create_log_record('addsite')
            self._log = self.facade._tablelog['addsite']

            if sender is self.btnAddsite:
                try:
                    self.facade._data['site_added'] = self.sitelabel
                    self.message.about(self, 'Status', 'Site column added')
                except Exception as e:
                    print(str(e))
                    self._log.debug(str(e))
                    self.error.showMessage('Could create column for sites: ' +
                                           str(e))
                    raise ValueError('Could create column for sites: ' +
                                     str(e))
            if sender is self.btnSaveClose:
                hlp.write_column_to_log(self.addsitecolumn, self._log,
                                        'addsite')
                try:
                    assert 'site_added' in self.facade._data.columns.values.tolist(
                    )
                except Exception as e:
                    print(str(e))
                    raise AttributeError(str(e))
                    self.error.showMessage('Could not add site column: ' +
                                           str(e))
                self.close()
            elif sender is self.btnCancel:
                self.close()