Add AIAvailabilityStatus and AIRecognitionConfig classes for AI model management

- Introduced `AIAvailabilityStatus` class to manage the availability status of AI models, including methods for setting status and logging messages.
- Added `AIRecognitionConfig` class to encapsulate configuration parameters for AI recognition, with a static method for creating instances from dictionaries.
- Implemented enums for AI availability states to enhance clarity and maintainability.
- Updated related Cython files to support the new classes and ensure proper type handling.

These changes aim to improve the structure and functionality of the AI model management system, facilitating better status tracking and configuration handling.
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-03-31 05:49:51 +03:00
parent fc57d677b4
commit 8ce40a9385
43 changed files with 1190 additions and 462 deletions
@@ -0,0 +1,52 @@
# Baseline Metrics
**Run**: 01-code-cleanup
**Date**: 2026-03-30
## Code Metrics
| Metric | Value |
|--------|-------|
| Source LOC (pyx + pxd + py) | 1,714 |
| Test LOC (e2e + mocks) | 1,238 |
| Source files | 22 (.pyx: 10, .pxd: 9, .py: 3) |
| Test files | 10 |
| Dependencies (requirements.txt) | 11 packages |
| Dead code items identified | 20 |
## Test Suite
| Metric | Value |
|--------|-------|
| Total tests | 23 |
| Passing | 23 |
| Failing | 0 |
| Skipped | 0 |
| Execution time | 11.93s |
## Functionality Inventory
| Endpoint | Method | Coverage | Status |
|----------|--------|----------|--------|
| /health | GET | Covered | Working |
| /detect | POST | Covered | Working |
| /detect/{media_id} | POST | Covered | Working |
| /detect/stream | GET | Covered | Working |
## File Structure (pre-refactoring)
All source code lives in the repository root — no `src/` separation:
- Root: main.py, setup.py, 8x .pyx, 7x .pxd, classes.json
- engines/: 3x .pyx, 4x .pxd, __init__.py, __init__.pxd
- e2e/: tests, mocks, fixtures, config
## Dead Code Inventory
| Category | Count | Files |
|----------|-------|-------|
| Unused methods | 4 | serialize() x2, from_msgpack(), stop() |
| Unused fields | 3 | file_data, model_batch_size, annotation_name |
| Unused constants | 5 | CONFIG_FILE, QUEUE_CONFIG_FILENAME, CDN_CONFIG, SMALL_SIZE_KB, QUEUE_MAXSIZE |
| Orphaned declarations | 3 | COMMANDS_QUEUE, ANNOTATIONS_QUEUE, weather enum PXD |
| Dead imports | 4 | msgpack x3, typing/numpy in pxd |
| Empty files | 1 | engines/__init__.pxd |