c09a76d's DELETE lived only in gitignored chicken_counts.db-wal; the
committed blob still had the 5 K2-L1 day-138 rows. PRAGMA
wal_checkpoint(TRUNCATE) applied; standalone file now 469 rows, 0 with
cycle_day>=100. Also moved host run dir
../VIDEOS/cycle7/K2/L1/2026-10-07 (day-138 predictions_*.parquet fed
dashboard weight trend) to /tmp/opencode/k2l1-purged/.
- use_gbm=True (f99fec9) activated step-function joblib: predicted
weight constant per cycle-day band (215.6g days 9-11 across all
cameras regardless of area). Revert to False per growth_model.py
TODO: retrain with real morphometry + features_dict before re-enable.
- Delete 5 batch_runs rows location=K2-L1 date=2026-10-07 cycle_day=138
(one-off manual run with stale cycle_start 2026-05-22; Gompertz
baseline 4649g polluted trend). Backup: db/*.bak-before-k2purge-*.
- upsert now updates started_at so reruns keep self-consistent rows
(live row had started_at from run 1, completed_at from run 2)
- status defaults to FAILED so KeyboardInterrupt/SystemExit log truthfully
instead of SUCCESS; SUCCESS/SKIPPED set explicitly on return
Split services run weighing (06:00) before counting (08:00) for the same
date; on a fresh date no batch_runs rows exist yet, so the per-cam
UPDATE ... WHERE date/location/camera_id matched 0 rows silently and only
the FUSED upsert survived. Per-cam predicted_weight_g etc. showed 0 in
/api/db/date after counting filled the rows.
Upweight via INSERT ... ON CONFLICT DO UPDATE (weight columns only,
counts untouched) in new _upsert_weight_metrics helper; counting's later
count-column upsert likewise leaves weight columns alone, so both run
orders now persist both halves.
Tests: PYTHONPATH=src python3 -m unittest discover -s tests -p "test_*.py"
-> Ran 53, 49 pass, 2 pre-existing failures unchanged from 61ca7c2
(fusion n_valid_samples, consolidate fixture).
- services: separate 08:00 counting and 06:00 weighing systemd units/timers,
run_daily_counting.sh / run_daily_weighing.sh, install_service.sh update
- dashboard: guard /api/weight/coops against rows without weight data
- sim/day-0: CYCLE_START_DATE 2026-10-01 (day 0 = DOC arrival, counts only);
consolidation skips cycle_day 0 artifacts (storage.py guard)
- weight: predict_chicken_weight(use_gbm=False) default. Retrained joblib
(LGBM, 14:26) predicts a step function of cycle_day only (108.1 g days 1-5,
140.1 g days 6-8, zero sensitivity to camera area); fallback Gompertz +
allometric blend restored, varies per camera/day (37.2-115.7 g over days 1-7).
Re-enable only after model retrained on early-day morphometry with
features_dict/volumetric wired (see ponytail comment in growth_model.py).
Covered by new tests/test_growth_model_gbm.py
- models/scripts: retraining tooling (train_weight_model.py,
train_c23_focused_model.py), retrained joblib, historical_weights_avg.csv
- configs/template/requirements: cycle7 batch yamls, index.html, deps
- data: db/chicken_counts.db + reports refreshed from 2026-10-01..08 rerun
Tests: PYTHONPATH=src python3 -m unittest discover -s tests -p "test_*.py"
-> Ran 51, 49 pass. 2 pre-existing failures unchanged from baseline
(61ca7c2): fusion n_valid_samples 59!=98, consolidate fixture (day-0 date
conflicts with day-0 skip).
Consolidation re-derived features/predictions without location/coop and
overwrote batch-written K1-L1 values with blanks; CSV reads then turned
blanks into literal "nan" and parquet rows fell back to bogus
FULL/FULL_CYCLE path inference.
- storage.py: pass location/coop from curation JSONs into
aggregate_camera_features / build_cage_day_features_and_predictions
- dashboard.py: _enrich_records treats NaN/"nan" as missing;
/api/weight/coops buckets and /api/weight/coop/<id> filter use
row values instead of path inference
- tests: assert re-derived date-folder + merged rows keep K1/K1-L1
Skip loudly (exit 1, no symlinks/state touched) when nvidia-smi reports
<6000 MiB free or no driver: the 2026-10-07 cron OOM'd after the
retraining-backend container took 7.4 GB VRAM at startup.
- rename merged-output folder to cycle_weight_parquet_data, now a single
CYCLE_WEIGHT_DIR_NAME constant shared with daily_size_comparison.py
(xlsx default path + merged parquet lookups) and the dashboard.py
coop/location skip-list, so the rename cannot half-apply again
- drop full_cycle_*.csv by default (235.8 MB vs 28.8 MB parquet on a
49-day cycle, same rows); consolidate-parquets --with-csv restores them
- simulate_daily_cycle.sh consolidates after each successful batch
(batch no longer execs) and only warns on consolidation failure
- verified: 6-date sim root consolidated 118427 rows == sum of daily
parquets, 0 dupes on rerun, daily_size_comparison.xlsx generated,
49 unit tests pass
- Update uniformity calculations in aggregation, curation, and dashboard endpoints from ±10% to ±5% of median
- Synchronize API documentation and unit tests for the 5% window
- Update SQLite database counts and ignore local weights directory
- USER_ACCESS: use central password field plus display_name,
last_login, is_superuser, is_staff, is_active
- CYCLES: nullable end_date plus proposed_end_date,
close_requested_at/by_id, feed_initial_balance(_date)
- MANUAL_INPUT: add feed_out_manual(_total)
- Add API_KEYS machine-credential table and relationships
- Remove ERD_central_dashboard.json snapshot (ERD.md is source of truth)
- Compute frequency (valid sample count), excluded (discarded outliers/duplicates), and uniformity (% within +/- 10% of median) during track curation and feature aggregation
- Expose frequency, excluded, and uniformity across all weight endpoints in dashboard.py (/api/weight/predictions, /api/weight/predictions/<date>, /api/weight/features/<date>, /api/weight/curation/..., and /api/db/date/<date>)
- Update API.md, ERD.md, CHANGELOG.md, and CENTRAL_DASHBOARD_INTEGRATION.md
- Add comprehensive test assertions in test_dashboard_weight_api.py and test_weight_estimation.py
- Propagate parent coop (e.g. K1) and floor location (e.g. K1-L1) across feature aggregation, predictions, and curation storage
- Add REST API endpoints GET /api/weight/coops and GET /api/weight/coop/<coop_id>
- Support multi-coop non-colliding predictions and ?coop= / ?location= filtering
- Add dynamic farm root discovery and folder path fallback inference for legacy datasets
- Persist FUSED flock weight in SQLite batch_runs table with camera_id='FUSED'
- Update GET /api/db/date/<date> to return weight and coop metadata for all cameras
- Update ERD.md, CHANGELOG.md, API.md, and CENTRAL_DASHBOARD_INTEGRATION.md
- Add comprehensive unit tests in test_weight_estimation.py and test_dashboard_weight_api.py
- Fix static JavaScript syntax error in templates/index.html with Number() wrapper
- Enhance compute_metric_mask() with second-order central moments (inertia tensor) and minAreaRect fallback
- Add backup db ignore pattern and fix typo in .gitignore
- Update SQLite database with full cycle batch runs and add analytical Excel report workbooks
- Include daily weight GBM model artifact
- Implement compute_metric_mask for instance segmentation polygon contour area and ellipse fitting
- Implement consolidate_full_cycle_datasets with multi-camera (CC1..CC4) discovery and FUSED aggregation
- Fix parallel worker race conditions in batch_runner.py during simultaneous camera parquet writes
- Implement daily_size_comparison.py generating daily_size_comparison.xlsx with ground-truth scale weights
- Add cycle7_batch_segmentation_masking.yaml and test_run_full_cycle7_segmentation_masking.sh with toggleable geometry mode
- Harden SQLite WAL concurrency across batch_runner.py and store_results.py with busy_timeout=60000 and synchronous=NORMAL
- Add unit tests for mask metrics and reports (32/32 tests passing)
- Update CHANGELOG.md, README.md, and RUN.md