From 9d75a71522b016d512d42d7df061f0ea6ed00344 Mon Sep 17 00:00:00 2001 From: maxime Date: Wed, 25 Nov 2026 14:28:23 +0100 Subject: [PATCH] The detectors are in detectors/detectors/; the manual set and the benchmark in models/rules/ (moved from aimsight-detectors) Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- README.md | 2 +- app/README.md | 2 +- app/server/station.py | 12 ++++++------ app/web/src/pages/Data.jsx | 8 ++++---- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index b7a6cbf..b065bca 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ aimsight-app: the control station of the AIMsight diagnostic (`README.md`): the - **The links** (ignored by git, one copy of each repository on the workstation): `data/`, `labeling/`, `detectors/`, `tools/`, `agents/`, `optimizer/`, `models/` (the pilot of learned detectors), `libredesk/` (the LibreDesk conversations); each thing is committed in its own repository, never here. This repository carries no agent, no reading tool, no workflow. - **The truth**: the labels of `labeling/auto/`; the labeling knowledge is in `labeling/`. - **The contracts**: the app calls the methods of the other repositories and holds no domain logic: with the detectors, `detectors/CLAUDE.md` (`categories.window`, `bench/score.py`); with the labels, `labeling/CLAUDE.md` (`scripts/validate.py` `check`, `scripts/ids.py` `assign`, `scripts/client.py`, `scripts/points.py` for the point labels); with the data, `~/aimsight-data` (`extraction/pumping.py`; the weather is pumped into `data//weather/`; the runs of `data_diff//runs//` are stations `@` of the Data page, with the labels of ``, not for the agents); with the agents, `agents/README.md` (the requests of the analyst and of the support); with Optimizer, `optimizer/README.md` (the request of `/optimize`); with LibreDesk, `libredesk/conversations/pulling.py` (`start`, `running`, `log`). A renaming over there requires the change here. One reader of the measurements, `tools/scripts/data.py`, for the Data page, the tools and the detectors (benchmark and Optimizer included): a reading fix there changes the benchmark. -- **The benchmark**: `python3 detectors/bench/regression.py --labels labeling/auto --data data` (~1 min); the score of a range: `python3 detectors/bench/score.py data/ --labels labeling/auto/.jsonl --from YYYY-MM-DD --to YYYY-MM-DD` (`--to` excluded). +- **The benchmark**: `python3 models/rules/bench/regression.py --labels labeling/auto --data data` (~1 min); the score of a range: `python3 models/rules/bench/score.py data/ --labels labeling/auto/.jsonl --from YYYY-MM-DD --to YYYY-MM-DD` (`--to` excluded). - **The pumping**: in `~/aimsight-data` (`extraction/pump.sh`, VS Code tasks **pump**, **pump a range**), read-only on the platform; user guide `~/aimsight-data/extraction/README.md`. Claude may launch it on small ranges; a long range or a history, outside busy hours. - **Check a change of the app**: `.venv/bin/python app/server/check.py`, then `cd app/web && npm run build` and launch the server. The labels: `python3 labeling/validate.py`. - **The server**: the systemd user service `aimsight-app` (`~/.config/systemd/user/aimsight-app.service`, `README.md` "Run as a service") serves http://127.0.0.1:8770, started with the workstation; it keeps the code it loaded: a change of the server or of the page is seen only after `systemctl --user restart aimsight-app` (it rebuilds the page itself), which interrupts nothing only when no analysis, optimization or support is running; its log, `journalctl --user -u aimsight-app`. A test server beside it: `AIMSIGHT_PORT=8771 .venv/bin/python app/server/server.py --no-browser`. diff --git a/README.md b/README.md index 8025e14..7030b74 100644 --- a/README.md +++ b/README.md @@ -67,4 +67,4 @@ The pumping is in the `~/aimsight-data` repository (`extraction/`, VS Code tasks - the app: `.venv/bin/python app/server/check.py`; - the labels: `python3 labeling/scripts/validate.py` (the labels submitted by the app do not have `review` yet, which it requires: as many expected errors); -- the detectors (benchmark, ~1 min): `python3 detectors/bench/regression.py --labels labeling/auto --data data`. +- the detectors (benchmark, ~1 min): `python3 models/rules/bench/regression.py --labels labeling/auto --data data`. diff --git a/app/README.md b/app/README.md index fa130bc..c910ae5 100644 --- a/app/README.md +++ b/app/README.md @@ -6,7 +6,7 @@ The tool of the manual diagnostic: three pages, **Data**, **Stations** and **Con - **The plots**: one at the start (displacements, camera, image quality, system metrics), "Add a plot" to see several, aligned in time, the cross to remove one; a click on a curve sets the images to the image nearest to that moment. The zones of the labels are barely visible there (opacity 0.05, 0.07 in dark mode). - **The labels**, under the plots, and their bar, according to the chosen source: - - **Detectors** (default): the detectors' events (`detectors/scripts/categories.py`, `window`: the range with its 3 days of history), read-only. The bar carries only their family, the tooltip their targets; on click: their dates, their sensors (targets and references), the message and the action (`labeling/scripts/client.py`: the first sentence of the text of the event; the "For the client" columns of `labeling/families.md`, per family, refined per variety); + - **Detectors** (default): the detectors' events (`detectors/detectors/categories.py`, `window`: the range with its 3 days of history), read-only. The bar carries only their family, the tooltip their targets; on click: their dates, their sensors (targets and references), the message and the action (`labeling/scripts/client.py`: the first sentence of the text of the event; the "For the client" columns of `labeling/families.md`, per family, refined per variety); - **LLM**: `labeling/auto/.jsonl`, read-only; - **Analysis**: the same labels, to edit or delete; writes in `labeling/auto/.jsonl`, each label checked by the rules of labeling (`labeling/scripts/validate.py`, `check`: one of the seven families, no numeric value…) and given its id (`ids.py`, `assign`); - **Support**: the same labels, read-only, to ask the support a question on a range. diff --git a/app/server/station.py b/app/server/station.py index 8d1f974..de252f2 100644 --- a/app/server/station.py +++ b/app/server/station.py @@ -1,7 +1,7 @@ """The data of the Data page: a station's images, its curves, its labels. Data are read as the agents read them, tools/scripts/data.py (the tools repository, through the tools/ link); the detectors' -events are those of detectors/scripts/categories.py (window); the rules of the labels and what the client is told, those of +events are those of detectors/detectors/categories.py (window); the rules of the labels and what the client is told, those of labeling/scripts (validate, ids, client). Read-only on data/, filled only by pump.sh; writes only in labeling/auto/. What brings data in (the pumping, the list of the tracked stations) is in ~/aimsight-data, called as it is (extraction/pumping.py); the weather is pumped with the data, data//weather/ (data.load_weather). @@ -25,7 +25,7 @@ from pathlib import Path ROOT = Path(__file__).resolve().parents[2] # ~/aimsight-data, the repository of data/: the method that brings data in (the pumping, the weather with it), called as it is DATA_REPOSITORY = Path(os.environ.get("AIMSIGHT_DATA", ROOT / "data")).resolve().parent -sys.path[:0] = [str(ROOT / "tools" / "scripts"), str(ROOT / "detectors" / "scripts"), str(ROOT / "labeling" / "scripts"), +sys.path[:0] = [str(ROOT / "tools" / "scripts"), str(ROOT / "detectors" / "detectors"), str(ROOT / "labeling" / "scripts"), str(DATA_REPOSITORY / "extraction")] import categories # noqa: E402 import client # noqa: E402 (labeling: what the client is told of an event) @@ -266,9 +266,9 @@ def pump(body): # --- the Data page, "Detectors" labels: the events of the journal, read-only -# The sets of detectors: detectors/scripts/ (classic, imported here), detectors/manual/ (the same layout, hand-made: run in +# The sets of detectors: detectors/detectors/ (classic, imported here), models/rules/manual/ (the same layout, hand-made: run in # a process of its own, its modules bear the same names as the classic ones) -MANUAL = ROOT / "detectors" / "manual" +MANUAL = ROOT / "models" / "rules" / "manual" CHILD = ("import pickle, sys; out, sys.stdout = sys.stdout.buffer, sys.stderr; sys.path.insert(0, sys.argv[1]); import categories; " "pickle.dump(categories.window(*pickle.load(sys.stdin.buffer)), out)") @@ -278,7 +278,7 @@ def window(set_, every, a, b, sensitivity=0): if set_ != "manual": return categories.window(every, a, b) if not (MANUAL / "categories.py").is_file(): - raise Refusal("no manual detectors: detectors/manual/ has no categories.py") + raise Refusal("no manual detectors: models/rules/manual/ has no categories.py") run = subprocess.run([sys.executable, "-c", CHILD, str(MANUAL)], input=pickle.dumps((every, a, b, sensitivity or None)), capture_output=True, cwd=ROOT) sys.stderr.write(run.stderr.decode(errors="replace")) if run.returncode: @@ -296,7 +296,7 @@ def detectors(station, start, end, targets="", set_="classic", sensitivity=0): def journal(station, start, end, targets="", set_="classic", sensitivity=0): """-> the detectors' events over the range, in the label format (start, end, family, description); plus kind, sensors, ignore (greyed area of the journal). targets: the sensors kept, comma-separated (empty: all); the others are - removed before the detectors, as if they did not exist. set_: classic (detectors/scripts/) or manual (detectors/manual/); + removed before the detectors, as if they did not exist. set_: classic (detectors/detectors/) or manual (models/rules/manual/); sensitivity: of the manual set, 1 (tolerant) to 10 (severe), 0: the default of the code.""" d = folder(station) every = data.load(d) diff --git a/app/web/src/pages/Data.jsx b/app/web/src/pages/Data.jsx index 25125eb..5de18ff 100644 --- a/app/web/src/pages/Data.jsx +++ b/app/web/src/pages/Data.jsx @@ -17,7 +17,7 @@ const FAMILIES = { "Anomaly": "#e03131", "Visibility": "#8ec5e8", "Obstruction": "Target issue": "#e6d46a", "No data": "#c4c4be", "None": "#a8d5a2" }; const FAMILY_NAME = f => (f === "None" ? "None (curves intact)" : f); // A label of auto/ has one of the seven families (labeling/scripts/validate.py); None is the expert's, in manual/; -// Anomaly, the detectors' alone (detectors/manual/events.py: something happened, without saying what) +// Anomaly, the detectors' alone (models/rules/manual/events.py: something happened, without saying what) const FAMILY_CHOICES = [{ value: "", label: "(choose a family)" }, ...Object.keys(FAMILIES).filter(f => f !== "None" && f !== "Anomaly").map(f => ({ value: f, label: f }))]; // LLM and Analysis: the same labels, labeling/auto/; LLM reads them, Analysis edits, deletes them, and has the analyst make @@ -51,7 +51,7 @@ export default function Data({ selection, choose, analysis, setAnalysis, support const [source, setSource] = useState("detectors"), [families, setFamilies] = useState(DETECTED), [targets, setTargets] = useState(""); const [focus, setFocus] = useState(false); // with an event open, the plots show only its sensors const [hidden, setHidden] = useState([]); // the targets removed from the plots (the detectors still read them) - const [set, setSet] = useState("classic"); // the detectors: classic (detectors/scripts/) or manual (detectors/manual/) + const [set, setSet] = useState("classic"); // the detectors: classic (detectors/detectors/) or manual (models/rules/manual/) const [sensitivity, setSensitivity] = useState(5); // of the manual set: 1 (tolerant) to 10 (severe); 5, its limits as written const [cut, setCut] = useState(false); // the points under a label of the checked families removed, the curves joined const { station, start, end } = selection; @@ -133,7 +133,7 @@ function Settings({ d, families, setFamilies, targets, setTargets, detect, focus
Detectors + data={[{ value: "classic", label: "Classic" }, { value: "manual", label: "Manual (models/rules/manual/)" }]} />
{set === "manual" &&
Sensitivity: {sensitivity} @@ -621,7 +621,7 @@ function Analysis({ kind = "analyses", name, dark, done, close }) { {o.state === "interrupted" && Stopped with the server; rerun it with the button.} {o.summary && } - {o.summary && python3 detectors/bench/score.py data/{d.station} --labels labeling/auto/{d.station}.jsonl --from {d.start.slice(0, 10)} --to {end}} + {o.summary && python3 models/rules/bench/score.py data/{d.station} --labels labeling/auto/{d.station}.jsonl --from {d.start.slice(0, 10)} --to {end}} )} labeling/auto/{kind}/{name}/