21 lines
2.5 KiB
Markdown
21 lines
2.5 KiB
Markdown
# detectors
|
|
|
|
AIMsight anomaly detectors (Python 3, standard library only) and their benchmark (`bench/`); nothing else. They are improved by Optimizer (`improve` skill) with the upgrader and validator of the agents repository. Everything is in English: code, identifiers, docs, outputs. Layout and usage: `README.md`.
|
|
|
|
## Contract (do not break)
|
|
|
|
- One detector per family, in `scripts/`: `visibility.py`, `obstruction.py`, `target_issue.py`, `thermal_displacement.py`, `no_data.py`, `displacement.py` (D-119). `categories.py` loads every `scripts/*.py` that has `detect`: never put another script with a `detect` function, or with side effects at import, directly in `scripts/`; tools go in `bench/`.
|
|
- `detect(measurements)` returns episodes with the keys `start`, `end`, `kind` (the family), `label` (the variety), `text`, `ignore`, `sensors`. A detector may also declare `temperature`, `camera`, `metrics` (`categories.CONTEXT`) or `end`; `categories.events` passes them by introspection.
|
|
- Label files are external data and keep their French keys: `debut`, `fin`, `categorie`, `description`.
|
|
- Two repositories use this one through a `detectors -> ~/detectors` link (one copy on the workstation: a commit here is live for both at once); a rename here needs the matching change there:
|
|
- Diagnostic-app: `categories.events`, `categories.CATEGORIES` (`process`: `images`, `none`, `check`), the `--from/--to` CLIs, `bench/score.py` (the command shown in the page);
|
|
- Optimizer (`improve` skill and its agents): `scripts/categories.py --from/--to`, `bench/` (`score.py`, `regression.py`, `sensors.py`); its upgrader changes `scripts/*.py` and `thresholds.md`, one commit per fix.
|
|
|
|
## Rules
|
|
|
|
- A constant added or changed updates `thresholds.md` in the same change; check with `grep -nE "^[A-Z_0-9]+ = " scripts/*.py`.
|
|
- No rule specific to a station, a sensor or a date.
|
|
- A change to a detector is checked with the benchmark: `python3 bench/regression.py --labels <labels folder> --data <data folder>` (Diagnostic-app and Optimizer: `labeling/auto`, `data`, links to the shared `~/labeling` and `~/aimsight-data/data`; about 3 min). A refactoring must leave every figure unchanged.
|
|
- History references in docstrings and `thresholds.md` ("wf-improve X, mod. 1, S2", "X, batch 01", D-xxx, E-xxx) point to past runs and to decisions recorded in Diagnostic-app/Support-Agent; keep them when editing a rule.
|
|
- The bench tools take their paths as arguments; the architecture of the repositories: `~/Diagnostic-App/docs/architecture.drawio`.
|