Welcome to 2am.
Field Sobriety Testing.
"Nothing good happens after 2 AM." ~ Ted Mosby, in the hit sitcom How I Met Your Mother.
With parties occurring practically weekly, drinking is a prevalent activity among college students. Unfortunately, sometimes people do not make smart decisions when inebriated. Driving under the influence is one of the leading causes of death among teens and young adults because they may act without realizing how impaired they are. We thought of using the Sensor framework in Android as a way for people to self-check their impairment due to alcohol and make better informed decisions about getting home safely.
What it does
BAC Logging. The main screen of 2am acts as a log where users can keep a count of how many drinks they had. Based on this tally, as well as the elapsed time, 2am estimates your current BAC and the time at which you will be fully sober again (0 BAC). There is a button which refreshes the information, and another button, Begin Testing, which will begin the field sobriety tests.
Field Sobriety Testing. The first test is the line test, where the user walks in a straight line holding their phone. In this test, 2am records the gyroscopic motions of the device. The next test is the typing test, where the user has to type a sentence that appears on their screen. In this test, 2am records the speed and accuracy of the typing. The final test, the reaction test, involves a quick change of color to which the user responds by pressing the screen. 2am records the reaction time.
Recommendation. Ultimately, 2am will take into account the BAC levels and the results to determine whether you are intoxicated and/or impaired. It is important to note that even if you are not legally intoxicated, you could be sufficiently impaired that your driving would be noticeably affected. Similarly, if you aren't impaired but are still legally intoxicated (above BAC=0.08), you could be charged with a DUI if pulled over while driving. Therefore, 2am evaluates your intoxication and your impairment independently from each other, and will provide appropriate cautionary advice depending on the results, such as call/text a contact, or flag a taxi or Uber.
How we built it
For the logging part of the application, we created equations to calculate BAC as a factor of age, gender, weight, amount of alcohol consumed, and elapsed time since consumption. These equations were based on research conducted by the National District Attorneys Association.
To better understand the effects of alcohol impairment, we considered the standard field sobriety tests used by police officers and decided that of these, the line test could be readily recreated using the gyroscope on the device. We also asked several of our peers who drink about how they feel it affects their motor or cognitive skills. From their input, we decided to use the typing test, as many said that texting on a phone was difficult for them when drunk. Finally, as reaction time is very pointedly related to the risk of getting into a motor vehicle accident, we decided to have this test be the final test that 2am performs.
As this weekend was rush weekend for fraternity membership, we expected the freshman dorms to have many drunk students. So, Saturday at around 2 AM, James and Himanshu visited the freshman dorm AMR II. They asked several drunk and sober students in the dorm to walk in a straight line, heel to toe, while holding a Moto G 2nd Gen open to a debug app which logged gyroscopic data. Also, they had each participant type the sentence: The quick brown fox jumped over the lazy brown dog. onto the testing phone to see how their typing was affected. Finally, they measured the reaction time of each participant with the common ruler drop test. Based on the data collected, we calibrated the thresholds for normal and impaired results for each of the sobriety tests. The rest of Saturday was spent developing the entirety of 2am, and Sunday morning, James and Himanshu went back to AMR II with the largely complete app and tested it to see if 2am could accurately predict whether the patient was intoxicated.
Challenges we ran into
With only one proficient programmer (Tushar) in our group of four, the major challenge we had to deal with throughout the entire hackathon was how to manage our work and time so that certain parts of code would be ready at certain times to coincide with the write-ups and our field testing. We all had to help with writing code to the best of our abilities so nobody would be over/underworked.
Accomplishments that we're proud of
We are proud of the fact that we were able to successfully analyze gyroscopic data to determine how the motor skills of inebriated people varied from sober people. Based on the observed data, we were able to define a threshold which could accurately distinguish whether the user was sober or not.
To rehash the time management challenge outlined previously, the smoothness with which we coordinated everything was something to be proud of. We were able to send two members out on both nights to collect data from the campus, write up an extensive guide for 2am, as well as a research report, and write all the SQL and Java code for the Android app, all within the 36 hours of hacking time.
Lastly, we are all proud of ourselves. With the exception of CS-major TJ, we were all biomedical engineering students, but we took on the challenge of thinking like a computer scientist to help TJ write his Java and auxiliary code. We also used our skills in physics, math, and biology which formed the foundation of 2am. Our chief code-monkey, TJ, took on one marathon of a coding assignment, effectively single-handedly. Despite this, he never complained and would still take time to help with the other parts of creating 2am.
What we learned
All of us learned about Java and Android app development. Rohan specifically had to learn SQL from scratch to create the tracker which is used in the main logging screen of 2am.
What's next for 2am
If this application can successfully determine the impairment and intoxication of an individual, hopefully this app can go on the market and help people make smarter decisions on how they are going to make it home. An improvement to the software that could be made is to have the app use some kind of learning algorithm, where it will refine its own parameters as more and more users use the app to perform their field sobriety tests.
In the future, one potential idea for the app is to make a business deal with taxis or Ubers where individuals can receive a discount on an Uber if they are not sober. This would expand the customer base of these transportation infrastructures, while providing an incentive for intoxicated people to avoid the dangerous decision to drive back home. One way that we can expand the technology being used in 2am is to see if the gyroscopic sensors in the phone could sense impairment in people who recently smokes marijuana, as current methods of testing for marijuana abuse are either very time-inspecific or expensive.