P R O J E C T  H A N A

Inspiration

Our team thought of Health and Nurture Assistant (HANA) to benefit the health of people like us. Since it's incorporated using a discord bot, the effects will be available to anyone using the service, and will be able to piggy-back over the robust overlay for greater effectiveness than Windows notifications alone. HANA was built from the start to be approachable and personable, to help root out a major health problem that has affected us even today: consecutive sitting time / dehydration during extended screen-time sessions.

What it does

HANA is designed to pull information from a GUI executable where users can schedule different types of reminders, place this on a database, and query this database while the discord bot companion is running to fulfill these reminders regardless of platform.

How we built it

The GUI for HANA was constructed using Python3 and the built-in package Tkinter. Each component was built from scratch, and individual components and windows were made into classes to better interact with one another. A few global variables unfortunately needed to be set to ensure that the path to the working directory would work on both Windows and Linux hosts.

The Discord bot uses discord.py (Python 3) and SQLite3. The bot can respond to messages sent to it and can send messages to users based on information pulled from the database. The bot queries the database to ensure the user has connected to receiving messages, and if so runs time-based calculations. This bot was written in a Linux virtual machine and works cross-platform.

CREATE TABLE USERS(USERID INT PRIMARY KEY NOT NULL, NAME TEXT, DISCORDNAME TEXT, DISCORDID INT, CONSENT INT);
CREATE TABLE DATA(USERID INT NOT NULL, TYPE NOT NULL, DATA TEXT, LASTTIME INT, PRIMARY KEY(USERID, TYPE));

The python script uses coroutines to handle incoming messages and the main loop. The main loop executes every ten seconds an yields for other routines. This is acceptable as we aim to create reminders of at least several minutes in frequency.

Challenges we ran into

Designing a GUI from scratch using Tkinter is a time-consuming undertaking. More of a problem is its insufficient use of garbage collection when destroy()ing frames. Some of the member variables of that instance will persist, and this took more than 3 hours to discover and debug.

It took some effort to convert between the time formats and fields we were using. The input from the GUI could be in minutes, hours, or at some time of the day. This was converted into UNIX Timestamps for easier arithmetic. Integrating the two scripts proved to not be trivial, but we communicated and solved problems ahead of time.

Accomplishments that we're proud of

The short line of code "del self.reminders[::]" took 3 hours to craft because we could not find where in the program trace the bug originated from.

I think a Discord bot is an interesting way of interacting with a program and I hope to use one in the future interface with personal projects or even program on mobile. I also think that for a team of two and the limited time available we were able to pull together an impressive project.

What we learned

Miles learned how to program a GUI with greater understanding than previous (no experience). Jack learned about easily integrating SQL into a project and how to use prepared statements.

What's next for Health and Nurture Assistant (HANA)

Stretch goals under the "Could" of our MoSCoW diagram included incorporation of graphs onto the Dashboard segment of the GUI. Using this, one could view voluntarily submitted data about water consumption per day, and how well the notifications were being heeded over the course of a longer period of time. Unfortunately, we did not have enough time to incorporate this functionality.

Built With

Share this project:
×

Updates