Example #1
0
    def open_connection(self):

        print("Opening Database")
        path = QFileDialog.getOpenFileName()
        self.connection = SQLConnection(path)
        ok = self.connection.open_database()
        print(ok)
def performanceMeasurement():

    root = tk.Tk()

    figure1 = plt.Figure(figsize=(6, 5), dpi=100)
    ax1 = figure1.add_subplot(111)
    bar1 = FigureCanvasTkAgg(figure1, root)
    bar1.get_tk_widget().pack(side=tk.LEFT, fill=tk.BOTH)
    SQL = SQLConnection.SQLConnection()
    numbers = SQL.getWorkEfficiency()
    # print(data.OutreachDetailsDate)
    SQL.closeConnection()
    # performanceMeasurement(data['OutreachDetailsDate'], data['name'].values.tolist())
    df1 = numbers[['name', 'Count_OutreachDetailsPatientId']]
    df1.plot.bar(x='name',
                 y='Count_OutreachDetailsPatientId',
                 rot=0,
                 fontsize=8,
                 color=(0.2, 0.4, 0.6, 0.6),
                 ax=ax1)

    # ax1.set_title(str(numbers['name'].values[0]) + ' work progress')
    toolbar = NavigationToolbar2Tk(bar1, root)
    toolbar.update()
    bar1._tkcanvas.pack(side=TOP, fill=BOTH, expand=True)
    root.mainloop()
def main():  # Main loop of ICA
    window = Tk()
    window.resizable(0, 0)
    window.title()

    currentSCREEN = Login_Screen.loginScreen(window, None)

    sql = SQLConnection.SQLConnection()
    #currentUser = Users.User([0, "Jason", "Van Bladel", "Admin", 1], 1, sql)
    #currentUser.setPermissions(Users.Permissions(["Hi", "decr", 1,1,1,1,1,1,1,1,1,1,1,1,1,1, 7, 10]))
    #currentSCREEN = Main_Menu.mainMenu(window, currentUser)

    #currentSCREEN = mainMenu(window, ["Jason Van Bladel"])
    #currentUser = User([0, "Jason", "Van Bladel", "Admin"], 1)
    #currentSCREEN = mainMenu(window, currentUser)

    #test patient information for med info screen since DB is down
    testPatientData = [
        20, 10, "Test", "Account", "L", "4/31/2000", "F", "No", "4/21/2020", 0,
        "Insert Race", "Insert ethnicity", 20
    ]
    testPatient = Patient(testPatientData)

    #currentSCREEN = Med_Info_Screen.med_INFO_SCREEN(window,testPatient)
    window.mainloop()
Example #4
0
def fuzzySearch(field, input_str, input_type):
    if not Type_Check.checkType(input_str, input_type):
        return
    SQLConn = SQLConnection.SQLConnection()
    query = query_generator.fuzzySearch_sql(field, input_str, input_type)
    df = pd.read_sql(query, SQLConn.conn)
    print(len(df.index))
    if len(df.index) == 0:
        SQLConn.closeConnection()
        return
    plist = []
    data = df.values.tolist()
    for p in data:
        plist.append(Patients.Patient(p))
    SQLConn.closeConnection()
    return plist
def individualGroupByDate(userID):
    SQL = SQLConnection.SQLConnection()
    data = SQL.getIndWorkEfficiency(userID)

    # print(data.OutreachDetailsDate)
    SQL.closeConnection()
    # performanceMeasurement(data['OutreachDetailsDate'], data['name'].values.tolist())
    plt.bar(x=range(0, len(data['OutreachDetailsDate'])),
            height=data['Count_OutreachDetailsPatientId'])
    # print(data['name'].values[0])
    plt.title(str(data['name'].values[0]) + ' work progress')
    dateTime = data['OutreachDetailsDate'].values.tolist()
    date = []
    for d in dateTime:
        date.append(d[:10])
    # print(date)
    plt.xticks(range(0, len(date)), date, rotation=20, fontsize=7)
    plt.ylim(0, dailyGoal)
    for index, value in enumerate(data['Count_OutreachDetailsPatientId']):
        plt.text(index, value, str(value))
    plt.show()
 def clockConnection(self):
     if not self.SQL == None:
         self.SQL.closeConnection()
     self.SQL = SQLConnection.SQLConnection()
     self.clockConnectionVar = self.root.after(15 * 60 * 1000,
                                               self.clockConnection)
Example #7
0
def main():

    # Create logging environment
    logging_ini_path = Path(__file__).resolve().parent / 'logging.ini'
    logging.config.fileConfig(logging_ini_path)
    mainLogger = logging.getLogger('root')

    # Create header in log file
    mainLogger.info("____________________")
    mainLogger.info("Entering Application")
    mainLogger.info("--------------------")

    # Get configs
    configsListPath = input("Path to your config file: ")
    if configsListPath == "":
        configsListPath = "C:\data\configs.json"
    try:
        assert os.path.exists(
            configsListPath), "File does not exist at " + str(configsListPath)
    except AssertionError:
        subLogger.warning(f"Failed to find csv file at {configsListPath}")
    try:
        with open(configsListPath) as json_config_file:
            cfg = json.load(json_config_file)
    except KeyError:
        print("KeyError")

    data = ""
    exit_sentinel = False
    currentEnvironment = {}

    # Initiate Menu Loop
    while exit_sentinel == False:

        # Print CLI pointer with environment if applicable
        try:
            envName = currentEnvironment["name"]
        except:
            envName = "null"
        command = input(f"env: {envName}>")

        # Check given command
        if command == "env":
            print("Available Environments:")
            for env in cfg:
                print(f"      {env}")

            valid_environment = False
            while valid_environment == False:
                selectedEnvironment = input("select an environment: ")
                try:
                    currentEnvironment = cfg[selectedEnvironment]
                    valid_environment = True
                except KeyError:
                    print(f"'{selectedEnvironment}'' is not a valid choice")
                    valid_environment = False

        elif command == "connect":
            if currentEnvironment:
                sql = SQLConnection.SQLConnection(currentEnvironment)
                sql.name = currentEnvironment["name"]
                sql.host = currentEnvironment["host"]
                sql.user = currentEnvironment["user"]
                sql.password = currentEnvironment["password"]
                sql.database = currentEnvironment["database"]
                sql.menu()
            else:
                print("Please use 'env' to select an environment first")
        elif command == "exit" or command == "quit":
            exit_sentinel = True
        else:
            main_menu_selection = "none"