Skip to content

rbarner14/mobility

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mobility

Mobility provides users with data visualizations of the frequency of bikes and scooters in US's main regions. Mobility aggregates GBFS feeds to enable developers to build data visualizations. Mobility allows developers to leverage the API in order to build client applications that show aggregated bike data. Currently there are no services that incorporate all the feeds. This project was inspired by implementing the WoBike documentation into a single service.

Imgur

Table of Contents

Overview

Tech Stack

Frontend: Using kepler.gl (React)

Backend:

  • Python
  • Flask

Libraries:

  • Python
    • flask, sqlalchemy, and requests

API: Get All Bikes by Region

# e.g. MIA, ATX for region
$ curl "localhost:5000/<region>/all" 
>> {
  "jumpbikes": {
      "data": {
        "bikes": [
          {
            "bike_id": "bike_96013", 
            "is_disabled": 0, 
            "is_reserved": 0, 
            "jump_ebike_battery_level": "49%", 
            "jump_vehicle_type": "scooter", 
            "lat": 25.794158, 
            "lon": -80.19069, 
            "name": "6211"
          }
          ...
        ]
      }
    }
  },
  "bird": {...}
}

Setup/Installation

On local machine, go to desired directory. Clone mobility repository:

$ git clone https://github.com/hacksnextdoor/mobility.git

Create a virtual environment in the directory:

$ virtualenv env

Activate virtual environment:

$ source env/bin/activate

Install dependencies:

$ pip install -r requirements.txt

Run app:

$ FLASK_APP=mobility.py FLASK_DEBUG=1 flask run
# Navigate to localhost:5000 in browser.

In Progress Create database:

$ createdb gbfs

Build database:

$ python3 -i model.py
>>> db.create_all()

Seed database:

$ python3 -i seed.py

Todo

  • Integrate US clients
    • Uber (Jump)
    • Lyft (Motivate) ;)
    • Bird
    • Lime
    • Spin
    • Scoot
  • Setup DB
    • Cache a days worth of data
  • API
    • Grab bike by company /<region>/<company> e.g /mia/jumpbikes
    • Support time queries for endpoints /<region>/all?since={epoch}&until={epoch}
    • Filter by type /<region>/all?type=scooter
    • Filter by geohash /<region>/all?geohash={hash}
  • Create Docker image
  • Deploy to heroku or now with 1 click

About

US GBFS aggregator.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%