Teen Drug Bot
- Alexis Hale
- Oct 29, 2018
- 5 min read
No, no, no, I know what you’re thinking. This is NOT a chat bot for teens to buy their drugs from. This chat bot helps parents figure out what drugs their teens may be experimenting with based off their symptoms and behaviors. After determining the specific drug the teen is using, we give the parent advice on how to approach the situation. This chat bot was created for my Human Computer Interaction class; we were asked to create a chat bot that attempts a task that requires a human connection.
Our Idea
We didn’t end up deciding on this topic in order to fight the war on teen drug use, but actually came across this topic almost accidentally. Initially, we wanted to create a chat bot that gave bad advice, but our professor let us know that it was too easy since the bot was insincere. I suggested a more narrow idea: a bad parenting bot. He responded with:

Later, I encountered my professor on-campus while with one of my project partners, Layal. We were still worried about our chat bot idea and brought it up for discussion. Our professor advised that we narrow our topic (parenting bot) even further. I just randomly tossed in “What if a parent found drugs under their teen’s bed and our chat bot helped out with that?” He liked it (finally)!


Even after that though, we decided to make a chat bot that helped struggling computer science students at our school. Excited to start the chat bot, I sat down and started coding this, without any prior planning. After programming a few functions and a dictionary of tags, Jacob (my coder in crime) and I encountered a roadblock. How were we going to help struggling CS students? We just planned on giving them information on how to access computer science department resources like office hours, teacher assistant hours, and the OpenSource Club’s Workspace. That wasn’t enough to attempt to create a human connection! Any ol’ chat bot could do that!
ScrapIdea();
Back to the teen drug bot idea.
Journey to the Center of our Bot
We first started by creating a flow chart of the actions and dialogue that would occur when chatting with our bot.
Then we started figuring out how we would identify each drug in our chat bot. We decided to implement this by using dictionaries of tags. Our tags consisted of symptoms of drug use, changes in behaviors, drug paraphernalia, and nicknames for different drugs.
How it works
After our dictionaries and dialogue were planned out, we got down to the coding. We started by entering all the tags for our dictionary of drugs and defining the different states our bot could be in. The starting state is “waiting” since the bot is waiting for the user’s input before responding. After that, it will proceed to the “common_symptom” state or the “identified_drug” state depending on if it has identified the drug or not from the user’s first input. If the user mentions a drug name or a symptom/behavior specific to one kind of drug, the chat bot will immediately proceed to giving advice to the user. If the user enters a common symptom or behavior like “coughing”, “smells bad”, or “eating more”, it will enter the “common_symptom” states. It will also enter the “common_symptom” state if it doesn’t recognize the user’s text, as a fail safe. The common symptom states help us narrow down what drug a teen might be using by asking leading questions like “Does your teen have bloodshot eyes often and do they seem to be losing motivation?” If the user answers “yes” then it will enter the “identified_drug” state and give advice about marijuana. If the user doesn’t say “yes”, then it will move on to the next leading question about adderall. It will continue asking leading questions until it passes through all of the drugs in our dictionary. If the user continues to answer “no”, then it will call the “finish_fail()” function which advises the user to speak to a professional.



Initial Prototype Failures
Of course, coding never goes as planned and we encountered a handful of issues along the way. Adding the tags were easy peasy, but initially, we had no plan for what to do if users entered a common symptom. Entering a common symptom prevented our bot from pinpointing a specific drug. We ended up creating a function helped us narrow down what drug a teen was using by asking leading questions. When this function was first created, it was a series of nested if statements all in one state (rather than the 7 states that I previously described in our final product). Unfortunately, the nested if statements didn’t work; it would just enter the first if statement and then exit the loop. Then, we came up with the solution of creating 7 different states and proceeding through each state until the drug was determined.



User Testing
We finally had a functional prototype that was ready for user testing. I set down the program in front of our user tester, Annie, a friend at school, and explained to her that she was to talk to the chat bot naturally, as if she was talking to a person. I let her know that any errors she encountered we not her fault, but mine. Since the program opens with an introduction, I chose to leave out the purpose of the chat bot, to see if there was enough information provided to figure it out.


Annie started by typing in a short story about her imagined teen’s behavior. Here, we can see our first error: she mentions “marijuana”, but since she says so much before it, it doesn’t pick up weed as the drug, likely encountering another tag before marijuana. Our dictionary is relatively large, reaching 229 lines of code so it will parse words like “friends” and “suspicious” first since they appear first chronologically. This also brought to my attention that “marijuana” alone wasn’t in our dictionary, but “marijuana leaves” was. It makes more sense to just include “marijuana” as a tag, since that will also pick up “marijuana leaves”. Later in the conversation, she thanks our bot and it responds with the next option in the if statement. We didn’t initially teach our bot any small talk since we programmed it with the specific purpose of identifying drugs from symptoms and behaviors and giving advice.
Final Thoughts
Given the time we had and our intermediate programming knowledge, I’m very happy with how our chat bot turned out. Our bot certainly isn’t perfect. Parents who would use this bot, might not notice the signs of drug abuse, so they might not know what to input. We are also not medical professionals; we can’t properly diagnose drug abuse, although we are aware of the symptoms and possible behavioral changes. Despite this, we tried our best to give some solid advice to parents in this situation. It would be much easier to ask simply talk to the teen and ask, search their room (just the parents!), or give them a drug test. It was an interesting idea and I had a lot of fun figuring out how to implement it with my project partners and improving it after user testing.
Check out our bot in action!
This first video demonstrates the bot immediately identifying the drug since the symptoms are specific to cocaine.
The second video demonstrates part of the common symptoms stages and then proceeds to give advice about tobacco when the user answers "yes" to the leading question with tobacco symptoms.
Want to run the bot yourself? Download the repository on Github.
Comments