Skip to content

Latest commit

 

History

History
80 lines (56 loc) · 2.01 KB

File metadata and controls

80 lines (56 loc) · 2.01 KB

Bixi API

A simple FastAPI service for accessing Bixi GBFS bike-sharing data in Montreal.

Features

  • Real-time station status (available bikes/docks)
  • Station information and locations
  • Location-based search (find nearby stations)
  • Station search by name
  • System statistics and alerts
  • Raw GBFS feed access

Installation

# Install dependencies
uv sync

Usage

# Run the server
python api/main.py

# Or with uvicorn
uvicorn api.main:app --reload

API documentation available at: http://localhost:8000/docs

Key Endpoints

  • GET /health - Enhanced health check with uptime, connectivity status, and system info
  • GET /stations - All station information
  • GET /stations/status - Real-time status of all stations
  • GET /stations/status?station_ids=123,456 - Status of specific stations
  • GET /stations/near?lat={lat}&lon={lon} - Find nearby stations
  • GET /stations/search?query={name} - Search stations by name
  • GET /stations/available?min_bikes={n} - Stations with available bikes
  • GET /stations/issues - Stations with operational problems
  • GET /stats/system-summary - System-wide statistics
  • GET /system/alerts - Active system alerts
  • GET /gbfs/raw/{feed_name}?language={lang} - Raw GBFS feed data

GBFS Feed Types

Available feed names for /gbfs/raw/{feed_name}:

  • station_information - Static station data (location, capacity, etc.)
  • station_status - Real-time availability (bikes, docks available)
  • system_information - General system details
  • system_alerts - Active system alerts
  • vehicle_types - Information about bike types

Language options: en (default), fr

Docker Deployment

Prerequisites

  • Docker

Build and Run

# Export requirements (development only)
uv export --no-hashes --format requirements-txt --no-editable > requirements.txt

# Build Docker image
docker build -t bixi-api .

# Run container
docker run -p 8000:8000 bixi-api

# Access the API at: http://localhost:8000
# View docs at: http://localhost:8000/docs