docs: update API, deployment, and lessons for the new backend

- Updated API_SPEC.md with JWT auth and storage schema.
- Updated DEPLOYMENT.md for the new uvicorn-based setup.
- Added LESSONS.md pattern for worktree management.
- Included new README, TODO, and OPERATIONS files.
This commit is contained in:
dasemu committed 2026-03-13 10:01:48 +01:00
1 parent b5b62e582e
commit e952cea417
7 files changed
+281 -279

No files matched your search

+3
View File
@@ -25,6 +25,9 @@ bot/.env
.vscode/ .vscode/
*.swp *.swp
# Worktrees
.tmp/
# OS # OS
.DS_Store .DS_Store
+86 -103
View File
@@ -6,6 +6,50 @@ All responses use JSON. Dates use ISO 8601 format (`YYYY-MM-DD`). Timestamps use
--- ---
## Authentication
All endpoints except `/health`, `/auth/register`, and `/auth/login` require a valid JWT bearer token.
### `POST /api/v1/auth/register`
Create a new user account.
**Request Body:**
```json
{
"email": "user@example.com",
"password": "securepassword123"
}
```
**Response 201:**
```json
{
"id": 1,
"email": "user@example.com"
}
```
---
### `POST /api/v1/auth/login`
Obtain a JWT token valid for 14 days. Uses OAuth2 Password Flow (form data).
**Request Body (form-data):**
- `username`: email
- `password`: password
**Response 200:**
```json
{
"access_token": "eyJhbG...",
"token_type": "bearer"
}
```
---
## Stations ## Stations
### `GET /api/v1/stations` ### `GET /api/v1/stations`
@@ -25,26 +69,6 @@ List all tracked ski stations with metadata.
"altitude": 1505, "altitude": 1505,
"wind_closure_threshold_kmh": 80, "wind_closure_threshold_kmh": 80,
"min_snow_depth_cm": 30 "min_snow_depth_cm": 30
},
{
"station_id": "sanisidro",
"name": "San Isidro",
"max_km": 31.0,
"latitude": 43.07,
"longitude": -5.37,
"altitude": 1500,
"wind_closure_threshold_kmh": 80,
"min_snow_depth_cm": 30
},
{
"station_id": "fuentes",
"name": "Fuentes de Invierno",
"max_km": 8.6,
"latitude": 43.08,
"longitude": -5.93,
"altitude": 1500,
"wind_closure_threshold_kmh": 80,
"min_snow_depth_cm": 30
} }
] ]
} }
@@ -78,22 +102,9 @@ Get the latest forecast for **all stations**. Returns today + next 7 days per st
"weather_summary": "Nieve ligera, -2°C, viento 25 km/h", "weather_summary": "Nieve ligera, -2°C, viento 25 km/h",
"rule_notes": [], "rule_notes": [],
"prediction_source": "hybrid" "prediction_source": "hybrid"
},
{
"date": "2026-03-14",
"open_probability": 0.72,
"open_label": "Abierta",
"km_open": 15.0,
"max_km": 22.0,
"crowd_level": "high",
"weather_summary": "Soleado, 3°C, viento 15 km/h",
"rule_notes": ["Fin de semana + nieve reciente"],
"prediction_source": "hybrid"
} }
] ]
}, }
"sanisidro": { "...same structure..." },
"fuentes": { "...same structure..." }
} }
} }
``` ```
@@ -107,7 +118,7 @@ Get the latest forecast for **all stations**. Returns today + next 7 days per st
### `GET /api/v1/forecast/{station_id}` ### `GET /api/v1/forecast/{station_id}`
Get the latest forecast for a **single station**. Same structure as above but only one station. Get the latest forecast for a **single station**.
**Path parameters:** **Path parameters:**
- `station_id`: `pajares` | `sanisidro` | `fuentes` - `station_id`: `pajares` | `sanisidro` | `fuentes`
@@ -119,26 +130,7 @@ Get the latest forecast for a **single station**. Same structure as above but on
"run_hour": 10, "run_hour": 10,
"station_id": "pajares", "station_id": "pajares",
"name": "Valgrande-Pajares", "name": "Valgrande-Pajares",
"days": [ "days": [ ... ]
{
"date": "2026-03-13",
"open_probability": 0.85,
"open_label": "Abierta",
"km_open": 18.5,
"max_km": 22.0,
"crowd_level": "medium",
"weather_summary": "Nieve ligera, -2°C, viento 25 km/h",
"rule_notes": [],
"prediction_source": "hybrid"
}
]
}
```
**Response 404:**
```json
{
"detail": "Station 'xyz' not found. Valid: pajares, sanisidro, fuentes"
} }
``` ```
@@ -182,7 +174,7 @@ Get past forecast runs (archived when a new run replaces them).
### `GET /api/v1/health` ### `GET /api/v1/health`
Health check endpoint. Public health check endpoint.
**Response 200:** **Response 200:**
```json ```json
@@ -196,7 +188,7 @@ Health check endpoint.
### `GET /api/v1/status` ### `GET /api/v1/status`
System status: last forecast run, next scheduled run, model info. System status: last forecast run, next scheduled run, model info, bot status.
**Response 200:** **Response 200:**
```json ```json
@@ -206,9 +198,9 @@ System status: last forecast run, next scheduled run, model info.
"last_training_run": "2026-03-10T03:00:00+01:00", "last_training_run": "2026-03-10T03:00:00+01:00",
"next_training_run": "2026-03-17T03:00:00+01:00", "next_training_run": "2026-03-17T03:00:00+01:00",
"models": { "models": {
"station_open": "RandomForestClassifier", "station_open": "station_open",
"km_open": "GradientBoostingRegressor", "km_open": "km_open",
"crowd_level": "LGBMClassifier" "crowd_level": "crowd_level"
}, },
"telegram_bot_active": true, "telegram_bot_active": true,
"stations_count": 3, "stations_count": 3,
@@ -218,59 +210,50 @@ System status: last forecast run, next scheduled run, model info.
--- ---
## Schedule (internal, not exposed as API) ## Internal Schedule
The backend orchestrates these tasks internally: The backend (FastAPI + APScheduler) orchestrates these tasks internally:
| Hour (Europe/Madrid) | Task | | Hour (Europe/Madrid) | Task |
|---|---| |---|---|
| 00:00 | Forecast run: today + 7 days | | 00:00 | Forecast run: today + 7 days |
| 05:00 | Forecast run: today + 7 days | | 05:00 | Forecast run: today + 7 days |
| 10:00 | Forecast run: today + 7 days | | 10:00 | Forecast run: today + 7 days |
| 15:00 | Forecast run: tomorrow + 6 days (skip today) | | 15:00 | Forecast run: tomorrow + 6 days |
| 20:00 | Forecast run: tomorrow + 6 days (skip today) + scrape today's actual | | 20:00 | Forecast run: tomorrow + 6 days |
| Weekly (Monday 03:00) | ML model retraining | | Weekly (Mon 03:00) | ML model retraining |
Each forecast run:
1. Archives current forecasts → `past_forecasts` table
2. Fetches fresh weather data from Open-Meteo
3. Generates new predictions via HybridPredictor
4. Stores in `current_forecasts` table
--- ---
## Database Tables (new/modified) ## Storage Schema (SQLite)
### `current_forecasts` ### `users`
Active predictions served by the API. | Column | Type |
|---|---|
| id | INTEGER PK |
| email | TEXT UNIQUE |
| password_hash | TEXT |
| created_at | TEXT |
| last_login_at | TEXT |
| Column | Type | Description | ### `current_forecasts` / `past_forecasts`
|---|---|---| | Column | Type |
| id | INTEGER PK | Auto-increment | |---|---|
| generated_at | TEXT | When this forecast was created | | generated_at | TEXT |
| run_hour | INTEGER | Hour of the run (0, 5, 10, 15, 20) | | run_hour | INTEGER |
| station_id | TEXT | pajares/sanisidro/fuentes | | station_id | TEXT |
| prediction_date | TEXT | The date being predicted | | prediction_date | TEXT |
| open_probability | REAL | 0.0 - 1.0 | | open_probability | REAL |
| km_open | REAL | Predicted km open | | km_open | REAL |
| crowd_level | TEXT | low/medium/high | | crowd_level | TEXT |
| weather_summary | TEXT | Human-readable weather | | weather_summary | TEXT |
| rule_notes_json | TEXT | JSON array of rule notes | | rule_notes_json | TEXT |
| prediction_source | TEXT | rules/ml/hybrid | | prediction_source | TEXT |
### `past_forecasts` ### `training_runs`
Archived forecasts (same schema as `current_forecasts`). | Column | Type |
|---|---|
### `historical_actuals` | id | INTEGER PK |
Actual station data scraped from infonieve at 20:00. | completed_at | TEXT |
| metrics_json | TEXT |
| Column | Type | Description | | parameters_json | TEXT |
|---|---|---|
| id | INTEGER PK | Auto-increment |
| date | TEXT | The actual date |
| station_id | TEXT | pajares/sanisidro/fuentes |
| open_status | INTEGER | 0 or 1 |
| km_open | REAL | Actual km open |
| lifts_open | INTEGER | Number of lifts open |
| snow_depth | REAL | Snow depth cm |
| scraped_at | TEXT | When data was scraped |
+23 -168
View File
@@ -8,18 +8,14 @@ cd skipredictor
./start.sh --cron --collect-now --bot ./start.sh --cron --collect-now --bot
``` ```
That single command will:
1. Create a Python virtualenv and install all dependencies
2. Install the daily cron job (22:00)
3. Run an immediate data collection + prediction cycle
4. Start the Telegram bot in the background
## Requirements ## Requirements
- Python 3.11+ - Python 3.11+
- ~2 GB disk (YOLO model downloads on first run) - ~2 GB disk (YOLO model downloads on first run)
- Internet access (Open-Meteo API, infonieve.es scraping, Telegram API) - Internet access (Open-Meteo API, infonieve.es scraping, Telegram API)
- `TELEGRAM_BOT_TOKEN` environment variable (for the bot) - **Environment Variables**:
- `TELEGRAM_BOT_TOKEN`: Required for the Telegram bot.
- `JWT_SECRET_KEY`: Required for the FastAPI backend authentication.
## ML Training ## ML Training
@@ -35,201 +31,60 @@ This downloads 16+ seasons of station data from infonieve.es, fetches matching h
.venv/bin/python scripts/build_full_dataset.py .venv/bin/python scripts/build_full_dataset.py
``` ```
Step 2 fetches weather data from Open-Meteo in 1-year chunks and persists the full historical state in SQLite. First run may need 15-20 min due to API rate limits. Subsequent runs reuse the database cache.
Output: Output:
- `data/processed/skipredictor.db` - SQLite database with historical/runtime datasets, predictions, and reports - `data/processed/skipredictor.db`: SQLite database with all data.
- `ml/models/station_open_model.joblib` - Open/closed classifier (RandomForest) - `ml/models/*.joblib`: Trained models.
- `ml/models/km_open_model.joblib` - Km open regressor (GradientBoosting)
- `ml/models/crowd_level_model.joblib` - Crowd classifier (LightGBM)
- `ml/models/crowd_level_label_encoder.joblib` - Label encoder for crowd classes
### Retraining with accumulated data ### Retraining with accumulated data
As the daily pipeline collects new data, retrain periodically to improve the models:
```bash ```bash
.venv/bin/python scripts/retrain_model.py .venv/bin/python scripts/retrain_model.py
``` ```
This loads the historical featured dataset from SQLite, trains all models, evaluates them, and overwrites the model files in `ml/models/`. ## FastAPI Backend & Scheduler
### Recommended retraining schedule The backend uses FastAPI and includes an internal APScheduler to run forecast cycles at 00, 05, 10, 15, and 20:00 (Europe/Madrid), and a weekly retrain on Mondays at 03:00. It also manages the Telegram bot as a subprocess.
Add a monthly cron job to retrain automatically: ### Running the Backend
```bash ```bash
# Retrain models on the 1st of each month at 02:00 export TELEGRAM_BOT_TOKEN='...'
0 2 1 * * /path/to/skipredictor/.venv/bin/python /path/to/skipredictor/scripts/retrain_model.py >> /path/to/skipredictor/data/retrain.log 2>&1 export JWT_SECRET_KEY='...'
.venv/bin/python -m uvicorn app.main:app --host 0.0.0.0 --port 8000
``` ```
Or install it with: ### Systemd Service Setup
```bash Create `/etc/systemd/system/skipredictor.service`:
(crontab -l 2>/dev/null; echo "0 2 1 * * \"$(pwd)/.venv/bin/python\" \"$(pwd)/scripts/retrain_model.py\" >> \"$(pwd)/data/retrain.log\" 2>&1") | crontab -
```
## Cron Jobs
### Daily data collection (installed by `start.sh --cron`)
Runs every day at 22:00 (after stations close for the day):
```
0 22 * * * /path/to/.venv/bin/python /path/to/scripts/collect_daily_data.py >> /path/to/data/pipeline.log 2>&1
```
The pipeline executes 5 steps:
1. Fetch weather forecasts from Open-Meteo for all 3 stations
2. Scrape current station status from infonieve.es (lifts, km, snow depth)
3. Append today's data to the SQLite runtime dataset tables
4. Run feature engineering into SQLite runtime feature tables
5. Generate next-day predictions and publish them into SQLite for the bot
### Monthly model retraining (optional, recommended)
```
0 2 1 * * /path/to/.venv/bin/python /path/to/scripts/retrain_model.py >> /path/to/data/retrain.log 2>&1
```
### Verify cron is running
```bash
crontab -l # List installed cron jobs
tail -f data/pipeline.log # Watch daily pipeline output
tail -f data/retrain.log # Watch retraining output
```
## Server Setup (LXC / VPS)
### 1. Clone and initialize
```bash
git clone https://git.dariosevilla.es/dasemu/skipredictor.git
cd skipredictor
```
### 2. Set environment variables
```bash
# Add to ~/.bashrc or ~/.profile for persistence
export TELEGRAM_BOT_TOKEN='your_bot_token_here'
```
### 3. First-time setup with full training
```bash
# Install deps + create venv
./start.sh
# Download historical data and train models
.venv/bin/python data_sources/infonieve_historical.py
.venv/bin/python scripts/build_full_dataset.py
# Install cron + start bot
./start.sh --cron --bot
```
### 4. Run the bot as a systemd service (recommended for 24/7)
Create `/etc/systemd/system/skipredictor-bot.service`:
```ini ```ini
[Unit] [Unit]
Description=Ski Predictor Telegram Bot Description=SkiPredictor Backend & Bot
After=network.target After=network.target
[Service] [Service]
Type=simple Type=simple
User=dasemu User=dasemu
WorkingDirectory=/path/to/skipredictor WorkingDirectory=/path/to/skipredictor
Environment=TELEGRAM_BOT_TOKEN=your_token_here Environment=TELEGRAM_BOT_TOKEN=your_token
ExecStart=/path/to/skipredictor/.venv/bin/python bot/telegram_bot.py Environment=JWT_SECRET_KEY=your_secret
ExecStart=/path/to/skipredictor/.venv/bin/python -m uvicorn app.main:app --host 0.0.0.0 --port 8000
Restart=on-failure Restart=on-failure
RestartSec=10
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
Then: ## Legacy Cron Jobs (Optional)
```bash If you prefer not to use the internal scheduler, you can still use standard cron jobs for daily collection and retraining. See [OPERATIONS.md](OPERATIONS.md) for details.
sudo systemctl daemon-reload
sudo systemctl enable skipredictor-bot
sudo systemctl start skipredictor-bot
# Check status
sudo systemctl status skipredictor-bot
journalctl -u skipredictor-bot -f
```
## Monitoring ## Monitoring
### Log files - **Logs**: `data/pipeline.log`, `data/retrain.log`, `data/bot.log`.
- **API Status**: `GET /api/v1/status` (requires auth).
| Log | Location | Content | - **Health**: `GET /api/v1/health` (public).
|-----|----------|---------|
| Daily pipeline | `data/pipeline.log` | Weather fetch, scraping, predictions |
| Model retraining | `data/retrain.log` | Training metrics, cross-validation |
| Telegram bot | `data/bot.log` | User commands, errors |
### Check predictions
```bash
sqlite3 data/processed/skipredictor.db "
SELECT generated_at, prediction_date, run_kind
FROM prediction_runs
ORDER BY generated_at DESC, id DESC
LIMIT 5;
"
```
### Check dataset health
```bash
.venv/bin/python -c "
from storage import HISTORICAL_FEATURED_TABLE, SQLiteStore
df = SQLiteStore().read_dataframe(HISTORICAL_FEATURED_TABLE, parse_dates=('date',))
print(f'Rows: {len(df)}')
print(f'Date range: {df[\"date\"].min()} to {df[\"date\"].max()}')
print(f'Stations: {df[\"station_id\"].unique()}')
print(f'Missing values:\n{df.isnull().sum()[df.isnull().sum() > 0]}')
"
```
## Project Structure ## Project Structure
``` *See [README.md](README.md) for the full directory tree.*
skipredictor/
├── bot/telegram_bot.py # Telegram bot (/pajares, /sanisidro, /fuentes)
├── config/
│ ├── stations.yaml # Station configs, thresholds, webcam URLs
│ └── features.yaml # Feature definitions
├── data_sources/
│ ├── weather_api.py # Open-Meteo API client
│ ├── station_scraper.py # Infonieve.es scraper
│ ├── infonieve_historical.py # Historical TSV downloader
│ ├── webcam_collector.py # Webcam snapshot fetcher
│ └── crowd_analyzer.py # YOLOv8 crowd detection
├── pipeline/
│ ├── build_dataset.py # Weather + station data merger
│ └── feature_engineering.py # Rolling features, calendar, trends
├── predictor/
│ ├── rules.py # Rules engine (wind, snow, rain)
│ ├── ml_predictor.py # ML model inference
│ └── hybrid_predictor.py # Rules + ML combined
├── ml/
│ ├── train_model.py # Model training (RF, GBR, LGBM)
│ ├── evaluate_model.py # Cross-validation metrics
│ └── models/ # Trained .joblib files (gitignored)
├── scripts/
│ ├── build_full_dataset.py # Full historical build + train
│ ├── collect_daily_data.py # Daily cron pipeline
│ └── retrain_model.py # Retrain on accumulated data
├── start.sh # Setup and launch script
├── requirements.txt # Python dependencies
└── data/ # Runtime data (gitignored)
├── raw/ # Webcam snapshots and transient downloads
└── processed/ # SQLite database and runtime logs
```
+9 -8
View File
@@ -30,25 +30,26 @@
**What went wrong:** Worktree creation and cleanup were mismanaged, leading to confusion between the main directory and the worktree. Changes were applied to the main directory instead of the newly created worktree, and branch deletion failed because the worktree was still active. **What went wrong:** Worktree creation and cleanup were mismanaged, leading to confusion between the main directory and the worktree. Changes were applied to the main directory instead of the newly created worktree, and branch deletion failed because the worktree was still active.
**Root cause:** Lack of a strict "switch directory" step and incorrect order in the cleanup process (trying to delete the branch before removing the worktree). **Root cause:** Lack of a strict "switch directory" step, incorrect order in the cleanup process, and creating worktrees outside the repository root.
**Prevention rule:** Before using a worktree: **Prevention rule:** Before using a worktree:
1. **Always** `cd` into the new worktree directory immediately after creation. 1. **Always** create the worktree inside a `.tmp/` directory within the repository (e.g., `.tmp/feature-name`).
2. Perform all edits and commits **inside** the worktree. 2. **Always** `cd` into the new worktree directory immediately after creation.
3. To clean up: 3. Perform all edits and commits **inside** the worktree.
4. To clean up:
* Return to the main directory: `cd -` * Return to the main directory: `cd -`
* Remove the worktree: `git worktree remove <path>` * Remove the worktree: `git worktree remove .tmp/<path>`
* Then, and only then, delete the branch: `git branch -d <branch>` * Then, and only then, delete the branch: `git branch -d <branch>`
**Example:** **Example:**
```bash ```bash
# Correct flow: # Correct flow:
git worktree add ../new-feature -b feature-branch git worktree add .tmp/new-feature -b feature-branch
cd ../new-feature cd .tmp/new-feature
# ... do work, add, commit ... # ... do work, add, commit ...
cd - cd -
git merge feature-branch git merge feature-branch
git worktree remove ../new-feature git worktree remove .tmp/new-feature
git branch -d feature-branch git branch -d feature-branch
``` ```
+83
View File
@@ -0,0 +1,83 @@
# SkiPredictor Operations Guide
This guide covers common administrative and maintenance tasks for the SkiPredictor system.
## 🗄️ Database Management
The authoritative data source is the SQLite database at `data/processed/skipredictor.db`.
### Inspecting latest predictions
```bash
sqlite3 data/processed/skipredictor.db "SELECT * FROM current_forecasts ORDER BY station_id, prediction_date LIMIT 10;"
```
### Checking system status via CLI
```bash
.venv/bin/python -c "from storage import SQLiteStore; s=SQLiteStore(); print(f'DB Size: {s.db_path.stat().st_size/1024/1024:.2f} MB')"
```
## 🔄 Manual Forecast Cycles
While the FastAPI backend handles the schedule via APScheduler, you can trigger cycles manually:
### Run a full prediction cycle now
```bash
.venv/bin/python scripts/collect_daily_data.py
```
### Scrape today's actual results
```bash
.venv/bin/python data_sources/station_scraper.py
```
## 🧠 ML Model Operations
### Force manual retraining
```bash
.venv/bin/python scripts/retrain_model.py
```
### Inspecting model metrics
The metrics from the last training run are stored in the `training_runs` table:
```bash
sqlite3 data/processed/skipredictor.db "SELECT metrics_json FROM training_runs ORDER BY completed_at DESC LIMIT 1;"
```
## 🤖 Telegram Bot
### Running the bot standalone
```bash
export TELEGRAM_BOT_TOKEN='your_token'
.venv/bin/python bot/telegram_bot.py
```
### Monitoring bot logs
```bash
tail -f data/bot.log
```
## 🌐 FastAPI Backend
### Running the API server (Production)
```bash
export TELEGRAM_BOT_TOKEN='your_token'
export JWT_SECRET_KEY='your_secret'
.venv/bin/python -m uvicorn app.main:app --host 0.0.0.0 --port 8000
```
### Running the API server (Development/Reload)
```bash
uvicorn app.main:app --reload
```
## 🛠️ Troubleshooting
### Missing forecasts?
1. Check `data/pipeline.log`.
2. Verify Open-Meteo connectivity: `curl "https://api.open-meteo.com/v1/forecast?latitude=43.05&longitude=-5.77&daily=snowfall_sum"`
3. Ensure models exist in `ml/models/`.
### Bot not responding?
1. Check if the subprocess is alive via `GET /api/v1/status`.
2. Check `data/bot.log` for API errors (e.g., Invalid Token).
3. Ensure `TELEGRAM_BOT_TOKEN` is correctly exported in the environment where the backend is running.
+47
View File
@@ -0,0 +1,47 @@
# SkiPredictor
**Autonomous Ski Station Forecasting System for Northern Spain.**
SkiPredictor uses a hybrid approach (Rules Engine + Machine Learning) to provide high-accuracy forecasts for ski station status, open kilometers, and crowd levels. It targets three main stations: **Valgrande-Pajares**, **San Isidro**, and **Fuentes de Invierno**.
## 🚀 Overview
- **Hybrid Prediction**: Combines physical rules (wind thresholds, minimum snow depth, precipitation) with ML models (Random Forest, Gradient Boosting, LightGBM) trained on 15+ years of historical data.
- **Automated Pipeline**: Daily data collection from Open-Meteo (weather) and Infonieve (station status), followed by automated feature engineering and prediction runs.
- **Multi-Channel Delivery**:
- **Telegram Bot**: Instant updates and interactive station queries.
- **FastAPI Backend**: Professional REST API for integration with web and mobile apps.
- **Scheduled Tasks**: Internal APScheduler manages forecast cycles and weekly model retraining.
- **Crowd Analysis**: Experimental YOLOv8-based crowd detection via public webcams.
## 🛠️ Core Components
- **Backend (`app/`)**: FastAPI server providing JWT-authenticated access to forecasts and system status.
- **ML Engine (`ml/`, `predictor/`)**: Training and inference logic using scikit-learn and LightGBM.
- **Bot (`bot/`)**: Telegram bot implementation for user interaction.
- **Pipeline (`pipeline/`, `scripts/`)**: Data ingestion, scraping, and feature engineering.
- **Storage (`storage/`)**: Unified SQLite database for historical datasets, runtime logs, and predictions.
## 🏁 Quick Start
```bash
# Clone the repository
git clone https://git.dariosevilla.es/dasemu/skipredictor.git
cd skipredictor
# Initialize environment and start bot
./start.sh --cron --collect-now --bot
```
*See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed server setup, ML training, and systemd integration.*
## 📖 Documentation
- [API Specification](API_SPEC.md): REST API endpoints, schemas, and authentication.
- [Deployment Guide](DEPLOYMENT.md): Server installation, cron jobs, and ML workflows.
- [Operations Guide](OPERATIONS.md): Common administrative tasks and troubleshooting.
- [TODO / Roadmap](TODO.md): Current status and planned features.
## ⚖️ License
MIT License - Copyright (c) 2026 Darío Sevilla
+30
View File
@@ -0,0 +1,30 @@
# SkiPredictor TODO & Roadmap
This file tracks the current state of the project and planned enhancements.
## 🟢 In Progress / High Priority
- [ ] **Capacitor Mobile App**: Build a hybrid mobile application (iOS/Android) using the FastAPI backend.
- [ ] **FastAPI Backend Expansion**: Add more robust user management and potentially a web dashboard.
- [ ] **Advanced Crowd Analysis**: Refine the YOLO-based detection and integrate it more deeply into the hybrid predictor.
## 🟡 Planned Features
- [ ] **Push Notifications**: Integrate Firebase or similar for real-time station status alerts in the mobile app.
- [ ] **User Preferences**: Allow users to "favorite" stations and set custom notification thresholds (e.g., "Alert me if km > 15").
- [ ] **Historical Analytics Dashboard**: A web interface to visualize 15+ years of station performance and weather trends.
- [ ] **Expanded Station Support**: Add more stations in Northern Spain (e.g., Leitariegos, Alto Campoo).
## 🔵 Ongoing Maintenance
- [ ] **Model Retraining**: Monitor weekly retraining performance and tune hyperparameters.
- [ ] **Data Quality**: Continuously verify scraping reliability from Infonieve and Open-Meteo.
- [ ] **Documentation**: Keep the API spec and operations guide updated as features are added.
## ⚪ Completed Milestones
- [x] **SQLite Migration**: Moved from CSV/JSON file-based storage to a unified SQLite database.
- [x] **JWT Authentication**: Implemented secure API access with registration and login.
- [x] **Hybrid Predictor**: Combined rule-based logic with ML models for high accuracy.
- [x] **Weighted Training**: Prioritized recent historical data to account for methodological changes.
- [x] **Telegram Bot Subprocess**: Integrated the bot directly into the FastAPI lifespan.