Esempio n. 1
0
 def add_sensor_notification(self, notification_message):
     Base.metadata.create_all(engine)
     session = Session()
     notification = Notification(notification_message)
     session.add(notification)
     session.commit()
     session.close()
 def add_detection_result_image(self, name, detection_result_id, type_id):
     Base.metadata.create_all(engine)
     session = Session()
     image = ImageAttachment(name, detection_result_id, type_id)
     session.add(image)
     session.commit()
     session.close()
 def add_reading(self, temperature_reading, humidity_reading):
     Base.metadata.create_all(engine)
     session = Session()
     reading = SensorsReading(humidity_reading, temperature_reading)
     session.add(reading)
     session.commit()
     session.close()
Esempio n. 4
0
 def add_movement(self, movement):
     Base.metadata.create_all(engine)
     session = Session()
     session.add(movement)
     session.commit()
     generated_id = movement.id
     session.close()
     return generated_id
Esempio n. 5
0
 def add_movement_notification(self, notification_entity):
     Base.metadata.create_all(engine)
     session = Session()
     session.add(notification_entity)
     session.commit()
     generated_id = notification_entity.id
     session.close()
     return generated_id
Esempio n. 6
0
 def add_detection_result_with_image(self, detection_result):
     Base.metadata.create_all(engine)
     session = Session()
     session.add(detection_result)
     session.commit()
     generated_id = detection_result.id
     session.close()
     return generated_id
 def get_all_people_connected_to_neural_network(self, nn_id):
     result = []
     Base.metadata.create_all(engine)
     session = Session()
     people = session.query(NeuralNetworkPerson).filter_by(neural_network_id=nn_id)
     session.close()
     for p in people:
         result.append(p.person_id)
     return result
 def complete_with_error(self, id):
     Base.metadata.create_all(engine)
     session = Session()
     requests = session.query(Detection).filter_by(id=id)
     for req in requests:
         req.statusId = 4
         req.completionTime = datetime.datetime.now()
     session.commit()
     session.close()
Esempio n. 9
0
 def get_people_ids_with_images_count(self):
     result = []
     Base.metadata.create_all(engine)
     session = Session()
     people = session.query(Person)
     session.close()
     for p in people:
         result.append([p.id, len(p.images)])
     return result
Esempio n. 10
0
 def get_azure_file_connected_to_neural_network(self, nn_id):
     Base.metadata.create_all(engine)
     session = Session()
     result = session.query(NeuralNetworkFile).filter(
         NeuralNetworkFile.neuralNetworkId == nn_id,
         NeuralNetworkFile.neuralNetworkTypeId ==
         self.nnTypes.azure_large_group_id).first()
     session.close()
     return result
Esempio n. 11
0
 def complete_request(self, request_id):
     Base.metadata.create_all(engine)
     session = Session()
     requests = session.query(Recognition).filter_by(id=request_id)
     for req in requests:
         req.statusId = 3
         req.completionTime = datetime.datetime.now()
     session.commit()
     session.close()
Esempio n. 12
0
 def get_completed_neural_networks_ids_with_downloadable_files_count(self):
     result = []
     Base.metadata.create_all(engine)
     session = Session()
     neural_networks = session.query(NeuralNetwork).filter_by(statusId=3)
     session.close()
     for nn in neural_networks:
         result.append([
             nn.id,
             len([x for x in nn.files if x.neuralNetworkTypeId < 4])
         ])
     return result
Esempio n. 13
0
 def add_neural_network_file(self, neural_network_file: NeuralNetworkFile):
     Base.metadata.create_all(engine)
     session = Session()
     session.add(neural_network_file)
     session.commit()
     session.close()
Esempio n. 14
0
 def get_all(self):
     Base.metadata.create_all(engine)
     session = Session()
     people = session.query(Person)
     session.close()
     return people.all()
Esempio n. 15
0
 def get_by_id(self, id):
     Base.metadata.create_all(engine)
     session = Session()
     person = session.query(Person).filter_by(id=id).first()
     session.close()
     return person
 def get_all_not_completed(self):
     Base.metadata.create_all(engine)
     session = Session()
     requests = session.query(Detection).filter_by(statusId=1)
     session.close()
     return requests
 def add_recognition_result(self, recognition_result):
     Base.metadata.create_all(engine)
     session = Session()
     session.add(recognition_result)
     session.commit()
     session.close()