def update(self, _id, field, value):
     Database.update("chat", {
         "filter": {
             "messageId": _id
         },
         "update": {
             "$set": {
                 field: value
             }
         }
     })
Beispiel #2
0
 def update(self, _id, field, value):
     Database.update("users", {
         "filter": {
             "_id": _id
         },
         "update": {
             "$set": {
                 field: value
             }
         }
     })
Beispiel #3
0
 def update(self, _id, field, value):
     base.update("reports", {
         "filter": {
             "reportId": _id
         },
         "update": {
             "$set": {
                 field: value
             }
         }
     })
Beispiel #4
0
    def __init__(self, widget):
        super().__init__()
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.widget = widget

        # set records_holder
        sl_model = QStringListModel()
        self.ui.records_holder.setModel(sl_model)

        # set ear detector
        self.camera = Camera(4, self.ui.camera_holder.width(),
                             self.ui.camera_holder.height())
        self.recognizer = Recognizer()

        # set update timer
        self.fps = 60
        self.timer = QTimer(self)
        self.timer.timeout.connect(self.update)
        self.timer.start(1000 // self.fps)

        # set updater
        self.updater = Updater(
            self.ui,
            Database(host='localhost',
                     database='eardoor',
                     user='******',
                     password='******',
                     table='records'), sl_model)
Beispiel #5
0
 def set_score(cls, reportId, score):
     data = base.find_one("reports", {"reportId": reportId})
     if data is not None:
         query = {
             "filter": {
                 "reportId": reportId
             },
             "update": {
                 "$set": {
                     "reportScore": score
                 }
             }
         }
         base.update("reports", query)
         return True
     else:
         return False
Beispiel #6
0
 def get_report_status_per_user(cls, reportOwner, state):
     data = base.find("reports", {
         "reportOwner": {
             "$eq": reportOwner
         },
         "status": {
             "$eq": state
         }
     })
     if data is not None:
         return data.count()
 def get_user_initial_messages(cls, messageOwner):
     data = Database.find("chat", {
         "messageOwner": {
             "$eq": messageOwner
         },
         "replymessageId": {
             "$eq": None
         }
     })
     if data is not None:
         return data
Beispiel #8
0
 def get_reports_queue(reportOwner):
     data = base.find("reports", {
         "reportOwner": {
             "$eq": reportOwner
         },
         "status": {
             "$eq": 0
         }
     })
     if data is not None:
         return data.count() + 1
 def get_instantadmin_messages():
     data = Database.find("chat", {"instantMessage": {"$eq": 1}})
     if data is not None:
         return list(data)
 def get_message_by_messageOwner(cls, owner):
     data = Database.find("chat", {"messageOwner": owner})
     if data is not None:
         return list(data)
 def get_message_byDate(cls, messageDate):
     data = Database.find("chat", {"messageDate": messageDate})
     if data is not None:
         return list(data)
Beispiel #12
0
 def get_notifications_by_owner_id(cls, notiOwner):
     data = base.find("notification", {"notiOwner": notiOwner})
     if data is not None:
         return list(data)
 def get_all_messages():
     data = Database.find("chat", {})
     if data is not None:
         return list(data)
 def get_message(cls, messageId):
     data = Database.find_one("chat", {"messageId": messageId})
     if data is not None:
         return data
 def delete(self, messageId):
     Database.delete("chat", {"messageId": messageId})
Beispiel #16
0
import asyncio
from utils.Database import Database

db = Database()


class DBQuery:
    @staticmethod
    def getPlayer(faceit_id):
        seq = {'faceit_id': faceit_id}
        cmd = """
      SELECT * FROM players WHERE faceit_id = %(faceit_id)s;
    """

        return db.contains(cmd, seq)

    @staticmethod
    def insertOrUpdate(faceit_id, nickname):
        seq = {
            'faceit_id': faceit_id,
            'nickname': nickname,
        }
        cmd = """
      INSERT INTO players
        (faceit_id, nickname)  VALUES (%(faceit_id)s, %(nickname)s)
      ON DUPLICATE KEY UPDATE
        nickname = %(nickname)s
    """
        db.execute(cmd, seq)

    @staticmethod
Beispiel #17
0
 def get_only_email(self, email):
     data = Database.find_one("users", {"email": email})
     if data is not None:
         return data['email']
     else:
         return None
Beispiel #18
0
from routes import *
from flask import Flask, request, url_for
from flask import render_template, redirect
from utils.Database import Database
import os
import json
from flask import send_from_directory

app = Flask(__name__)
app.register_blueprint(routes)
db = Database("inventorymanagementsystem", "9993Rev!lo")


@app.route('/favicon.ico')
def favicon():
    return send_from_directory(os.path.join(app.root_path, 'static'),
                               'favicon.ico',
                               mimetype='image/vnd.microsoft.icon')


@app.route("/login", methods=["GET", "POST"])
def login():
    username = request.form.get("username")
    password = request.form.get("pass")
    service = request.form.get("service")
    values = db.selectSpecificItemsFromDb("users",
                                          "AND",
                                          username=username,
                                          password=password)

    if len(values) == 0:
Beispiel #19
0
def initial():
	base.initialize()
Beispiel #20
0
from flask import render_template
from . import routes
from utils.Database import Database
import utils.tables as tb
from flask import jsonify
from flask import request
import requests
import json
from datetime import datetime

db = Database("inventorymanagementsystem", "9993revilo")


@routes.route('/management')
def management():
    return render_template("head_dashboard.html")


def getItemNameByID(id):
    sql = tb.selectProductnameById.format(id)
    response = db.selectAllFromtables(sql)
    return response[0]


@routes.route("/getsystemusers", methods=["POST", "GET"])
def getSystemUsers():
    sql = "SELECT u.id, e.firstname,u.phone,u.access_rights,u.username FROM users AS u JOIN employees AS e ON u.userid = e.id"
    response = db.selectAllFromtables(sql)
    return jsonify(response)

Beispiel #21
0
)

