Skip to content

NextBike data analysis for your city. Includes Data gathering, aggregation, cleanup and display.

License

Notifications You must be signed in to change notification settings

mzwoelfer/nextbike-city-analysis

 
 

Repository files navigation

Nextbike City Analysis

Analyze NextBike trips in your city: collect, process, and visualize bike trips.

Overview

- collection/       # Setup data collection
- data/             # Stored trips data
- docs/             # Documentation
- processing/       # Calculate trips
- visualization/    # Web visualization

Prerequisites

🚀 Dockerized validation setup (Not for production)

Validates the project locally. To properly setup data collection and processing, refer to the README files in collection/ and processing/ directories.

  1. Clone repository:

    git clone https://github.com/zwoefler/nextbike-city-analysis.git
    cd nextbike-city-analysis
  2. Setup data collection:

    cd collection
    cp .env.example .env 
    docker build --file CONTAINERFILE -t nextbike_collector:multiple_cities .
    docker compose --file docker-compose.yaml up -d
    cd ..
  3. Define city and date:

    # Sets todays date
    date=$(date +%Y-%m-%d)
    city_id=467
  4. Process trips:

    ⚠ Wait a few minutes. As trips have to accumulate first. Otherwise you will encounter errors.

    cd processing
    cp .env.example .env 
    docker build --file CONTAINERFILE -t nextbike-processing:latest .
    docker run --rm --env-file .env \
       -e DB_HOST=nextbike_postgres \
       --network collection_nextbike_network \
       -v "$(pwd)/../data/:/app/data" \
       nextbike-processing:latest \
       --city-id $city_id --export-folder /app/data --date $date
    
    cd ..
  5. Visualize trips:

    cd visualization 
    python3 -m http.server 8000
  6. Open localhost:8000 in your browser.

Deploy to Github Pages

  1. Update the data in the data/ directory.
  2. Run the update-gh-pages.sh script

Changes will sync with master. Only the data/ directory will be pushed to the gh-pages branch. Not the master branch.

Credits

Inspired by 36c3 - Verkehrswende selber hacken by ubahnverleih & robbie5.

Visualization inspired by Technologiestiftung Berlin:

About

NextBike data analysis for your city. Includes Data gathering, aggregation, cleanup and display.

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Python 37.9%
  • JavaScript 37.8%
  • HTML 10.6%
  • CSS 8.0%
  • Shell 5.7%