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 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-25 14:28:23 +01:00
1 parent cae07a2787
commit 9d75a71522
5 files changed
+13 -13

No files matched your search

+1 -1
View File
@@ -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 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 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/<STATION>/weather/`; the runs of `data_diff/<SERIAL>/runs/<run>/` are stations `<SERIAL>@<run>` of the Data page, with the labels of `<SERIAL>`, 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 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/<STATION>/weather/`; the runs of `data_diff/<SERIAL>/runs/<run>/` are stations `<SERIAL>@<run>` of the Data page, with the labels of `<SERIAL>`, 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/<STATION> --labels labeling/auto/<STATION>.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/<STATION> --labels labeling/auto/<STATION>.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. - **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`. - **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`. - **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`.
+1 -1
View File
@@ -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 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 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`.
+1 -1
View File
@@ -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 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: - **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/<STATION>.jsonl`, read-only; - **LLM**: `labeling/auto/<STATION>.jsonl`, read-only;
- **Analysis**: the same labels, to edit or delete; writes in `labeling/auto/<STATION>.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`); - **Analysis**: the same labels, to edit or delete; writes in `labeling/auto/<STATION>.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. - **Support**: the same labels, read-only, to ask the support a question on a range.
+6 -6
View File
@@ -1,7 +1,7 @@
"""The data of the Data page: a station's images, its curves, its labels. """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' 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/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 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/<STATION>/weather/ (data.load_weather). is (extraction/pumping.py); the weather is pumped with the data, data/<STATION>/weather/ (data.load_weather).
@@ -25,7 +25,7 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[2] 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 # ~/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 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")] str(DATA_REPOSITORY / "extraction")]
import categories # noqa: E402 import categories # noqa: E402
import client # noqa: E402 (labeling: what the client is told of an event) 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 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) # 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; " 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)") "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": if set_ != "manual":
return categories.window(every, a, b) return categories.window(every, a, b)
if not (MANUAL / "categories.py").is_file(): 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) 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")) sys.stderr.write(run.stderr.decode(errors="replace"))
if run.returncode: 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): 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, """-> 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 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.""" sensitivity: of the manual set, 1 (tolerant) to 10 (severe), 0: the default of the code."""
d = folder(station) d = folder(station)
every = data.load(d) every = data.load(d)
+4 -4
View File
@@ -17,7 +17,7 @@ const FAMILIES = { "Anomaly": "#e03131", "Visibility": "#8ec5e8", "Obstruction":
"Target issue": "#e6d46a", "No data": "#c4c4be", "None": "#a8d5a2" }; "Target issue": "#e6d46a", "No data": "#c4c4be", "None": "#a8d5a2" };
const FAMILY_NAME = f => (f === "None" ? "None (curves intact)" : f); 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/; // 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)" }, const FAMILY_CHOICES = [{ value: "", label: "(choose a family)" },
...Object.keys(FAMILIES).filter(f => f !== "None" && f !== "Anomaly").map(f => ({ value: f, label: f }))]; ...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 // 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 [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 [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 [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 [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 [cut, setCut] = useState(false); // the points under a label of the checked families removed, the curves joined
const { station, start, end } = selection; const { station, start, end } = selection;
@@ -133,7 +133,7 @@ function Settings({ d, families, setFamilies, targets, setTargets, detect, focus
<div> <div>
<Text size="sm" fw={500}>Detectors</Text> <Text size="sm" fw={500}>Detectors</Text>
<SegmentedControl size="xs" mt={4} value={set} onChange={setSet} <SegmentedControl size="xs" mt={4} value={set} onChange={setSet}
data={[{ value: "classic", label: "Classic" }, { value: "manual", label: "Manual (detectors/manual/)" }]} /> data={[{ value: "classic", label: "Classic" }, { value: "manual", label: "Manual (models/rules/manual/)" }]} />
</div> </div>
{set === "manual" && <div> {set === "manual" && <div>
<Text size="sm" fw={500}>Sensitivity: {sensitivity}</Text> <Text size="sm" fw={500}>Sensitivity: {sensitivity}</Text>
@@ -621,7 +621,7 @@ function Analysis({ kind = "analyses", name, dark, done, close }) {
{o.state === "interrupted" && <Text size="sm" c="orange">Stopped with the server; rerun it with the button.</Text>} {o.state === "interrupted" && <Text size="sm" c="orange">Stopped with the server; rerun it with the button.</Text>}
<Thread lines={o.lines} /> <Thread lines={o.lines} />
{o.summary && <Page title="Summary" src={`/api/analyses/${name}/summary.html?dark=${dark}&v=${o.summary}`} />} {o.summary && <Page title="Summary" src={`/api/analyses/${name}/summary.html?dark=${dark}&v=${o.summary}`} />}
{o.summary && <Text size="xs" c="dimmed" ff="monospace">python3 detectors/bench/score.py data/{d.station} --labels labeling/auto/{d.station}.jsonl --from {d.start.slice(0, 10)} --to {end}</Text>} {o.summary && <Text size="xs" c="dimmed" ff="monospace">python3 models/rules/bench/score.py data/{d.station} --labels labeling/auto/{d.station}.jsonl --from {d.start.slice(0, 10)} --to {end}</Text>}
</Stack> </Stack>
)} )}
<Text size="xs" c="dimmed">labeling/auto/{kind}/{name}/</Text> <Text size="xs" c="dimmed">labeling/auto/{kind}/{name}/</Text>