Code Monkey home page Code Monkey logo

capital-one-summit's Introduction

Airbnb Data Visualization

This is my application to the Capital One Software Engineering Summit.

It contains several charts with different statistics about Airbnb listings in San Francisco. It also has a heatmap that can be used to estimate a price for a new listing in the area. I also included some thoughts about the data and in some cases, further analysis that could be done.

Setup

First, clone from https://github.com/McIntireEvan/capital-one-summit.

Next, grab the data from here

Extract all the data, and put listings.csv in /server/data

Then, from the root directory of the project, run

cd server
npm install
node server.js

to get all the dependencies installed and the server running.

The server does not serve any static files; it just parses and returns data. To get everything properly set up with nginx, add the following to your config

upstream express-data {
    server localhost:5052;
}

server {
    listen 80; # Or whatever port you want
    server_name localhost;
    root /var/www/data-vis/static; # Or wherever you install to

    index index.html;
    location / {
        try_files $uri $uri/ @express-data;
    }

    location @express-data {
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_pass http://express-data;
        proxy_set_header Host $host ;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

This tells nginx to first try to find the files, and to fall back on our express server if it can't locate it.

You'll also have to grab a Google Maps API key from here.

Once you have it, just go to the <script> tag near the bottom of index.html, find the ?key= parameter in the URL, and replace mine with yours

After this, you're done! Go to your webpage, and enjoy!

Project Structure

All the static files to be served by the webserver are in static/

The server and npm package info are in server/

Libraries Used

  • Express
  • csv-parse
  • chart.js
  • Google Maps
  • haversine

Other considerations; Possible improvements

  • On the server, caching the data instead of directly storing it would improve memory usage, but with the scope of the project right now is not worth it.

  • When getting data to suggest a price, if there fewer data points than some threshold, it should expand the search radius until we have enough

  • The CSS is a mess and could be cleaned up a lot.

  • The chart options and related code could be abstracted to follow DRY

capital-one-summit's People

Contributors

eveninglily avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.