Inspiration
What it does
Den-Manager, uses 2 APIs to gather and plot data based on the occupancy of a HackNYU. The tool is useful during real time for the event and also useful even after the event is over. For the live part of the project: Every 60 seconds, our script would scrape data from Density and save it for us to use in a log. If the current occupancy of the room reaches a certain threshold determined by the user, the script uses the SMTP module so that an alert in the form of email is sent to the user. For the live part and/or even if the event has concluded: On command, it takes the data from the log and graphs it onto a scatter plot and/or a bar graph at Plot.ly. The scatterplot shows uses each data entry for every minute on the clock is represented with one dot on the plot (If there are 300 data values, then the bar will have 300 dots). The bar graph takes the average number of occupancy over a 30 minute time frame (if there are 300 data values, then there will be 10 “bars” on our bar graph, each bar representing 30 minutes).
How we built it
Den-Manager is a python script. We initially were super confused by the documentation on density.io and had no idea on how to access the api with the api key. We wrote a web scraper that read the html from livecount.hacknyu.org as our means of indirectly getting data from Density. The script would then log the timestamp and person count.
For graphing, we used a script to open our log files and sifted through it for the appropriate personcount number. We formatted the data, initiated a plot.ly instance and sent our data to the service. Our requested graph would be automatically launched on our browser.
The email notification service was written using the smtp python module. When the threshold was met live, an email was sent to ourselves alerting us.
Challenges we ran into
We initially could not get the Density API to work the way we wanted it. So Andrew came up with the idea to take the data from the HackNYU live count website because if HackNYU could retrieve data from density correctly, then we could piggy back on it as well. At a certain point, the density machine box on top of the doorway restarted or something, so even though there were 100 people at 8:00am Sunday morning, at 8:01 the counter showed 0.
Accomplishments that we're proud of
One of the first accomplishments that we had was when we started getting all the data from the live count. After letting Den-Manager run for a little, we ran it and it printed all of the data that was collected so far. It was very cool and satisfying to see all that raw data. Another one would have to be when we got the data and plotted into the first scatter plot. It was very interesting seeing the patterns of when people leave and the gradual drop of occupants as HackNYU went on.
What we learned
Angel Javier Rojas: I’m glad to have accompanied my friend Andrew to this, my first hackathon. I learn of a lot new and interesting things while I was here. I learned a little bit of node.js and JavaScript. Since my friend Andrew prefers to use Python over Java, I learned some Python in order to be of use to him and I followed his instructions. Although I felt like an idiot, it was exciting to learn a new language and I still have a lot to learn about Python. I hope to learn more and, maybe next time, use what I learned here at a future hackathon.
Andrew Ku: Better time management HAHA
Log in or sign up for Devpost to join the conversation.