Skip to content

noelledaley/homesoon

Repository files navigation

HomeSoon

HomeSoon helps renters find housing within a reasonable commute distance. By seeding data from Craigslist, HomeSoon lets users search for a new apartment according to their budget, method of transportation, and desired distance from work. HomeSoon uses the Google Maps API to display a user's search results, where they can view further details such as an image, how the price compares to the average rent of their search, and most importantly, how long it would take to get to work from that location. Additionally, HomeSoon uses Chart.js to provide interactive charts helping users analyze their search.

HomeSoon was built by Noelle Daley over the course of 3 and half weeks as part of the Hackbright Academy Summer 2015 fellowship.

Check it out here! https://homesoon.herokuapp.com/

Homepage

Contents

Technology Stack:

  • Python
  • Flask
  • Javascript / jQuery
  • PostgreSQL / SQLAlchemy
  • Craigslist
  • Google Maps API
  • Google Distance Matrix
  • Google Geocoding Service
  • Google Places
  • Chart.js
  • HTML / CSS
  • Bootstrap

Feature List

  • Scrape data from Craigslist, parse, and store in database (Python, SQLite)
    • Store data from SF Bay Area
    • Add support for Portland
    • Add support for Seattle
    • Automate seed.py to add any city, given the Craigslist prefix
  • Set up HTML form for querying database by price, number of bedrooms, and proximity to work/point of interest (Google Geocoding Service, Google Places API)
  • Query database for posts within users' desired distance (Euclidean distance formula, Python)
  • Display search results as markers on a map (Google Maps API, Javascript / jQuery)
  • Allow user to modify search (HTML, jQuery, AJAX)
  • When user clicks on a result, calculate the commute time and distance from that location to their work/point of interest (Google Distance Matrix, AJAX)
    • Calculate commute time according to preferred method of transportation (driving, public transportation, bicycling, or walking), and link to directions in separate tab
  • Calculate average price of search results (Python, AJAX)
    • Compare each post with average price
  • Allow users to sign in or sign up for an account (Python)
  • Allow users to save a post and commute time for later viewing (SQLite, AJAX, Javascript)
    • Allow users to remove a post from their list of favorites
  • Display charts with information about users' search (Chart.js, Javascript)
    • Show number of posts and average rent
    • Show number of posts if user were willing to pay more or commute farther
  • Display charts about Craigslist data in general (Chart.js, SQLite)
    • Number of 1, 2, or 3 bedroom places
    • Average price of 1, 2, or 3 bedrooms places per city
  • Migrate to PostgreSQL
  • Deploy to Heroku

Accessing Craigslist Data

One of the most interesting challenges I encountered while working on this project was accessing Craigslist data, parsing it, and storing it in my database. Craigslist does not have an official API nor do they offer (or allow) a formal way of interacting with their data. However, through a combination of inspecting network calls and testing, I was able to get the data I needed and format it accordingly. To see exactly how I accomplished this, you can check out seed.py.

Calculating Distance

Getting the distance from a particular apartment to the user's origin (work address) was a two-step process. The first step was to use Euclidean distance to query the database for apartments within x number of miles from the origin. The results are then sent to the view and added as markers to the map.

From there, I used the Google Distance Matrix to retrieve distance from the origin in time and miles. However, to avoid performance problems and reaching Google's API limit I waited to calculate distance until an individual marker has been clicked.

Installation

  1. After cloning this repo, set up your virtual environment & activate it.
pip install virtualenv
virtualenv env/
source env/bin/activate
  1. Install the requirements:
pip install -r requirements.txt

NOTE: You will need a Google Maps API key to access the Google Distance Matrix. If you don't already have one, follow these instructions from Google.

  1. Once you have your API key, store it in a shell file called secrets.sh as follows:
export GOOGLE_MAPS_TOKEN="YOUR_KEY_HERE"
  1. Then, go back to your terminal and source it.
source secrets.sh
  1. Back in your terminal, gather data from Craigslist with the command python seed.py.

  2. Lastly, run python server.py and visit localhost:5000/ in your web browser of choice to use the app.

Additional Screenshots

Example search results

Search results

Analyze your search

Charts 1

Compare prices per city

Charts 2

View or remove favorite posts

Favorites

About

Hackbright Fellowship Summer 2015 final project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published