Hackathon for Homelessness: Behind the Scenes


02/01/2017

Hackathon

Zak Miller, Accusoft Software Engineer

Last June, the Tampa-Hillsborough Homeless Initiative (THHI) organized a "Hackathon for Homelessness." Subject-matter experts (including men and women who used to be homeless themselves) arrived with challenges that technology could overcome. Programmers from the Tampa Bay Area came to volunteer their time to help solve those challenges. I joined three other Accusoft employees, and, after a busy weekend, we were one of the winning teams. You can read about it here. I would like to share a behind-the-scenes look at the project's evolution and technical details.

Solving Challenges Through Software

THHI worked with nonprofits and the homeless to find problems that technology could solve. We worked on one of those problems: Once a year about 300 volunteers with Hillsborough County hand out paper forms to the homeless for the annual Point-in-Time Census. At the end of the day, the volunteers manually enter the results into a database.

Problems we were asked to solve:

  • The forms are complicated, with some questions leading to more in-depth questions.
  • Complexity of the paper forms led to lots of human errors.
  • Paper forms are sometimes lost, illegible, or are otherwise unusable.

We needed to convert the paper form into a digital format, which would deliver the following benefits:

  • No data would be lost, as digital forms would be submitted immediately after completion.
  • The survey could be "smart," hiding the questions the users need not answer, and speeding up the survey process.
  • Using digital forms would free up hundreds of hours of volunteer time, as no one would spend time typing in thousands of survey answers.

Luckily, we had complete autonomy in dealing with the technical details. Although it wasn't a requirement, we made it a priority to use only free technologies. We wanted to create a solution that THHI could use, and we didn't want to saddle them with any fees.

The Census itself was only two pages, but converting it to a digital format posed some challenges.
First, if the person filling out the survey indicated they were not homeless (by saying they spent last night at a friend's house, for instance), we needed to end the survey immediately. That may sound harsh, but when volunteers are there for only one day out of the year, every minute counts. We were focused on men, women, and children who did not have access to a safety net. Another challenge was that some questions would prompt other questions (if they said they had served in the military, for example, we wanted to know what service).

Switching to digital records allowed us to make some improvements as well. For instance, near the end of the survey a question asks for information about homeless family members. The paper form limited the number of family members to five, but our solution could be more flexible. Also, we were able to completely remove a question about location by using GPS; this saved time and made the results more accurate.

Hackathon for Homelessness

We knew the volunteers using our application would be using tablets in most cases, although we didn't know specifics. We decided on a mobile-friendly webpage for speed and flexibility. We all enjoyed and were familiar with Python. We first needed to decide between the two big Python web frameworks, Django and Flask. One of us had experience with Django, the other with Flask. We were not sure where our application would be hosted, but we thought it would most likely be hosted on a low-budget AWS instance. Personal taste and the desire for a simple implementation (given the short timeframe) led us to settle on Flask.

We wrote the questions in JSON and interpreted them in Python to generate the survey using HTML and CSS. For the custom form logic, we used the CSS "hidden" attribute liberally. For the database, we chose SQLite out of familiarity with SQL. We used The Google Maps API for the GPS, and we added a map to the page to show it working for the demonstration.

By the end of the Hackathon we had a solid working prototype for the live demo. It was a locally hosted website that faithfully reproduced the 2017 census form, dynamically showed and hid questions, and worked on phone, computer, or tablet. It retrieved GPS coordinates and stored everything in the SQLite database.

Improving the Initial Design

Our main concern after the Hackathon was maintainability. The Census questions change year to year, and we wanted to make sure that a volunteer with minimal technical knowledge (and no programming experience) could add and remove questions, change logic, etc. Our solution did not allow for these types of changes. A volunteer would likely be intimidated by diving into the JSON and editing the wording, let alone adding a new question.

We found a JavaScript library for creating surveys called survey.js, and ported our survey to its JSON format. Using survey.js simplifies our code, and lets us use "triggers" rather than manually showing and hiding the HTML elements. Also, survey.js has advanced features like ending the survey early if someone answered a certain way, and dynamic questions that supported any number of answers.

Hackathon

Survey.js triggers show and hide questions.

hackathon for homelessness

A survey.js dynamic matrix lets you input any number of children.

Additionally, on the survey.js site there is a "survey editor" that allows users to create a survey using a GUI and receive the code as a result. It works the other way, as well: paste an existing survey's JSON and update it through the GUI. These changes allow a volunteer to easily update the Point-in-Time Census with new questions year after year.

hackathon for homelessness

The survey.js Survey Editor

We also switched from SQLite to a popular NoSQL database framework, MongoDB (and PyMongo). The switch allows us to take the JSON output from survey.js and immediately store it in MongoDB.

With our solution, we wanted to display visual updates as the surveys arrived. We needed a solution that would integrate easily with PyMongo; we found Pygal, and are happy with the results

Homelessness Hackathon results

We accomplished these additions and improvements, meeting periodically with THHI from June to December, and receiving feedback along the way.

This February, Hillsborough County will be using our tool to conduct the census, and I couldn't be more proud. Volunteer in your community, and participate in local Hackathons–we had a great experience, and I'm sure you will, too. If you want to learn more about our project, feel free to check out our Github repo or the THHI site.


Zak Miller is a Software Engineer at Accusoft, and he mostly works on ImageGear for .NET and for C and C++. He plans to revolutionize the world through technology, but isn’t quite sure how yet.

Join the discussion.