Files
andrew 4bcd242dd3 feat(services,weight): split count/weight services, day-0 cycle handling, disable step-function GBM
- 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).
2026-10-08 17:02:21 +07:00

47 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Portable Systemd Service Installer for Chicken Counter Dashboard
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CURRENT_USER="$(id -un)"
SERVICE_NAME="chicken-dashboard.service"
echo "=== Chicken Dashboard Service Installer ==="
echo "Target User: $CURRENT_USER"
echo "Project Dir: $SCRIPT_DIR"
# Check if user wants user-level systemd (no root required) or system-level systemd
USER_SERVICE_DIR="$HOME/.config/systemd/user"
mkdir -p "$USER_SERVICE_DIR"
cat <<EOF > "$USER_SERVICE_DIR/$SERVICE_NAME"
[Unit]
Description=Chicken Counter Live Dashboard
After=network.target
[Service]
Type=simple
WorkingDirectory=$SCRIPT_DIR
ExecStart=$SCRIPT_DIR/start_dashboard.sh
Restart=always
RestartSec=5
Environment=PYTHONUNBUFFERED=1
Environment=PORT=8090
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload || true
systemctl --user enable --now "$SERVICE_NAME" || true
loginctl enable-linger "$CURRENT_USER" || true
echo ""
echo "✅ Installed, enabled, and started user service: $USER_SERVICE_DIR/$SERVICE_NAME"
echo "✅ Enabled user lingering for '$CURRENT_USER' (dashboard stays running across reboots and logouts)."
echo ""
echo "To check status:"
echo " systemctl --user status $SERVICE_NAME"
echo ""