BigBikeLoc: forecasting Vélo’v bike availability in Lyon
Brief
BigBikeLoc is a modular system that predicts bike availability for the Velo’v network in Lyon. It includes end-to-end components: data preparation, multi-horizon model training, inference API, user app, workflow automation, feedback collection, and ML monitoring.
Table of contents
- Business problem
- Project methodology
- Academic context and team
- Main technologies
- System architecture
- DevOps and infrastructure
- Storage and data layer
- BBL_n8n: workflow, forms and mails
- Key features
- Development challenges
- Technical constraints
- Current limitations
- Screenshots and local demo
In urban mobility projects, combining machine learning models, production APIs, and business tools (alerts, forms, monitoring) quickly becomes complex to deploy and maintain. BigBikeLoc connects a training pipeline, an inference API, a user-facing frontend, workflow automation (n8n), LLM-based content generation, email delivery, feedback collection, and data-drift monitoring.
flowchart LR
U["User"] --> FRONT["BBL_front (Streamlit)"]
FRONT --> API["BBL_FastAPI"]
API --> PRED["POST /predict"]
API --> FEED["POST /feedback"]
subgraph SRC["Data sources"]
VELOV["Velo'v station feed"]
WEATHER["Weather data"]
end
subgraph TRAIN["BBL_dataset_training"]
PIPE["Feature engineering + multi-horizon training"]
REG["Artifact versioning"]
end
subgraph STOR["Shared volumes"]
ART["shared/artifacts\nregistry.json, current, versions"]
DATA["shared/data\npredictions.jsonl, feedback.jsonl, retrain_requested.json"]
end
subgraph AUTO["BBL_n8n"]
N8N["n8n workflow"]
FORMS["bbl-forms"]
MAILS["bbl-mails"]
LLM["bbl-ollama (tinyllama)"]
end
subgraph OBS["Observability"]
EVD["BBL_Evidently"]
DASH["Drift/quality dashboards"]
end
VELOV --> PIPE
WEATHER --> PIPE
PIPE --> REG
REG --> ART
API --> ART
PRED --> DATA
FEED --> DATA
API --> N8N
N8N --> LLM
N8N --> MAILS
U --> FORMS
FORMS --> FEED
DATA --> WRK["retrain_worker"]
WRK --> ART
DATA --> EVD
EVD --> DASH
Business problem
The starting point is straightforward: in Lyon, when someone wants to pick up a Velov bike, they often do not know in advance whether bikes will still be available upon arrival.
Some patterns are obvious (for example, in the city center, bike availability often differs between morning and evening because of commuting and nightlife habits). But many fluctuations are harder to explain directly: weather effects, local events, rebalancing delays, and station-level imbalances.
BigBikeLoc addresses this with two goals:
- Forecasting peaks and drops in availability across multiple horizons (1 h, 3 h, 6 h, 12 h, 24 h).
- Using contextual signals such as weather and temporal dynamics to improve prediction quality.
The practical objective is to reduce frustrating cases where a station is empty (no bikes) or saturated (no free docks), and make the service more reliable for everyday users.
Project methodology
The project follows an iterative, value-driven approach:
- Problem framing around priority user journeys.
- Data contract design between training, serving, and monitoring.
- ML experimentation with horizon-specific validation.
- Production hardening through artifact versioning and safe reload paths.
- Continuous improvement loop from monitoring and user feedback.
Academic context and team
The project was developed during the final semester at Polytech Lyon, in a team with Agathe Minguet, Simon Morier, Timothe Longuet, Clement Ruchon, and Ismail El Mouaddab.
Main technologies
- Python: core of ML and backend (training, features, API, pytest tests).
- FastAPI: REST inference API, Pydantic schemas, OpenAPI docs (
/docs). - LightGBM: horizon-specific models (1 h, 3 h, 6 h, 12 h, 24 h), joblib export, strict feature alignment with
model.feature_name_. - pandas / Parquet: tabular data, same-slot profiling, versioned artifacts.
- Hugging Face Datasets: loading and merging source datasets (Velo’v, weather, etc.).
- Docker & Docker Compose: containerized services, shared volumes
shared/artifactsandshared/data. - Streamlit: web UI for end users.
- n8n: automation workflows (webhooks, Ollama chaining, email sending).
- Ollama: TinyLlama model used to generate prediction-based email content.
- Evidently: ML monitoring on shared production data.
System architecture
The workspace is organized into multiple components:
BBL_dataset_training: artifact-producing ML training pipeline with versioned outputs and retraining worker.BBL_FastAPI: inference API withPOST /predict, feedback endpoint, logs, model reload without full restart.BBL_Scripts: orchestration scripts (start-all/stop-all) for startup order, Docker network, and checks.BBL_n8n: automation stack with workflow orchestration, forms, email service, and Ollama.BBL_front: Streamlit frontend consuming API endpoints.BBL_Evidently: monitoring dashboards.
The shared volumes shared/artifacts and shared/data define the contract between training, inference, production logs, feedback loops, and retraining triggers.
DevOps and infrastructure
- Full Docker Compose setup for reproducible environments.
- Dedicated external Docker network (
BBL-network) for inter-service communication by container name. - Scripted orchestration (
start-all) to create shared folders/network, free required ports, start stacks in order, ensure Ollama model availability, and import n8n workflow. - Shared volumes for artifacts/data plus dedicated persistence volumes for n8n and Ollama.
- Environment-based configuration for API thresholds and mail providers.
- Evidently monitoring pipeline built from production JSONL logs and feedback JSONL.
flowchart TB
DEV["Developer machine / local host"] --> START["start-all"]
START --> PREP["Prepare shared/artifacts + shared/data folders"]
START --> NET["Create BBL-network"]
START --> PORTS["Free ports 5678 / 3100"]
subgraph N8NSTACK["BBL_n8n stack (docker-compose)"]
N8N["bbl-n8n:5678"]
FORMS["bbl-forms:3100"]
MAILS["bbl-mails"]
OLLAMA["bbl-ollama"]
N8NVOL["Volume bbl-n8n-data"]
OLLVOL["Volume bbl-ollama-data"]
N8N --- N8NVOL
OLLAMA --- OLLVOL
end
subgraph MLSTACK["ML/Serving stack"]
API["bbl-api:8000"]
FRONT["bbl-front:8501"]
EVD["bbl-evidently:8085"]
ART["shared/artifacts"]
DATA["shared/data"]
API --- ART
API --- DATA
EVD --- DATA
end
START --> N8NSTACK
START --> API
START --> FRONT
START --> EVD
START --> OCHK["Check/Pull tinyllama"]
START --> IWF["Import n8n workflow"]
NET -. Docker DNS .-> N8N
NET -. Docker DNS .-> API
NET -. Docker DNS .-> FRONT
NET -. Docker DNS .-> EVD
NET -. Docker DNS .-> FORMS
NET -. Docker DNS .-> MAILS
NET -. Docker DNS .-> OLLAMA
FRONT --> API
API --> N8N
N8N --> MAILS
N8N --> OLLAMA
FORMS --> API
Storage and data layer
The current implementation does not rely on a central relational database for core application flows. Persistence is primarily file-based and shared across containers:
shared/artifacts/for versioned ML artifacts (registry.json,current/,versions/<version>/, models, encoder, same-slot profile)shared/data/production/predictions.jsonlshared/data/feedback/feedback.jsonlshared/data/retrain/retrain_requested.json(+ lock file during worker execution)
n8n keeps its own runtime state in a dedicated Docker volume (bbl-n8n-data).
This “file-based + Docker volumes” choice is intentional:
- Simple contract across services: training, inference, and monitoring repos exchange data through shared files without a tightly coupled SQL schema.
- Natural ML versioning model:
registry.json+current/+versions/maps directly to model lifecycle management. - Fast local bootstrap: fewer moving parts to run with
start-all, which keeps local demos reproducible. - Explicit audit trail:
predictions.jsonlandfeedback.jsonlare easy to inspect and replay.
The trade-off is lower support for advanced analytical querying and transactional guarantees compared to a dedicated database stack.
BBL_n8n: workflow, forms and mails
n8n workflow orchestration
- Exposes
generate-emailwebhook. - Validates and transforms backend payload.
- Calls Ollama (
tinyllama) to generate analysis text. - Builds final mail body and triggers email sending via
bbl-mails. - Returns structured response (
contenu_mail,email_sent,message_id).
bbl-mails service
- Node/TypeScript microservice (
/send,/health) based on Nodemailer. - Supports Mailtrap or SMTP providers via environment variables.
- Handles actual mail transport and delivery status.
bbl-forms service
- React form app served by Nginx (port 3100).
- Reads prediction context from URL query params.
- Lets users submit observed ground truth for a selected horizon.
- Nginx proxy routes:
/api/feedback->bbl-api:8000/feedback- other
/api/*-> n8n webhooks
This closes the loop between prediction notification and feedback collection feeding retraining triggers.
flowchart TB
subgraph ART["shared/artifacts"]
R1["registry.json"]
C1["current/"]
V1["versions/version-id"]
R1 --> C1
V1 --> C1
end
subgraph DAT["shared/data"]
P1["production/predictions.jsonl"]
F1["feedback/feedback.jsonl"]
T1["retrain/retrain_requested.json"]
end
API1["BBL_FastAPI"] --> R1
API1 --> P1
API1 --> F1
API1 --> T1
WRK["retrain_worker"] --> T1
WRK --> V1
EVD["BBL_Evidently"] --> P1
EVD --> F1
Key features
- Multi-horizon prediction for station availability at future time horizons.
- Explicit model versioning with
registry.jsonas the source of truth. - Production JSONL logging with
request_idandmodel_version. - Closed-loop feedback to retraining with threshold-based asynchronous retraining.
- Station discovery and station-name lookup utilities.
- Smart notifications through n8n + LLM email generation.
- Business workflow integration through forms and webhooks.
- ML monitoring with Evidently.
- Unified startup via scripts and a dedicated Docker network.
Development challenges
A major challenge was keeping training and API repositories aligned through strict disk artifact contracts and API payload contracts: feature ordering, supported horizons, mandatory files per version, and asynchronous retraining (never inside HTTP request threads). Integrating n8n, Ollama, and SMTP also required robust secret management (.env) and resilient behavior when email delivery is optional or fails.
Technical constraints
- Non-stationary demand patterns across hours, weekdays, weather and seasonal effects.
- Uneven data quality (missing values, delays, outliers, station metadata drift).
- Strict compatibility requirements between training artifacts and inference payloads.
- Real-time API constraints while retraining workflows must remain asynchronous.
- Different error profiles across forecast horizons requiring specialized modeling.
Current limitations
- Lower robustness on exceptional disruptions (major incidents, sudden network perturbations).
- Performance depends on how representative recent historical data remains.
- Feedback loop quality is tied to actual user feedback volume and reliability.
- Scope is currently Lyon-focused; transferability to other cities requires adaptation work.
- LLM-assisted messaging improves flexibility but needs cost and output-quality controls.
- In the currently documented version, weather features exist in training, but real-time weather is not yet wired into MVP inference.
Screenshots and local demo
For local demos: start Docker, run the OS-specific start-all script, then open the documented services (API 8000, Streamlit 8501, n8n 5678, forms 3100, Evidently 8085).
Caption — Screenshot 1: risk map of stations to support operational decisions.
Caption — Screenshot 2: prioritized watchlist of stations likely to face tension.
Caption — Screenshot 3: forecast trends by horizon to plan actions ahead.
Caption — Screenshot 4: consolidated service-level view by station and horizon.
Caption — Screenshot 5: automated notifications to inform users at the right time.