Development - #1
Merged
Merged
Conversation
- Add parktrack_ml/service.py: internal APScheduler (forecasts every :00/:30, weather every :05, retrain daily at 02:00 UTC) - Add parktrack_ml/weather.py: Open-Meteo integration, auto-creates weather_observations table on startup, 200-day backfill - Add parktrack_ml/model.py: CustomLogisticRegression + CustomScaler (pure numpy) - Add parktrack_ml/data_loader.py: direct DB access for bulk training data - Add parktrack_ml/config.py: env-based configuration (DB_*, API_*) - Add parktrack_ml/interfaces.py: predict(zone_id, predicted_for) public API - Add parktrack_ml/forecaster.py: 24h forecasts via ThreadPoolExecutor - Add migrations/001_weather_observations.sql - Add docs/weather.mdx
- Remove all DB credentials and psycopg2 from config, data_loader, weather, forecaster - weather.py: read/write via GET /weather and POST /weather/new - data_loader.py: occupancy and zone data via GET /occupancy and GET /zones - api_client.py: add get_cameras(), get_weather(), post_weather(); make model_type a parameter in post_forecast() - forecaster.py: get active zones via API, pass model_type=logistic_regression - service.py: remove DB table setup, API_URL/API_TOKEN only - train.py: logistic regression training, data from API - requirements.txt: remove psycopg2, add APScheduler - docs/weather.mdx: updated to match official ParkTrack API spec - migrations/: removed (table managed by api-server)
Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
Large time windows (30+ days) caused ReadTimeout on the /occupancy endpoint. Now splits the date range into 7-day chunks and deduplicates results. Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
- Use pd.to_numeric/to_datetime with errors='coerce' in _parse_occupancy - Filter empty chunks before concat to preserve column dtypes - Return only expected columns to avoid schema drift from API Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
- Replace logistic regression with LightGBM (LGBMWrapper) - Add cyclical time encoding (sin/cos for hour, day-of-week, month) - Add zone_id as categorical feature (per-zone pattern learning) - Add Russian federal holidays as is_holiday feature - Training now uses 150 days of data (vs 30) → 17k+ samples - Temporal 80/20 train/val split with per-class precision/recall/f1 - Val accuracy: 90.9% (was 76.2% LR on train set) - Top features: occupancy_lag_1h, zone_id, occupancy_ma_6h - Fix per-zone chunked loading to avoid concat dtype regression - Keep CustomLogisticRegression as fallback in model.py Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
- README now reflects actual architecture: LightGBM, APScheduler, 28 features, 90.9% val accuracy - Add integration snippet for docker-compose and Python package usage - Fix Dockerfile.predict CMD: was running predict.py, now runs service.py (the actual scheduler entrypoint) - Update .env.example to remove obsolete vars Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
nawinds
added a commit
that referenced
this pull request
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.