# Changelog All notable changes to the `chicken-counting-sukawarna-det` project are documented in this file. ## [Unreleased] - 2026-08-19 ### 🐛 Bug Fixes - **Multi-Floor Script Syntax (`run_all_coops.sh`)**: - Resolved fatal `syntax error: unexpected end of file` caused by missing `done` in floor configuration discovery loop. - Expanded config discovery pattern from `K*-L*.yaml` to `*.yaml` to support custom named coops (e.g. `kandang-atas.yaml`). - **Excel Report Empty Result Crash (`export_excel_report.py`)**: - Added empty DataFrame pre-check to prevent `IndexError` when exporting reports for dates with no batch runs or newly initialized databases. - **Multi-Threaded SQLite Concurrency (`dashboard.py`)**: - Replaced global single `sqlite3` connection with thread-local connections (`threading.local()`) to prevent cursor collision and race conditions across concurrent HTTP worker threads. - Enabled `PRAGMA busy_timeout = 5000` and `PRAGMA journal_mode = WAL` to avoid database lock conflicts during batch processing writes. - **Editable Package Installation**: - Configured `pip install -e .` in environment setup to resolve `chicken_counter` imports and enable automatic unit test discovery without manual `PYTHONPATH` prefixes. ### ⚡ Performance & Optimization - **Disk Traversal Caching in Live Dashboard (`dashboard.py`)**: - Replaced repetitive `Path.rglob()` scans on every `/api/mortality/*` endpoint with a thread-safe 15-second in-memory TTL cache (`_MORTALITY_CACHE_TTL = 15.0s`). - Added $O(1)$ memory index lookup for serving annotated images (`/api/mortality/image/`), eliminating full filesystem traversals across 30GB+ video datasets. ### 📁 Configuration & Directory Structure - **Floor Configuration & Skeleton Paths**: - Created `configs/floor_config/kandang-atas.yaml` extending `cycle7_batch_optimized.yaml`. - Initialized missing directory skeletons for coops `K1-L1` through `K5-L2` under `../VIDEOS/cycle7/`. - **Documentation**: - Updated `README.md` and `RUN.md` with editable install steps and updated project layout.