def save_entity(self, session_type, session_id): '''@save_entity This method overrides the identical method from the inherited superclass, 'Base_Data'. Specifically, this method updates an existing entity within the corresponding database table, 'tbl_dataset_entity'. @session_id, is synonymous to 'entity_id', and provides context to update 'modified_xx' columns within the 'tbl_dataset_entity' database table. ''' premodel_settings = self.premodel_data['data']['settings'] premodel_entity = { 'title': premodel_settings.get('session_name', None), 'uid': self.uid, 'id_entity': session_id, } db_save = Save_Entity(premodel_entity, session_type) # save dataset element db_return = db_save.save() # return if db_return['status']: return {'status': True, 'error': None} else: self.list_error.append(db_return['error']) return {'status': False, 'error': self.list_error}
def save_svm_entity(self, session_type): """@save_svm_entity This method saves the current entity into the database, then returns the corresponding entity id. """ svm_entity = { 'title': self.svm_data['data']['settings'].get('svm_title', None), 'uid': self.uid, 'id_entity': None } db_save = Save_Entity(svm_entity, session_type) # save dataset element db_return = db_save.save() # return error(s) if not db_return['status']: self.list_error.append(db_return['error']) return {'status': False, 'id': None, 'error': self.list_error} # return session id elif db_return['status'] and session_type == 'data_new': return {'status': True, 'id': db_return['id'], 'error': None}
def save_entity(self, session_type, session_id): ''' This method overrides the identical method from the inherited superclass, 'Base_Data'. Specifically, this method updates an existing entity within the corresponding database table, 'tbl_dataset_entity'. @session_id, is synonymous to 'entity_id', and provides context to update 'modified_xx' columns within the 'tbl_dataset_entity' database table. ''' premodel_settings = self.premodel_data['data']['settings'] premodel_entity = { 'title': premodel_settings.get('session_name', None), 'uid': self.uid, 'id_entity': session_id, } db_save = Save_Entity(premodel_entity, session_type) # save dataset element db_return = db_save.save() # return if db_return['status']: return {'status': True, 'error': None} else: self.list_error.append(db_return['error']) return {'status': False, 'error': self.list_error}
def save_entity(self, session_type): '''@save_entity This method saves the current entity into the database, then returns the corresponding entity id. ''' premodel_settings = self.premodel_data['data']['settings'] premodel_entity = { 'title': premodel_settings.get('session_name', None), 'uid': self.uid, 'id_entity': None } db_save = Save_Entity(premodel_entity, session_type) # save dataset element db_return = db_save.save() # return error(s) if not db_return['status']: self.list_error.append(db_return['error']) return {'status': False, 'id': None, 'error': self.list_error} # return session id elif db_return['status'] and session_type == 'data_new': return {'status': True, 'id': db_return['id'], 'error': None}
def save_svm_entity(self, session_type, session_id): """@save_svm_entity This method overrides the identical method from the inherited superclass, 'Base_Data'. Specifically, this method updates an existing entity within the corresponding database table, 'tbl_dataset_entity'. @session_id, is synonymous to 'entity_id', and provides context to update 'modified_xx' columns within the 'tbl_dataset_entity' database table. """ svm_entity = { 'title': self.svm_data['data']['settings'].get('svm_title', None), 'uid': self.uid, 'id_entity': session_id, } db_save = Save_Entity(svm_entity, session_type) # save dataset element db_return = db_save.save() # return error(s) if not db_return['status']: self.list_error.append(db_return['error']) return {'status': False, 'error': self.list_error} # return status elif db_return['status'] and session_type == 'data_append': return {'status': True, 'error': None}
def entity(dataset, session_type, userid): '''@entity This method saves the current entity into the database, then returns the corresponding entity id. ''' list_error = [] premodel_settings = dataset['data']['settings'] premodel_entity = { 'title': premodel_settings.get('session_name', None), 'uid': userid, 'id_entity': None } db_save = Save_Entity(premodel_entity, session_type) # save dataset element db_return = db_save.save() # return error(s) if not db_return['status']: list_error.append(db_return['error']) return {'id': None, 'error': list_error} # return session id elif db_return['status'] and session_type == 'data_new': return {'id': db_return['id'], 'error': None}
def save_svm_entity(self, session_type, session_id): svm_entity = {'title': self.svm_data['data']['settings'].get('svm_title', None), 'uid': self.uid, 'id_entity': session_id} db_save = Save_Entity(svm_entity, session_type) # save dataset element db_return = db_save.save() # return error(s) if not db_return['status']: self.list_error.append(db_return['error']) return {'status': False, 'error': self.list_error} # return status elif db_return['status'] and session_type == 'data_append': return {'status': True, 'error': None}
def save_entity(self, session_type, id_entity=None): ''' This method overrides the identical method from the inherited superclass, 'Base_Data'. Specifically, this method updates an existing entity within the corresponding database table, 'tbl_dataset_entity'. @session_id, is synonymous to 'entity_id', and provides context to update 'modified_xx' columns within the 'tbl_dataset_entity' database table. @numeric_model_type, list indices begin at 0, and needs to be corrected by adding 1. This allows the numeric representation of the 'model_type' to relate to another database table, which maps integer values with the corresponding 'model_type' name. The integer column of the mapping table begins at 1. ''' # assign numerical representation numeric_model_type = self.list_model_type.index(self.model_type) + 1 # store entity values in database premodel_settings = self.premodel_data['data']['settings'] premodel_entity = { 'title': premodel_settings.get('session_name', None), 'model_type': numeric_model_type, 'uid': self.uid, } db_save = Save_Entity(premodel_entity, session_type) # save dataset element db_return = db_save.save() # return if db_return['status']: return {'status': True, 'error': None, 'id': db_return['id']} else: self.list_error.append(db_return['error']) return {'status': False, 'error': self.list_error}
def save_entity(self, session_type, id_entity=None): """ This method overrides the identical method from the inherited superclass, 'Base_Data'. Specifically, this method updates an existing entity within the corresponding database table, 'tbl_dataset_entity'. @session_id, is synonymous to 'entity_id', and provides context to update 'modified_xx' columns within the 'tbl_dataset_entity' database table. @numeric_model_type, list indices begin at 0, and needs to be corrected by adding 1. This allows the numeric representation of the 'model_type' to relate to another database table, which maps integer values with the corresponding 'model_type' name. The integer column of the mapping table begins at 1. """ # assign numerical representation numeric_model_type = self.list_model_type.index(self.model_type) + 1 # store entity values in database premodel_settings = self.premodel_data["data"]["settings"] premodel_entity = { "title": premodel_settings.get("session_name", None), "model_type": numeric_model_type, "uid": self.uid, } db_save = Save_Entity(premodel_entity, session_type) # save dataset element db_return = db_save.save() # return if db_return["status"]: return {"status": True, "error": None, "id": db_return["id"]} else: self.list_error.append(db_return["error"]) return {"status": False, "error": self.list_error}