from utils.Metadata import Metadata
from utils.Database import Database
from utils.outlier import isOutlier

import pandas as pd
import numpy as np
from matplotlib.ticker import FuncFormatter

import matplotlib.pyplot as plt
import math
plt.style.use('classic')

meta = Metadata()
db = Database()

dfOpt = meta.dfOptimos()

dfEjec = meta.dfEjecuciones(db.getEjecucionesResultados())
dfEjec = dfEjec.merge(dfOpt, how='left', on='instance').set_index(['id_ejec'])
tabla = dfEjec

# cambiamos algorithm a categorical - para mantener este orden en los gráficos -
jerarquia = ['GWO', 'GWOQL', 'ANTHH GWO', 'ANTHHQL GWO']
tabla["algorithm"] = pd.Categorical(tabla["algorithm"], jerarquia)

# calculo de tiempo de ejecución
tabla['exec_time_min'] = (tabla.date_end -
                          tabla.date_start).astype('timedelta64[m]')
tabla['exec_time_hour'] = tabla.exec_time_min / 60
Beispiel #22
0
 def get_all_notification_of_user(cls, Owner):
     data = base.find("notification", {"notiOwner": {"$eq": Owner}})
     return list(data)
 def get_allusers_messages():
     data = Database.find("chat", {"instantMessage": {"$eq": 0}})
     if data is not None:
         return list(data)
Beispiel #24
0
        conn.send(message.encode())

    except Exception as ex:
        print(ex)

    finally:
        if db is not None:  # db 연결 끊기
            db.close()
        conn.close()


if __name__ == '__main__':

    # 질문/답변 학습 디비 연결 객체 생성
    db = Database(host=DB_HOST,
                  user=DB_USER,
                  password=DB_PASSWORD,
                  db_name=DB_NAME)
    print("DB 접속")

    port = 5050
    listen = 100

    # 봇 서버 동작
    bot = BotServer(port, listen)
    bot.create_sock()
    print("bot start")

    while True:
        conn, addr = bot.ready_for_client()
        params = {"db": db}
 def get_unviewed_messages():
     data = Database.find("chat", {"viewed": {"$eq": 0}})
     if data is not None:
         return list(data)
 def get_user_message_by_replymessageId(cls, messageId):
     data = Database.find_one("chat", {"replymessageId": messageId})
     if data is not None:
         return data
Beispiel #27
0
 def get_id_by_email(cls, email):
     data = Database.find_one("users", {"email": email})
     return data["_id"]
 def save(self):
     Database.insert("chat", self.json())
Beispiel #29
0
import sys

sys.path.append('/Users/wxg12/Documents/python_workspace/chatbot/')

from config.DatabaseConfig import *
from utils.Database import Database
from utils.Preprocess import Preprocess

# 전처리 객체 생성
p = Preprocess(word2index_dic='train_tools/dict/chatbot_dict.bin',
               userdic='utils/user_dic.tsv')

# 질문/답변 학습 디비 연결 객체 생성
db = Database(host=DB_HOST,
              user=DB_USER,
              password=DB_PASSWORD,
              db_name=DB_NAME)
db.connect()  # 디비 연결

# 원문
# query = "오전에 탕수육 10개 주문합니다"
# query = "화자의 질문 의도를 파악합니다."
# query = "안녕하세요"
query = "자장면 주문할게요"

# 의도 파악
from models.intent.IntentModel import IntentModel

intent = IntentModel(model_name='models/intent/intent_model.h5', proprocess=p)
predict = intent.predict_class(query)
intent_name = intent.labels[predict]
Beispiel #30
0
 def get_notification_by_id(cls, notiId):
     data = base.find_one("notification", {"notiId": reportId})
     if data is not None:
         return data