Git Product home page Git Product logo

dbscrape's Introduction

Park Assist

A web application to quickly help you find the closest metered parking spot in Santa Monica, CA.

Problem

Parking is near impossible to find in Santa Monica. In addition, the data in the City of Santa Monica Parking API is not being fully utilized.

Solution

A web app that directs you to the closest available parking meter in Santa Monica.

Strategy

The City of Santa Monica Parking API provides information on 6700+ meters local to Santa Monica. Hundreds of meter events are sent to the API per minute. We took this data and processed it behind the scenes using two different servers (following service oriented architecture practices) and created an app that uses that data to facilitate reasonable and responsive meter parking decisions for the user.

Dependencies

Tools:

APIs:

  • City of Santa Monica Parking Data API
  • Google Maps APIs
    • Google Maps JavaScript API v3 - Google Maps functionality via JS
    • Google Maps Embed API - Embeds your maps on different pages
    • Google Maps Directions API - Path calculation and rendering
    • Google Maps Geocoding API - Coordinate calculation via address strings or Latitude/Longitude tuples

Installation

  1. npm install - server dependencies
  2. bower install - client dependencies
  3. gulp

Client-Side Info

We loosely modeled the directory structure from the information in this article

  • Primary functionality is split up into custom directives
    • Map
    • Modal
    • Team
  • Services are arranged into separate directories w/ an index.js that requires the service into a module of the same name
    • Directions - Calculates and renders path on Google Maps
    • Geocoder - Parses location data
    • Locator - Creates a database user based on user location
    • Map - Initializes the map
    • Markers - Contains methods for User and Parking Meter models
    • Traffic - Adds a Traffic layer to Google Maps
    • User - Watches user position by monitoring browser geolocation data.

Server-Side Info

IMPORTANT: If you are cloning this repo, create a file in the root directory called firebaselink.js that contains:

module.exports = { url: 'URL for your firebase database' };

This application uses two servers:

  • "Parking Spot Analyzer" Server - responsible for choosing the meters to be sent to the client. Its logic resides in server/server.js.

  • "Cloudify" Server - used to scrape the events from the City of Santa Monica parking API to keep the database updated. The source code for this server is located in the dbScrape repository.

Cloudify Server

Cloudify automatically updates the Firebase database with event information for each meter (mostRecentEvent and timeStamp fields only). We split this into a separate server so that the speed of this application would not be affected by the constantly changing meter event information. The repo can be found here.

Database Schema

  • MeteredParkingSpots
    • MeterID
      • active - Set up once by PSA server
      • latitude - Set up once by PSA server
      • longitude - Set up once by PSA server
      • mostRecentEvent- Continually updated with Cloudify Server
      • timeStamp- Continually updated with Cloudify Server
  • Users
    • Firebase unique identifier
      • latitude - from Google Maps API
      • logitude - from Google Maps API
      • range - auto set
      • Recommendations
        • array of MeterID objects

Application Flow

  1. The client detects the user's current location and sends a GET request to the PSA server.
  2. The PSA server stores the location as a unique user in the database so that personalized parking recommendations can be stored.
  3. The PSA server pings the database and iterates through all 6700+ meters to find the ones within 0.2 miles that currently show as empty (or SE). This data is sure to be accurate as it is continuously updated by the Cloudify server. The meters are added to an array of objects.
  4. The PSA server sorts this array of meter-information objects by distance and responds to the client with it.
  5. The client maps the closet meter on the map.

alt text

dbscrape's People

Contributors

kalisafalzone avatar qaiken avatar raghavabboy avatar rodocite avatar

Watchers

 avatar  avatar  avatar  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.