From 21a35d90aaf6d9ffae0e1dde0a228a5b2a68ec10 Mon Sep 17 00:00:00 2001 From: maxime Date: Fri, 13 Nov 2026 17:01:14 +0100 Subject: [PATCH] Optimizer, second user of the contract (categories, scripts/data.py); labels and data from the labeling and aimsight-data repositories Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 6 ++++-- README.md | 2 +- scripts/data.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 67cb117..bd18da2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,7 +7,9 @@ AIMsight anomaly detectors (Python 3, standard library only) and the Claude Code - 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 `skills/wf-improve/scripts/`. - `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`. -- Diagnostic-app uses this repository as its `detectors/` submodule: `categories.events`, `categories.CATEGORIES` (`process`: `images`, `none`, `check`), the `--from/--to` CLIs, `/detectors:wf-improve`. A rename here needs the matching change there. +- Two repositories use this one as their `detectors/` submodule; a rename here needs the matching change there: + - Diagnostic-app: `categories.events`, `categories.CATEGORIES` (`process`: `images`, `none`, `check`), the `--from/--to` CLIs, `/detectors:wf-improve`; + - Optimizer (`batch.py`): `categories.events`, `categories.CATEGORIES`, and from `scripts/data.py` `load`, `load_temperature`, `is_reference`, `rejected`, `parse_time`, `iso`. ## The workflow stays generic @@ -17,5 +19,5 @@ AIMsight anomaly detectors (Python 3, standard library only) and the Claude Code - 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 skills/wf-improve/scripts/regression.py --labels --data ` (Diagnostic-app: `labeling/auto`, `data`; about 3 min). A refactoring must leave every figure unchanged. +- A change to a detector is checked with the benchmark: `python3 skills/wf-improve/scripts/regression.py --labels --data ` (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. diff --git a/README.md b/README.md index ceb6961..4ef7c3e 100644 --- a/README.md +++ b/README.md @@ -54,4 +54,4 @@ python3 skills/wf-improve/scripts/score.py --labels .jsonl> --data /> ``` -Copied from Support-Agent on 2026-11-13 (commit 48a3092); the detectors now evolve here. Used by Diagnostic-app, where it is the `detectors/` submodule. +Copied from Support-Agent on 2026-11-13 (commit 48a3092); the detectors now evolve here. Used by Diagnostic-app and Optimizer, where it is the `detectors/` submodule; their labels come from the `labeling` repository, their data from `aimsight-data`. diff --git a/scripts/data.py b/scripts/data.py index d833b6b..3d57de1 100644 --- a/scripts/data.py +++ b/scripts/data.py @@ -1,6 +1,6 @@ """Reading a station folder (standard library only). Every time is UTC. -Column formats: labeling/connaissances/colonnes-des-deplacements.md in Diagnostic-app. +Column formats: connaissances/colonnes-des-deplacements.md in the labeling repository. """ import csv import glob